| Current Path : /home/wuectly/www/03cbe/ |
| Current File : /home/wuectly/www/03cbe/com_menus.zip |
PK uy#]?��u / / items/default.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage Template.hathor
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.multiselect');
$user = JFactory::getUser();
$app = JFactory::getApplication();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$ordering = ($listOrder == 'a.lft');
$canOrder = $user->authorise('core.edit.state', 'com_menus');
$saveOrder = ($listOrder == 'a.lft' && $listDirn == 'asc');
$menutypeid = (int) $this->state->get('menutypeid');
$assoc = JLanguageAssociations::isEnabled() && $this->state->get('filter.client_id') == 0;
?>
<?php // Set up the filter bar. ?>
<form action="<?php echo JRoute::_('index.php?option=com_menus&view=items'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<fieldset id="filter-bar">
<legend class="element-invisible"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></legend>
<div class="filter-search">
<label class="filter-search-lbl" for="filter_search"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></label>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo JText::_('COM_MENUS_ITEMS_SEARCH_FILTER'); ?>" />
<button type="submit"><?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
<button type="button" onclick="document.getElementById('filter_search').value='';this.form.submit();"><?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
</div>
<div class="filter-select">
<label class="selectlabel" for="menutype">
<?php echo JText::_('TPL_HATHOR_COM_MENUS_MENU'); ?>
</label>
<select name="menutype" id="menutype">
<?php echo JHtml::_('select.options', JHtml::_('menu.menus'), 'value', 'text', $this->state->get('filter.menutype')); ?>
</select>
<label class="selectlabel" for="filter_level">
<?php echo JText::_('COM_MENUS_OPTION_SELECT_LEVEL'); ?>
</label>
<select name="filter_level" id="filter_level">
<option value=""><?php echo JText::_('COM_MENUS_OPTION_SELECT_LEVEL'); ?></option>
<?php echo JHtml::_('select.options', $this->f_levels, 'value', 'text', $this->state->get('filter.level')); ?>
</select>
<label class="selectlabel" for="filter_published">
<?php echo JText::_('JOPTION_SELECT_PUBLISHED'); ?>
</label>
<select name="filter[published]" id="filter_published">
<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED'); ?></option>
<?php echo JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('archived' => false)), 'value', 'text', $this->state->get('filter.published'), true); ?>
</select>
<label class="selectlabel" for="filter_access">
<?php echo JText::_('JOPTION_SELECT_ACCESS'); ?>
</label>
<select name="filter[access]" id="filter_access">
<option value=""><?php echo JText::_('JOPTION_SELECT_ACCESS'); ?></option>
<?php echo JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')); ?>
</select>
<label class="selectlabel" for="filter_language">
<?php echo JText::_('JOPTION_SELECT_LANGUAGE'); ?>
</label>
<select name="filter[language]" id="filter_language">
<option value=""><?php echo JText::_('JOPTION_SELECT_LANGUAGE'); ?></option>
<?php echo JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language')); ?>
</select>
<button type="submit" id="filter-go">
<?php echo JText::_('JSUBMIT'); ?></button>
</div>
</fieldset>
<div class="clr"> </div>
<?php //Set up the grid heading. ?>
<table class="adminlist">
<thead>
<tr>
<th class="checkmark-col">
<input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
</th>
<th class="title">
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<th class="nowrap state-col">
<?php echo JHtml::_('grid.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
</th>
<th class="nowrap ordering-col">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ORDERING', 'a.lft', $listDirn, $listOrder); ?>
<?php if ($canOrder && $saveOrder) : ?>
<?php echo JHtml::_('grid.order', $this->items, 'filesave.png', 'items.saveorder'); ?>
<?php endif; ?>
</th>
<th class="title access-col">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'access_level', $listDirn, $listOrder); ?>
</th>
<th width="10%">
<?php echo JText::_('JGRID_HEADING_MENU_ITEM_TYPE'); ?>
</th>
<?php if ($this->state->get('filter.client_id') == 0): ?>
<th class="home-col">
<?php echo JHtml::_('grid.sort', 'COM_MENUS_HEADING_HOME', 'a.home', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<?php if ($assoc) : ?>
<th class="width-5">
<?php echo JHtml::_('grid.sort', 'COM_MENUS_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<th class="language-col">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
</th>
<th class="nowrap id-col">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->items as $i => $item) :
$orderkey = array_search($item->id, $this->ordering[$item->parent_id]);
$canCreate = $user->authorise('core.create', 'com_menus.menu.' . $menutypeid);
$canEdit = $user->authorise('core.edit', 'com_menus.menu.' . $menutypeid);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id')|| $item->checked_out == 0;
$canChange = $user->authorise('core.edit.state', 'com_menus.menu.' . $menutypeid) && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center">
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
</td>
<td>
<?php echo str_repeat('<span class="gi">|—</span>', $item->level - 1) ?>
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'items.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit && !$item->protected) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_menus&task=item.edit&id='.(int) $item->id); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
<p class="smallsub" title="<?php echo $this->escape($item->path); ?>">
<?php echo str_repeat('<span class="gtr">|—</span>', $item->level - 1) ?>
<?php if ($item->type != 'url') : ?>
<?php if (empty($item->note)) : ?>
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
<?php else : ?>
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?>
<?php endif; ?>
<?php elseif ($item->type == 'url' && $item->note) : ?>
<?php echo JText::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note)); ?>
<?php endif; ?></p>
</td>
<td class="center">
<?php echo JHtml::_('MenusHtml.Menus.state', $item->published, $i, $canChange, 'cb'); ?>
</td>
<td class="order">
<?php if ($canChange) : ?>
<?php if ($saveOrder) : ?>
<span><?php echo $this->pagination->orderUpIcon($i, isset($this->ordering[$item->parent_id][$orderkey - 1]), 'items.orderup', 'JLIB_HTML_MOVE_UP', $ordering); ?></span>
<span><?php echo $this->pagination->orderDownIcon($i, $this->pagination->total, isset($this->ordering[$item->parent_id][$orderkey + 1]), 'items.orderdown', 'JLIB_HTML_MOVE_DOWN', $ordering); ?></span>
<?php endif; ?>
<?php $disabled = $saveOrder ? '' : 'disabled="disabled"'; ?>
<input type="text" name="order[]" value="<?php echo $orderkey + 1; ?>" <?php echo $disabled; ?> class="text-area-order" title="<?php echo $item->title; ?> order" />
<?php else : ?>
<?php echo $orderkey + 1; ?>
<?php endif; ?>
</td>
<td class="center">
<?php echo $this->escape($item->access_level); ?>
</td>
<td class="nowrap">
<span title="<?php echo isset($item->item_type_desc) ? htmlspecialchars($this->escape($item->item_type_desc), ENT_COMPAT, 'UTF-8') : ''; ?>">
<?php echo $this->escape($item->item_type); ?></span>
</td>
<?php if ($this->state->get('filter.client_id') == 0): ?>
<td class="center">
<?php if ($item->type == 'component') : ?>
<?php if ($item->language == '*' || $item->home == '0'):?>
<?php echo JHtml::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange && !$item->protected); ?>
<?php elseif ($canChange):?>
<a href="<?php echo JRoute::_('index.php?option=com_menus&task=items.unsetDefault&cid[]='.$item->id.'&'.JSession::getFormToken().'=1'); ?>">
<?php if ($item->language_image) : ?>
<?php echo JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => JText::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $item->language_title)), true); ?>
<?php else : ?>
<span class="label" title="<?php echo JText::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $item->language_title); ?>"><?php echo $item->language_sef; ?></span>
<?php endif; ?>
</a>
<?php else:?>
<?php if ($item->language_image) : ?>
<?php echo JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true); ?>
<?php else : ?>
<span class="label" title="<?php echo $item->language_title; ?>"><?php echo $item->language_sef; ?></span>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if ($assoc) : ?>
<td class="center">
<?php if ($item->association):?>
<?php echo JHtml::_('MenusHtml.Menus.association', $item->id); ?>
<?php endif; ?>
</td>
<?php endif; ?>
<td class="center">
<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
</td>
<td class="center">
<span title="<?php echo sprintf('%d-%d', $item->lft, $item->rgt); ?>">
<?php echo (int) $item->id; ?></span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php echo $this->pagination->getListFooter(); ?>
<div class="clr"> </div>
<?php //Load the batch processing form.is user is allowed ?>
<?php if ($user->authorise('core.create', 'com_menus') || $user->authorise('core.edit', 'com_menus')) : ?>
<?php echo JHtml::_(
'bootstrap.renderModal',
'collapseModal',
array(
'title' => JText::_('COM_MENUS_BATCH_OPTIONS'),
'footer' => $this->loadTemplate('batch_footer'),
),
$this->loadTemplate('batch_body')
); ?>
<?php endif; ?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
PK uy#]�H: : item/edit_options.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage Template.hathor
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$assoc = JLanguageAssociations::isEnabled();
?>
<?php
$fieldSets = $this->form->getFieldsets('request');
if (!empty($fieldSets))
{
$fieldSet = array_shift($fieldSets);
$label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_MENUS_'.$fieldSet->name.'_FIELDSET_LABEL';
echo JHtml::_('sliders.panel', JText::_($label), 'request-options');
if (isset($fieldSet->description) && trim($fieldSet->description)) :
echo '<p class="tip">'.$this->escape(JText::_($fieldSet->description)).'</p>';
endif;
?>
<fieldset class="panelform">
<legend class="element-invisible"><?php echo JText::_($label) ?></legend>
<?php $hidden_fields = ''; ?>
<ul class="adminformlist">
<?php foreach ($this->form->getFieldset('request') as $field) : ?>
<?php if (!$field->hidden) : ?>
<li>
<?php echo $field->label; ?>
<?php echo $field->input; ?>
</li>
<?php else : $hidden_fields .= $field->input; ?>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php echo $hidden_fields; ?>
</fieldset>
<?php
}
$fieldSets = $this->form->getFieldsets('params');
foreach ($fieldSets as $name => $fieldSet) :
$label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_MENUS_'.$name.'_FIELDSET_LABEL';
echo JHtml::_('sliders.panel', JText::_($label), $name.'-options');
if (isset($fieldSet->description) && trim($fieldSet->description)) :
echo '<p class="tip">'.$this->escape(JText::_($fieldSet->description)).'</p>';
endif;
?>
<div class="clr"></div>
<fieldset class="panelform">
<legend class="element-invisible"><?php echo JText::_($label) ?></legend>
<ul class="adminformlist">
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<li><?php echo $field->label; ?>
<?php echo $field->input; ?></li>
<?php endforeach; ?>
</ul>
</fieldset>
<?php endforeach;?>
<?php if ($assoc && $this->state->get('item.client_id') != 1) : ?>
<?php echo JHtml::_('sliders.panel', JText::_('JGLOBAL_FIELDSET_ASSOCIATIONS'), '-options');?>
<?php echo $this->loadTemplate('associations'); ?>
<?php endif; ?>
PK uy#]���@8 8
item/edit.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage Template.hathor
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.framework');
JHtml::_('behavior.formvalidator');
JHtml::_('behavior.modal');
$assoc = JLanguageAssociations::isEnabled();
// Ajax for parent items
$script = "
jQuery(document).ready(function ($){
$('#jform_menutype').change(function(){
var menutype = $(this).val();
$.ajax({
url: 'index.php?option=com_menus&task=item.getParentItem&menutype=' + menutype,
dataType: 'json'
}).done(function(data) {
$('#jform_parent_id option').each(function() {
if ($(this).val() != '1') {
$(this).remove();
}
});
$.each(data, function (i, val) {
var option = $('<option>');
option.text(val.title).val(val.id);
$('#jform_parent_id').append(option);
});
$('#jform_parent_id').trigger('liszt:updated');
});
});
});
Joomla.submitbutton = function(task, type){
if (task == 'item.setType' || task == 'item.setMenuType')
{
if (task == 'item.setType')
{
jQuery('#item-form input[name=\"jform[type]\"]').val(type);
jQuery('#fieldtype').val('type');
} else {
jQuery('#item-form input[name=\"jform[menutype]\"]').val(type);
}
Joomla.submitform('item.setType', document.getElementById('item-form'));
} else if (task == 'item.cancel' || document.formvalidator.isValid(document.getElementById('item-form')))
{
Joomla.submitform(task, document.getElementById('item-form'));
}
else
{
// special case for modal popups validation response
jQuery('#item-form .modal-value.invalid').each(function(){
var field = jQuery(this),
idReversed = field.attr('id').split('').reverse().join(''),
separatorLocation = idReversed.indexOf('_'),
nameId = '#' + idReversed.substr(separatorLocation).split('').reverse().join('') + 'name';
jQuery(nameId).addClass('invalid');
});
}
};
";
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration($script);
// In case of modal
$input = JFactory::getApplication()->input;
$isModal = $input->get('layout') == 'modal' ? true : false;
$layout = $isModal ? 'modal' : 'edit';
$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : '';
$clientId = $this->state->get('item.client_id', 0);
?>
<div class="menuitem-edit">
<form action="<?php echo JRoute::_('index.php?option=com_menus&view=item&client_id=' . $clientId . '&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" class="form-validate">
<div class="col main-section">
<fieldset class="adminform">
<legend><?php echo JText::_('COM_MENUS_ITEM_DETAILS');?></legend>
<ul class="adminformlist">
<li><?php echo $this->form->getLabel('type'); ?>
<?php echo $this->form->getInput('type'); ?></li>
<li><?php echo $this->form->getLabel('title'); ?>
<?php echo $this->form->getInput('title'); ?></li>
<?php if ($this->item->type == 'url') : ?>
<?php $this->form->setFieldAttribute('link', 'readonly', 'false');?>
<li><?php echo $this->form->getLabel('link'); ?>
<?php echo $this->form->getInput('link'); ?></li>
<?php endif; ?>
<?php if ($this->item->type != 'url') : ?>
<li><?php echo $this->form->getLabel('alias'); ?>
<?php echo $this->form->getInput('alias'); ?></li>
<?php endif; ?>
<li><?php echo $this->form->getLabel('note'); ?>
<?php echo $this->form->getInput('note'); ?></li>
<?php if ($this->item->type !== 'url') : ?>
<li><?php echo $this->form->getLabel('link'); ?>
<?php echo $this->form->getInput('link'); ?></li>
<?php endif ?>
<?php if ($this->canDo->get('core.edit.state')) : ?>
<li><?php echo $this->form->getLabel('published'); ?>
<?php echo $this->form->getInput('published'); ?></li>
<?php endif ?>
<li><?php echo $this->form->getLabel('access'); ?>
<?php echo $this->form->getInput('access'); ?></li>
<li><?php echo $this->form->getLabel('menutype'); ?>
<?php echo $this->form->getInput('menutype'); ?></li>
<li><?php echo $this->form->getLabel('parent_id'); ?>
<?php echo $this->form->getInput('parent_id'); ?></li>
<li><?php echo $this->form->getLabel('menuordering'); ?>
<?php echo $this->form->getInput('menuordering'); ?></li>
<li><?php echo $this->form->getLabel('browserNav'); ?>
<?php echo $this->form->getInput('browserNav'); ?></li>
<?php if ($this->canDo->get('core.edit.state')) : ?>
<?php if ($this->item->type == 'component') : ?>
<li><?php echo $this->form->getLabel('home'); ?>
<?php echo $this->form->getInput('home'); ?></li>
<?php endif; ?>
<?php endif; ?>
<li><?php echo $this->form->getLabel('language'); ?>
<?php echo $this->form->getInput('language'); ?></li>
<li><?php echo $this->form->getLabel('template_style_id'); ?>
<?php echo $this->form->getInput('template_style_id'); ?></li>
<li><?php echo $this->form->getLabel('id'); ?>
<?php echo $this->form->getInput('id'); ?></li>
<li><?php echo $this->form->getLabel('client_id'); ?>
<?php echo $this->form->getInput('client_id'); ?></li>
</ul>
</fieldset>
</div>
<div class="col options-section">
<?php echo JHtml::_('sliders.start', 'menu-sliders-'.$this->item->id); ?>
<?php //Load parameters.
echo $this->loadTemplate('options'); ?>
<div class="clr"></div>
<?php if (!empty($this->modules)) : ?>
<?php echo JHtml::_('sliders.panel', JText::_('COM_MENUS_ITEM_MODULE_ASSIGNMENT'), 'module-options'); ?>
<fieldset>
<?php echo $this->loadTemplate('modules'); ?>
</fieldset>
<?php endif; ?>
<?php echo JHtml::_('sliders.end'); ?>
<input type="hidden" name="task" value="" />
<?php echo $this->form->getInput('component_id'); ?>
<?php echo JHtml::_('form.token'); ?>
<input type="hidden" id="fieldtype" name="fieldtype" value="" />
</div>
</form>
<div class="clr"></div>
</div>
PK uy#]H焴 menutypes/default.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage Template.hathor
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$input = JFactory::getApplication()->input;
// Checking if loaded via index.php or component.php
$tmpl = ($input->getCmd('tmpl') != '') ? '1' : '';
JFactory::getDocument()->addScriptDeclaration(
'
setmenutype = function(type) {
var tmpl = ' . json_encode($tmpl) . ';
if (tmpl)
{
window.parent.Joomla.submitbutton("item.setType", type);
window.parent.jQuery("#menuTypeModal").modal("hide");
}
else
{
window.location="index.php?option=com_menus&view=item&task=item.setType&layout=edit&type=" + type;
}
};
'
);
?>
<h2 class="modal-title"><?php echo JText::_('COM_MENUS_TYPE_CHOOSE'); ?></h2>
<ul class="menu_types">
<?php foreach ($this->types as $name => $list): ?>
<li><dl class="menu_type">
<dt><?php echo JText::_($name); ?></dt>
<dd><ul>
<?php foreach ($list as $item): ?>
<li><a class="choose_type" href="#" title="<?php echo JText::_($item->description); ?>"
onclick="javascript:setmenutype('<?php echo base64_encode(json_encode(array('id' => $this->recordId, 'title' => isset($item->type) ? $item->type : $item->title, 'request' => $item->request))); ?>')">
<?php echo JText::_($item->title);?>
</a>
</li>
<?php endforeach; ?>
</ul>
</dd>
</dl>
</li>
<?php endforeach; ?>
</ul>
PK uy#]w����! �! menus/default.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage Template.hathor
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.multiselect');
$uri = JUri::getInstance();
$return = base64_encode($uri);
$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$modMenuId = (int) $this->get('ModMenuId');
$script = array();
$script[] = 'jQuery(document).ready(function() {';
foreach ($this->items as $item) :
if ($user->authorise('core.edit', 'com_menus')) :
$script[] = ' function jSelectPosition_' . $item->id . '(name) {';
$script[] = ' document.getElementById("' . $item->id . '").value = name;';
$script[] = ' jQuery(".modal").modal("hide");';
$script[] = ' };';
endif;
endforeach;
$script[] = ' jQuery(".modal").on("hidden", function () {';
$script[] = ' setTimeout(function(){';
$script[] = ' window.parent.location.reload();';
$script[] = ' },1000);';
$script[] = ' });';
$script[] = '});';
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
?>
<form action="<?php echo JRoute::_('index.php?option=com_menus&view=menus');?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<fieldset id="filter-bar">
<legend class="element-invisible"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></legend>
<div class="filter-search">
<label class="filter-search-lbl" for="filter_search"><?php echo JText::_('COM_MENUS_MENU_SEARCH_FILTER'); ?></label>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo JText::_('COM_MENUS_ITEMS_SEARCH_FILTER'); ?>" />
<button type="submit"><?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
<button type="button" onclick="document.getElementById('filter_search').value='';this.form.submit();"><?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
</div>
</fieldset>
<div class="clearfix"> </div>
<table class="adminlist">
<thead>
<tr>
<th class="checkmark-col" rowspan="2">
<input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
</th>
<th rowspan="2">
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<th class="width-30" colspan="3">
<?php echo JText::_('COM_MENUS_HEADING_NUMBER_MENU_ITEMS'); ?>
</th>
<th class="width-20" rowspan="2">
<?php echo JText::_('COM_MENUS_HEADING_LINKED_MODULES'); ?>
</th>
<th class="nowrap id-col" rowspan="2">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
<tr>
<th class="width-10">
<?php echo JText::_('COM_MENUS_HEADING_PUBLISHED_ITEMS'); ?>
</th>
<th class="width-10">
<?php echo JText::_('COM_MENUS_HEADING_UNPUBLISHED_ITEMS'); ?>
</th>
<th class="width-10">
<?php echo JText::_('COM_MENUS_HEADING_TRASHED_ITEMS'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->items as $i => $item) :
$canCreate = $user->authorise('core.create', 'com_menus');
$canEdit = $user->authorise('core.edit', 'com_menus');
$canChange = $user->authorise('core.edit.state', 'com_menus');
$canManageItems = $user->authorise('core.manage', 'com_menus.menu.' . (int) $item->id);
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center">
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
</td>
<td>
<?php if ($canManageItems) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
<p class="smallsub">(<span><?php echo JText::_('COM_MENUS_MENU_MENUTYPE_LABEL') ?></span>
<?php if ($canEdit) : ?>
<?php echo '<a href="'.JRoute::_('index.php?option=com_menus&task=menu.edit&id='.$item->id).' title='.$this->escape($item->description).'">'.
$this->escape($item->menutype).'</a>'; ?>)
<?php else : ?>
<?php echo $this->escape($item->menutype)?>)
<?php endif; ?>
</p>
</td>
<td class="center btns">
<a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype.'&filter_published=1');?>">
<?php echo $item->count_published; ?></a>
</td>
<td class="center btns">
<a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype.'&filter_published=0');?>">
<?php echo $item->count_unpublished; ?></a>
</td>
<td class="center btns">
<a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype.'&filter_published=-2');?>">
<?php echo $item->count_trashed; ?></a>
</td>
<td class="left">
<ul class="menu-module-list">
<?php
if (isset($this->modules[$item->menutype])) :
foreach ($this->modules[$item->menutype] as &$module) :
?>
<li>
<?php if ($canEdit) : ?>
<?php $link = JRoute::_('index.php?option=com_modules&task=module.edit&id='.$module->id.'&return='.$return.'&tmpl=component&layout=modal'); ?>
<a href="#module<?php echo $module->id; ?>Modal" role="button" class="button" data-toggle="modal" title="<?php echo JText::_('COM_MENUS_EDIT_MODULE_SETTINGS');?>">
<?php echo JText::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?></a>
<?php else : ?>
<?php echo JText::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php foreach ($this->modules[$item->menutype] as &$module) : ?>
<?php if ($canEdit) : ?>
<?php $link = JRoute::_('index.php?option=com_modules&task=module.edit&id='.$module->id.'&return='.$return.'&tmpl=component&layout=modal'); ?>
<?php echo JHtml::_(
'bootstrap.renderModal',
'module' . $module->id . 'Modal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '300px',
'width' => '800px',
'footer' => '<button type="button" class="btn" data-dismiss="modal">'
. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
. '<button type="button" class="btn btn-success" data-dismiss="modal" onclick="jQuery(\'#module'
. $module->id . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_('JSAVE') . '</button>',
)
); ?>
<?php endif; ?>
<?php endforeach; ?>
<?php elseif ($modMenuId) : ?>
<?php $link = JRoute::_('index.php?option=com_modules&task=module.add&eid=' . $modMenuId . '¶ms[menutype]=' . $item->menutype); ?>
<a href="<?php echo $link; ?>"><?php echo JText::_('COM_MENUS_ADD_MENU_MODULE'); ?></a>
<?php echo JHtml::_(
'bootstrap.renderModal',
'moduleModal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '500px',
'width' => '800px',
'footer' => '<button type="button" class="btn" data-dismiss="modal">'
. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
)
); ?>
<?php endif; ?>
</td>
<td class="center">
<?php echo $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php echo $this->pagination->getListFooter(); ?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
PK uy#]/f�� �
menu/edit.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage Template.hathor
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.formvalidator');
JText::script('ERROR');
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
var form = document.getElementById('item-form');
if (task == 'menu.cancel' || document.formvalidator.isValid(form))
{
Joomla.submitform(task, form);
}
};
");
?>
<div class="menu-edit">
<form action="<?php echo JRoute::_('index.php?option=com_menus&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="item-form">
<div class="col main-section">
<fieldset class="adminform">
<legend><?php echo JText::_('COM_MENUS_MENU_DETAILS');?></legend>
<ul class="adminformlist">
<li><?php echo $this->form->getLabel('title'); ?>
<?php echo $this->form->getInput('title'); ?></li>
<li><?php echo $this->form->getLabel('menutype'); ?>
<?php echo $this->form->getInput('menutype'); ?></li>
<li><?php echo $this->form->getLabel('description'); ?>
<?php echo $this->form->getInput('description'); ?></li>
<li><?php echo $this->form->getLabel('client_id'); ?>
<?php echo $this->form->getInput('client_id'); ?></li>
</ul>
</fieldset>
</div>
<div class="clr"></div>
<?php if ($this->canDo->get('core.admin')) : ?>
<div class="col rules-section">
<?php echo JHtml::_('sliders.start', 'permissions-sliders-' . $this->item->id, array('useCookie' => 1)); ?>
<?php echo JHtml::_('sliders.panel', JText::_('COM_MENUS_FIELDSET_RULES'), 'access-rules'); ?>
<fieldset class="panelform">
<legend class="element-invisible"><?php echo JText::_('COM_CONTENT_FIELDSET_RULES'); ?></legend>
<?php echo $this->form->getLabel('rules'); ?>
<?php echo $this->form->getInput('rules'); ?>
</fieldset>
<?php echo JHtml::_('sliders.end'); ?>
</div>
<?php endif; ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
<div class="clr"></div>
</div>
PK y\$]xP�f� � js/admin-items-modal.jsnu &1i� /**
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(function() {
"use strict";
/**
* Javascript to insert the link
* View element calls jSelectContact when a contact is clicked
* jSelectContact creates the link tag, sends it to the editor,
* and closes the select frame.
*/
window.jSelectMenuItem = function(id, title, uri, object, link, lang)
{
var thislang = '', tag, editor;
if (!Joomla.getOptions('xtd-menus')) {
// Something went wrong!
window.parent.jModalClose();
return false;
}
editor = Joomla.getOptions('xtd-menus').editor;
if (lang !== '')
{
thislang = '&lang=';
}
tag = '<a href=\"' + uri + thislang + lang + '">' + title + '</a>';
/** Use the API, if editor supports it **/
if (window.parent.Joomla && window.parent.Joomla.editors && window.parent.Joomla.editors.instances && window.parent.Joomla.editors.instances.hasOwnProperty(editor)) {
if (typeof window.parent.Joomla.editors.instances[editor]['getSelection'] !== 'undefined' && window.parent.Joomla.editors.instances[editor].getSelection()) {
window.parent.Joomla.editors.instances[editor].replaceSelection('<a href=\"' + uri + thislang + lang + '">' + window.parent.Joomla.editors.instances[editor].getSelection() + '</a>');
} else {
window.parent.Joomla.editors.instances[editor].replaceSelection(tag)
}
} else {
window.parent.jInsertEditorText(tag, editor);
}
window.parent.jModalClose();
};
document.addEventListener('DOMContentLoaded', function(){
// Get the elements
var elements = document.querySelectorAll('.select-link');
for(var i = 0, l = elements.length; l>i; i++) {
// Listen for click event
elements[i].addEventListener('click', function (event) {
event.preventDefault();
var functionName = event.target.getAttribute('data-function');
if (functionName === 'jSelectMenuItem') {
// Used in xtd_contacts
window[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-uri'), null, null, event.target.getAttribute('data-language'));
} else {
// Used in com_menus
window.parent[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), null, null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language'), null);
}
})
}
});
})();
PK y\$]<�\z z js/admin-items-modal.min.jsnu &1i� !function(){"use strict";window.jSelectMenuItem=function(t,e,n,a,o,i){var r,d,l="";if(!Joomla.getOptions("xtd-menus"))return window.parent.jModalClose(),!1;d=Joomla.getOptions("xtd-menus").editor,""!==i&&(l="&lang="),r='<a href="'+n+l+i+'">'+e+"</a>",window.parent.Joomla&&window.parent.Joomla.editors&&window.parent.Joomla.editors.instances&&window.parent.Joomla.editors.instances.hasOwnProperty(d)?void 0!==window.parent.Joomla.editors.instances[d].getSelection&&window.parent.Joomla.editors.instances[d].getSelection()?window.parent.Joomla.editors.instances[d].replaceSelection('<a href="'+n+l+i+'">'+window.parent.Joomla.editors.instances[d].getSelection()+"</a>"):window.parent.Joomla.editors.instances[d].replaceSelection(r):window.parent.jInsertEditorText(r,d),window.parent.jModalClose()},document.addEventListener("DOMContentLoaded",function(){for(var t=document.querySelectorAll(".select-link"),e=0,n=t.length;e<n;e++)t[e].addEventListener("click",function(t){t.preventDefault();var e=t.target.getAttribute("data-function");"jSelectMenuItem"===e?window[e](t.target.getAttribute("data-id"),t.target.getAttribute("data-title"),t.target.getAttribute("data-uri"),null,null,t.target.getAttribute("data-language")):window.parent[e](t.target.getAttribute("data-id"),t.target.getAttribute("data-title"),null,null,t.target.getAttribute("data-uri"),t.target.getAttribute("data-language"),null)})})}();
PK V^$]�*�#y y controllers/items.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* The Menu Item Controller
*
* @since 1.6
*/
class MenusControllerItems extends JControllerAdmin
{
/**
* Constructor
*
* @param array $config Optional configuration array
*
* @since 1.6
*/
public function __construct($config = array())
{
parent::__construct($config);
$this->registerTask('unsetDefault', 'setDefault');
}
/**
* Proxy for getModel.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*
* @since 1.6
*/
public function getModel($name = 'Item', $prefix = 'MenusModel', $config = array())
{
return parent::getModel($name, $prefix, array('ignore_request' => true));
}
/**
* Rebuild the nested set tree.
*
* @return boolean False on failure or error, true on success.
*
* @since 1.6
*/
public function rebuild()
{
$this->checkToken();
$this->setRedirect('index.php?option=com_menus&view=items');
$model = $this->getModel();
if ($model->rebuild())
{
// Reorder succeeded.
$this->setMessage(JText::_('COM_MENUS_ITEMS_REBUILD_SUCCESS'));
return true;
}
else
{
// Rebuild failed.
$this->setMessage(JText::sprintf('COM_MENUS_ITEMS_REBUILD_FAILED'), 'error');
return false;
}
}
/**
* Save the manual order inputs from the menu items list view
*
* @return void
*
* @see JControllerAdmin::saveorder()
* @deprecated 4.0
*/
public function saveorder()
{
$this->checkToken();
try
{
JLog::add(
sprintf('%s() is deprecated. Function will be removed in 4.0.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
// Get the arrays from the Request
$order = $this->input->post->get('order', null, 'array');
$originalOrder = explode(',', $this->input->getString('original_order_values'));
// Make sure something has changed
if (!($order === $originalOrder))
{
parent::saveorder();
}
else
{
// Nothing to reorder
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
return true;
}
}
/**
* Method to set the home property for a list of items
*
* @return void
*
* @since 1.6
*/
public function setDefault()
{
// Check for request forgeries
$this->checkToken('request');
$app = JFactory::getApplication();
// Get items to publish from the request.
$cid = (array) $this->input->get('cid', array(), 'int');
$data = array('setDefault' => 1, 'unsetDefault' => 0);
$task = $this->getTask();
$value = ArrayHelper::getValue($data, $task, 0, 'int');
// Remove zero values resulting from input filter
$cid = array_filter($cid);
if (empty($cid))
{
JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
}
else
{
// Get the model.
$model = $this->getModel();
// Publish the items.
if (!$model->setHome($cid, $value))
{
JError::raiseWarning(500, $model->getError());
}
else
{
if ($value == 1)
{
$ntext = 'COM_MENUS_ITEMS_SET_HOME';
}
else
{
$ntext = 'COM_MENUS_ITEMS_UNSET_HOME';
}
$this->setMessage(JText::plural($ntext, count($cid)));
}
}
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. '&menutype=' . $app->getUserState('com_menus.items.menutype'), false
)
);
}
/**
* Method to publish a list of items
*
* @return void
*
* @since 3.6.0
*/
public function publish()
{
// Check for request forgeries
$this->checkToken();
// Get items to publish from the request.
$cid = (array) JFactory::getApplication()->input->get('cid', array(), 'int');
$data = array('publish' => 1, 'unpublish' => 0, 'trash' => -2, 'report' => -3);
$task = $this->getTask();
$value = ArrayHelper::getValue($data, $task, 0, 'int');
// Remove zero values resulting from input filter
$cid = array_filter($cid);
if (empty($cid))
{
try
{
JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
}
catch (RuntimeException $exception)
{
JFactory::getApplication()->enqueueMessage(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), 'warning');
}
}
else
{
// Get the model.
$model = $this->getModel();
// Publish the items.
try
{
$model->publish($cid, $value);
$errors = $model->getErrors();
$messageType = 'message';
if ($value == 1)
{
if ($errors)
{
$messageType = 'error';
$ntext = $this->text_prefix . '_N_ITEMS_FAILED_PUBLISHING';
}
else
{
$ntext = $this->text_prefix . '_N_ITEMS_PUBLISHED';
}
}
elseif ($value == 0)
{
$ntext = $this->text_prefix . '_N_ITEMS_UNPUBLISHED';
}
else
{
$ntext = $this->text_prefix . '_N_ITEMS_TRASHED';
}
$this->setMessage(JText::plural($ntext, count($cid)), $messageType);
}
catch (Exception $e)
{
$this->setMessage($e->getMessage(), 'error');
}
}
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . '&menutype=' .
JFactory::getApplication()->getUserState('com_menus.items.menutype'),
false
)
);
}
/**
* Check in of one or more records.
*
* @return boolean True on success
*
* @since 3.6.0
*/
public function checkin()
{
// Check for request forgeries.
$this->checkToken();
// Read the Ids from the post data
$cid = (array) JFactory::getApplication()->input->post->get('cid', array(), 'int');
// Remove zero values resulting from input filter
$cid = array_filter($cid);
// Run the model
$model = $this->getModel();
$return = $model->checkin($cid);
if ($return === false)
{
// Checkin failed.
$message = JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError());
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. '&menutype=' . JFactory::getApplication()->getUserState('com_menus.items.menutype'),
false
),
$message,
'error'
);
return false;
}
else
{
// Checkin succeeded.
$message = JText::plural($this->text_prefix . '_N_ITEMS_CHECKED_IN', count($cid));
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. '&menutype=' . JFactory::getApplication()->getUserState('com_menus.items.menutype'),
false
),
$message
);
return true;
}
}
}
PK V^$]�ǽ�d d controllers/ajax.json.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\LanguageHelper;
/**
* The menu controller for ajax requests
*
* @since 3.9.0
*/
class MenusControllerAjax extends JControllerLegacy
{
/**
* Method to fetch associations of a menu item
*
* The method assumes that the following http parameters are passed in an Ajax Get request:
* token: the form token
* assocId: the id of the menu item whose associations are to be returned
* excludeLang: the association for this language is to be excluded
*
* @return null
*
* @since 3.9.0
*/
public function fetchAssociations()
{
if (!JSession::checkToken('get'))
{
echo new JResponseJson(null, JText::_('JINVALID_TOKEN'), true);
}
else
{
$input = JFactory::getApplication()->input;
$extension = $input->get('extension');
$assocId = $input->getInt('assocId', 0);
if ($assocId == 0)
{
echo new JResponseJson(null, JText::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID', 'assocId'), true);
return;
}
$excludeLang = $input->get('excludeLang', '', 'STRING');
$associations = JLanguageAssociations::getAssociations('com_menus', '#__menu', 'com_menus.item', (int) $assocId, 'id', '', '');
unset($associations[$excludeLang]);
// Add the title to each of the associated records
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/tables');
$menuTable = JTable::getInstance('Menu', 'JTable', array());
foreach ($associations as $lang => $association)
{
$menuTable->load($association->id);
$associations[$lang]->title = $menuTable->title;
}
$countContentLanguages = count(LanguageHelper::getContentLanguages(array(0, 1)));
if (count($associations) == 0)
{
$message = JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_NONE');
}
elseif ($countContentLanguages > count($associations) + 2)
{
$tags = implode(', ', array_keys($associations));
$message = JText::sprintf('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_SOME', $tags);
}
else
{
$message = JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_ALL');
}
echo new JResponseJson($associations, $message);
}
}
}
PK V^$]���5 controllers/menu.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* The Menu Type Controller
*
* @since 1.6
*/
class MenusControllerMenu extends JControllerForm
{
/**
* Dummy method to redirect back to standard controller
*
* @param boolean $cachable If true, the view output will be cached.
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menus', false));
}
/**
* Method to save a menu item.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 1.6
*/
public function save($key = null, $urlVar = null)
{
// Check for request forgeries.
$this->checkToken();
$app = JFactory::getApplication();
$data = $this->input->post->get('jform', array(), 'array');
$context = 'com_menus.edit.menu';
$task = $this->getTask();
$recordId = $this->input->getInt('id');
// Prevent using 'main' as menutype as this is reserved for backend menus
if (strtolower($data['menutype']) == 'main')
{
$msg = JText::_('COM_MENUS_ERROR_MENUTYPE');
JFactory::getApplication()->enqueueMessage($msg, 'error');
// Redirect back to the edit screen.
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit' . $this->getRedirectToItemAppend($recordId), false));
return false;
}
// Populate the row id from the session.
$data['id'] = $recordId;
// Get the model and attempt to validate the posted data.
$model = $this->getModel('Menu');
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
$validData = $model->validate($form, $data);
// Check for validation errors.
if ($validData === false)
{
// Get the validation messages.
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
{
if ($errors[$i] instanceof Exception)
{
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
}
else
{
$app->enqueueMessage($errors[$i], 'warning');
}
}
// Save the data in the session.
$app->setUserState($context . '.data', $data);
// Redirect back to the edit screen.
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit' . $this->getRedirectToItemAppend($recordId), false));
return false;
}
if (isset($validData['preset']))
{
$preset = trim($validData['preset']) ?: null;
unset($validData['preset']);
}
// Attempt to save the data.
if (!$model->save($validData))
{
// Save the data in the session.
$app->setUserState($context . '.data', $validData);
// Redirect back to the edit screen.
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit' . $this->getRedirectToItemAppend($recordId), false));
return false;
}
// Import the preset selected
if (isset($preset) && $data['client_id'] == 1)
{
try
{
MenusHelper::installPreset($preset, $data['menutype']);
$this->setMessage(JText::_('COM_MENUS_PRESET_IMPORT_SUCCESS'));
}
catch (Exception $e)
{
// Save was successful but the preset could not be loaded. Let it through with just a warning
$this->setMessage(JText::sprintf('COM_MENUS_PRESET_IMPORT_FAILED', $e->getMessage()));
}
}
else
{
$this->setMessage(JText::_('COM_MENUS_MENU_SAVE_SUCCESS'));
}
// Redirect the user and adjust session state based on the chosen task.
switch ($task)
{
case 'apply':
// Set the record data in the session.
$recordId = $model->getState($this->context . '.id');
$this->holdEditId($context, $recordId);
$app->setUserState($context . '.data', null);
// Redirect back to the edit screen.
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit' . $this->getRedirectToItemAppend($recordId), false));
break;
case 'save2new':
// Clear the record id and data from the session.
$this->releaseEditId($context, $recordId);
$app->setUserState($context . '.data', null);
// Redirect back to the edit screen.
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit', false));
break;
default:
// Clear the record id and data from the session.
$this->releaseEditId($context, $recordId);
$app->setUserState($context . '.data', null);
// Redirect to the list screen.
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menus', false));
break;
}
}
/**
* Method to display a menu as preset xml.
*
* @return boolean True if successful, false otherwise.
*
* @since 3.8.0
*/
public function exportXml()
{
// Check for request forgeries.
$this->checkToken();
$cid = (array) $this->input->get('cid', array(), 'int');
// We know the first element is the one we need because we don't allow multi selection of rows
$id = empty($cid) ? 0 : reset($cid);
if ($id === 0)
{
$this->setMessage(JText::_('COM_MENUS_SELECT_MENU_FIRST_EXPORT'), 'warning');
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menus', false));
return false;
}
$model = $this->getModel('Menu');
$item = $model->getItem($id);
if (!$item->menutype)
{
$this->setMessage(JText::_('COM_MENUS_SELECT_MENU_FIRST_EXPORT'), 'warning');
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menus', false));
return false;
}
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&menutype=' . $item->menutype . '&format=xml', false));
return true;
}
}
PK V^$]�d:� � controllers/menus.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* The Menu List Controller
*
* @since 1.6
*/
class MenusControllerMenus extends JControllerLegacy
{
/**
* Display the view
*
* @param boolean $cachable If true, the view output will be cached.
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.6
*/
public function display($cachable = false, $urlparams = false)
{
}
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*
* @since 1.6
*/
public function getModel($name = 'Menu', $prefix = 'MenusModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
/**
* Remove an item.
*
* @return void
*
* @since 1.6
*/
public function delete()
{
// Check for request forgeries
$this->checkToken();
$user = JFactory::getUser();
$app = JFactory::getApplication();
$cids = (array) $this->input->get('cid', array(), 'int');
// Remove zero values resulting from input filter
$cids = array_filter($cids);
if (empty($cids))
{
$app->enqueueMessage(JText::_('COM_MENUS_NO_MENUS_SELECTED'), 'notice');
}
else
{
// Access checks.
foreach ($cids as $i => $id)
{
if (!$user->authorise('core.delete', 'com_menus.menu.' . (int) $id))
{
// Prune items that you can't change.
unset($cids[$i]);
$app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'), 'error');
}
}
if (count($cids) > 0)
{
// Get the model.
$model = $this->getModel();
// Remove the items.
if (!$model->delete($cids))
{
$this->setMessage($model->getError(), 'error');
}
else
{
$this->setMessage(JText::plural('COM_MENUS_N_MENUS_DELETED', count($cids)));
}
}
}
$this->setRedirect('index.php?option=com_menus&view=menus');
}
/**
* Rebuild the menu tree.
*
* @return boolean False on failure or error, true on success.
*
* @since 1.6
*/
public function rebuild()
{
$this->checkToken();
$this->setRedirect('index.php?option=com_menus&view=menus');
$model = $this->getModel('Item');
if ($model->rebuild())
{
// Reorder succeeded.
$this->setMessage(JText::_('JTOOLBAR_REBUILD_SUCCESS'));
return true;
}
else
{
// Rebuild failed.
$this->setMessage(JText::sprintf('JTOOLBAR_REBUILD_FAILED', $model->getError()), 'error');
return false;
}
}
/**
* Temporary method. This should go into the 1.5 to 1.6 upgrade routines.
*
* @return JException|void JException instance on error
*
* @since 1.6
*/
public function resync()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$parts = null;
try
{
$query->select('element, extension_id')
->from('#__extensions')
->where('type = ' . $db->quote('component'));
$db->setQuery($query);
$components = $db->loadAssocList('element', 'extension_id');
}
catch (RuntimeException $e)
{
return JError::raiseWarning(500, $e->getMessage());
}
// Load all the component menu links
$query->select($db->quoteName('id'))
->select($db->quoteName('link'))
->select($db->quoteName('component_id'))
->from('#__menu')
->where($db->quoteName('type') . ' = ' . $db->quote('component.item'));
$db->setQuery($query);
try
{
$items = $db->loadObjectList();
}
catch (RuntimeException $e)
{
return JError::raiseWarning(500, $e->getMessage());
}
foreach ($items as $item)
{
// Parse the link.
parse_str(parse_url($item->link, PHP_URL_QUERY), $parts);
// Tease out the option.
if (isset($parts['option']))
{
$option = $parts['option'];
// Lookup the component ID
if (isset($components[$option]))
{
$componentId = $components[$option];
}
else
{
// Mismatch. Needs human intervention.
$componentId = -1;
}
// Check for mis-matched component id's in the menu link.
if ($item->component_id != $componentId)
{
// Update the menu table.
$log = "Link $item->id refers to $item->component_id, converting to $componentId ($item->link)";
echo "<br />$log";
$query->clear();
$query->update('#__menu')
->set('component_id = ' . $componentId)
->where('id = ' . $item->id);
try
{
$db->setQuery($query)->execute();
}
catch (RuntimeException $e)
{
return JError::raiseWarning(500, $e->getMessage());
}
}
}
}
}
}
PK V^$]?(�e�? �? controllers/item.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* The Menu Item Controller
*
* @since 1.6
*/
class MenusControllerItem extends JControllerForm
{
/**
* Method to check if you can add a new record.
*
* Extended classes can override this if necessary.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 3.6
*/
protected function allowAdd($data = array())
{
$user = JFactory::getUser();
$menuType = JFactory::getApplication()->input->getCmd('menutype', isset($data['menutype']) ? $data['menutype'] : '');
$menutypeID = 0;
// Load menutype ID
if ($menuType)
{
$menutypeID = (int) $this->getMenuTypeId($menuType);
}
return $user->authorise('core.create', 'com_menus.menu.' . $menutypeID);
}
/**
* Method to check if you edit a record.
*
* Extended classes can override this if necessary.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key; default is id.
*
* @return boolean
*
* @since 3.6
*/
protected function allowEdit($data = array(), $key = 'id')
{
$user = JFactory::getUser();
$menutypeID = 0;
if (isset($data[$key]))
{
$model = $this->getModel();
$item = $model->getItem($data[$key]);
if (!empty($item->menutype))
{
// Protected menutype, do not allow edit
if ($item->menutype == 'main')
{
return false;
}
$menutypeID = (int) $this->getMenuTypeId($item->menutype);
}
}
return $user->authorise('core.edit', 'com_menus.menu.' . (int) $menutypeID);
}
/**
* Loads the menutype ID by a given menutype string
*
* @param string $menutype The given menutype
*
* @return integer
*
* @since 3.6
*/
protected function getMenuTypeId($menutype)
{
$model = $this->getModel();
$table = $model->getTable('MenuType', 'JTable');
$table->load(array('menutype' => $menutype));
return (int) $table->id;
}
/**
* Method to add a new menu item.
*
* @return mixed True if the record can be added, a JError object if not.
*
* @since 1.6
*/
public function add()
{
$app = JFactory::getApplication();
$context = 'com_menus.edit.item';
$result = parent::add();
if ($result)
{
$app->setUserState($context . '.type', null);
$app->setUserState($context . '.link', null);
}
return $result;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 1.6
*/
public function batch($model = null)
{
$this->checkToken();
$model = $this->getModel('Item', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=items' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 1.6
*/
public function cancel($key = null)
{
$this->checkToken();
$app = JFactory::getApplication();
$context = 'com_menus.edit.item';
$result = parent::cancel();
if ($result)
{
// Clear the ancillary data from the session.
$app->setUserState($context . '.type', null);
$app->setUserState($context . '.link', null);
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend()
. '&menutype=' . $app->getUserState('com_menus.items.menutype'), false
)
);
}
return $result;
}
/**
* Method to edit an existing record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key
* (sometimes required to avoid router collisions).
*
* @return boolean True if access level check and checkout passes, false otherwise.
*
* @since 1.6
*/
public function edit($key = null, $urlVar = null)
{
$app = JFactory::getApplication();
$result = parent::edit();
if ($result)
{
// Push the new ancillary data into the session.
$app->setUserState('com_menus.edit.item.type', null);
$app->setUserState('com_menus.edit.item.link', null);
}
return $result;
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 3.0.1
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
if ($recordId)
{
$model = $this->getModel();
$item = $model->getItem($recordId);
$clientId = $item->client_id;
$append = '&client_id=' . $clientId . $append;
}
else
{
$app = JFactory::getApplication();
$clientId = $app->input->get('client_id', '0', 'int');
$menuType = $app->input->get('menutype', 'mainmenu', 'cmd');
$append = '&client_id=' . $clientId . ($menuType ? '&menutype=' . $menuType : '') . $append;
}
return $append;
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 1.6
*/
public function save($key = null, $urlVar = null)
{
// Check for request forgeries.
$this->checkToken();
$app = JFactory::getApplication();
$model = $this->getModel('Item', '', array());
$table = $model->getTable();
$data = $this->input->post->get('jform', array(), 'array');
$task = $this->getTask();
$context = 'com_menus.edit.item';
// Set the menutype should we need it.
if ($data['menutype'] !== '')
{
$app->input->set('menutype', $data['menutype']);
}
// Determine the name of the primary key for the data.
if (empty($key))
{
$key = $table->getKeyName();
}
// To avoid data collisions the urlVar may be different from the primary key.
if (empty($urlVar))
{
$urlVar = $key;
}
$recordId = $this->input->getInt($urlVar);
// Populate the row id from the session.
$data[$key] = $recordId;
// The save2copy task needs to be handled slightly differently.
if ($task == 'save2copy')
{
// Check-in the original row.
if ($model->checkin($data['id']) === false)
{
// Check-in failed, go back to the item and display a notice.
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'warning');
return false;
}
// Reset the ID and then treat the request as for Apply.
$data['id'] = 0;
$data['associations'] = array();
$task = 'apply';
}
// Access check.
if (!$this->allowSave($data, $key))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. $this->getRedirectToListAppend(), false
)
);
return false;
}
// Validate the posted data.
// This post is made up of two forms, one for the item and one for params.
$form = $model->getForm($data);
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
if ($data['type'] == 'url')
{
$data['link'] = str_replace(array('"', '>', '<'), '', $data['link']);
if (strstr($data['link'], ':'))
{
$segments = explode(':', $data['link']);
$protocol = strtolower($segments[0]);
$scheme = array(
'http', 'https', 'ftp', 'ftps', 'gopher', 'mailto',
'news', 'prospero', 'telnet', 'rlogin', 'tn3270', 'wais',
'mid', 'cid', 'nntp', 'tel', 'urn', 'ldap', 'file', 'fax',
'modem', 'git', 'sms',
);
if (!in_array($protocol, $scheme))
{
$app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'warning');
$this->setRedirect(
JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false)
);
return false;
}
}
}
$data = $model->validate($form, $data);
// Preprocess request fields to ensure that we remove not set or empty request params
$request = $form->getGroup('request', true);
// Check for the special 'request' entry.
if ($data['type'] == 'component' && !empty($request))
{
$removeArgs = array();
if (!isset($data['request']) || !is_array($data['request']))
{
$data['request'] = array();
}
foreach ($request as $field)
{
$fieldName = $field->getAttribute('name');
if (!isset($data['request'][$fieldName]) || $data['request'][$fieldName] == '')
{
$removeArgs[$fieldName] = '';
}
}
// Parse the submitted link arguments.
$args = array();
parse_str(parse_url($data['link'], PHP_URL_QUERY), $args);
// Merge in the user supplied request arguments.
$args = array_merge($args, $data['request']);
// Remove the unused request params
if (!empty($args) && !empty($removeArgs))
{
$args = array_diff_key($args, $removeArgs);
}
$data['link'] = 'index.php?' . urldecode(http_build_query($args, '', '&'));
unset($data['request']);
}
// Check for validation errors.
if ($data === false)
{
// Get the validation messages.
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
{
if ($errors[$i] instanceof Exception)
{
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
}
else
{
$app->enqueueMessage($errors[$i], 'warning');
}
}
// Save the data in the session.
$app->setUserState('com_menus.edit.item.data', $data);
// Redirect back to the edit screen.
$editUrl = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId);
$this->setRedirect(JRoute::_($editUrl, false));
return false;
}
// Attempt to save the data.
if (!$model->save($data))
{
// Save the data in the session.
$app->setUserState('com_menus.edit.item.data', $data);
// Redirect back to the edit screen.
$editUrl = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId);
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error');
$this->setRedirect(JRoute::_($editUrl, false));
return false;
}
// Save succeeded, check-in the row.
if ($model->checkin($data['id']) === false)
{
// Check-in failed, go back to the row and display a notice.
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'warning');
$redirectUrl = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId);
$this->setRedirect(JRoute::_($redirectUrl, false));
return false;
}
$this->setMessage(JText::_('COM_MENUS_SAVE_SUCCESS'));
// Redirect the user and adjust session state based on the chosen task.
switch ($task)
{
case 'apply':
// Set the row data in the session.
$recordId = $model->getState($this->context . '.id');
$this->holdEditId($context, $recordId);
$app->setUserState('com_menus.edit.item.data', null);
$app->setUserState('com_menus.edit.item.type', null);
$app->setUserState('com_menus.edit.item.link', null);
// Redirect back to the edit screen.
$editUrl = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId);
$this->setRedirect(JRoute::_($editUrl, false));
break;
case 'save2new':
// Clear the row id and data in the session.
$this->releaseEditId($context, $recordId);
$app->setUserState('com_menus.edit.item.data', null);
$app->setUserState('com_menus.edit.item.type', null);
$app->setUserState('com_menus.edit.item.link', null);
// Redirect back to the edit screen.
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend(), false));
break;
default:
// Clear the row id and data in the session.
$this->releaseEditId($context, $recordId);
$app->setUserState('com_menus.edit.item.data', null);
$app->setUserState('com_menus.edit.item.type', null);
$app->setUserState('com_menus.edit.item.link', null);
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend()
. '&menutype=' . $app->getUserState('com_menus.items.menutype'), false
)
);
break;
}
return true;
}
/**
* Sets the type of the menu item currently being edited.
*
* @return void
*
* @since 1.6
*/
public function setType()
{
$this->checkToken();
$app = JFactory::getApplication();
// Get the posted values from the request.
$data = $this->input->post->get('jform', array(), 'array');
// Get the type.
$type = $data['type'];
$type = json_decode(base64_decode($type));
$title = isset($type->title) ? $type->title : null;
$recordId = isset($type->id) ? $type->id : 0;
$specialTypes = array('alias', 'separator', 'url', 'heading', 'container');
if (!in_array($title, $specialTypes))
{
$title = 'component';
}
else
{
// Set correct component id to ensure proper 404 messages with system links
$data['component_id'] = 0;
}
$app->setUserState('com_menus.edit.item.type', $title);
if ($title == 'component')
{
if (isset($type->request))
{
// Clean component name
$type->request->option = JFilterInput::getInstance()->clean($type->request->option, 'CMD');
$component = JComponentHelper::getComponent($type->request->option);
$data['component_id'] = $component->id;
$app->setUserState('com_menus.edit.item.link', 'index.php?' . JUri::buildQuery((array) $type->request));
}
}
// If the type is alias you just need the item id from the menu item referenced.
elseif ($title == 'alias')
{
$app->setUserState('com_menus.edit.item.link', 'index.php?Itemid=');
}
unset($data['request']);
$data['type'] = $title;
if ($this->input->get('fieldtype') == 'type')
{
$data['link'] = $app->getUserState('com_menus.edit.item.link');
}
// Save the data in the session.
$app->setUserState('com_menus.edit.item.data', $data);
$this->type = $type;
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false));
}
/**
* Gets the parent items of the menu location currently.
*
* @return void
*
* @since 3.2
*/
public function getParentItem()
{
$app = JFactory::getApplication();
$results = array();
$menutype = $this->input->get->get('menutype');
if ($menutype)
{
$model = $this->getModel('Items', '', array());
$model->getState();
$model->setState('filter.menutype', $menutype);
$model->setState('list.select', 'a.id, a.title, a.level');
$model->setState('list.start', '0');
$model->setState('list.limit', '0');
/** @var MenusModelItems $model */
$results = $model->getItems();
// Pad the option text with spaces using depth level as a multiplier.
for ($i = 0, $n = count($results); $i < $n; $i++)
{
$results[$i]->title = str_repeat(' - ', $results[$i]->level) . $results[$i]->title;
}
}
// Output a JSON object
echo json_encode($results);
$app->close();
}
}
PK V^$];�E� � controller.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Base controller class for Menu Manager.
*
* @since 1.6
*/
class MenusController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array|boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
// Check custom administrator menu modules
if (JModuleHelper::isAdminMultilang())
{
$languages = JLanguageHelper::getInstalledLanguages(1, true);
$langCodes = array();
foreach ($languages as $language)
{
if (isset($language->metadata['nativeName']))
{
$languageName = $language->metadata['nativeName'];
}
else
{
$languageName = $language->metadata['name'];
}
$langCodes[$language->metadata['tag']] = $languageName;
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->qn('m.language'))
->from($db->qn('#__modules', 'm'))
->where($db->qn('m.module') . ' = ' . $db->quote('mod_menu'))
->where($db->qn('m.published') . ' = 1')
->where($db->qn('m.client_id') . ' = 1')
->group($db->qn('m.language'));
$mLanguages = $db->setQuery($query)->loadColumn();
// Check if we have a mod_menu module set to All languages or a mod_menu module for each admin language.
if (!in_array('*', $mLanguages) && count($langMissing = array_diff(array_keys($langCodes), $mLanguages)))
{
$app = JFactory::getApplication();
$langMissing = array_intersect_key($langCodes, array_flip($langMissing));
$app->enqueueMessage(JText::sprintf('JMENU_MULTILANG_WARNING_MISSING_MODULES', implode(', ', $langMissing)), 'warning');
}
}
return parent::display();
}
}
PK V^$]�z' '
config.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="page-options"
label="COM_MENUS_PAGE_OPTIONS_LABEL"
>
<field
name="page_title"
type="text"
label="COM_MENUS_ITEM_FIELD_PAGE_TITLE_LABEL"
description="COM_MENUS_ITEM_FIELD_PAGE_TITLE_DESC"
default=""
/>
<field
name="show_page_heading"
type="radio"
label="COM_MENUS_ITEM_FIELD_SHOW_PAGE_HEADING_LABEL"
description="COM_MENUS_ITEM_FIELD_SHOW_PAGE_HEADING_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="page_heading"
type="text"
label="COM_MENUS_ITEM_FIELD_PAGE_HEADING_LABEL"
description="COM_MENUS_ITEM_FIELD_PAGE_HEADING_DESC"
default=""
showon="show_page_heading:1"
/>
<field
name="pageclass_sfx"
type="text"
label="COM_MENUS_ITEM_FIELD_PAGE_CLASS_LABEL"
description="COM_MENUS_ITEM_FIELD_PAGE_CLASS_DESC"
default=""
/>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
filter="rules"
validate="rules"
component="com_menus"
section="component"
/>
</fieldset>
</config>
PK V^$]�Yײ� � menus.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1" method="upgrade">
<name>com_menus</name>
<author>Joomla! Project</author>
<creationDate>April 2006</creationDate>
<copyright>(C) 2006 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>COM_MENUS_XML_DESCRIPTION</description>
<administration>
<files folder="admin">
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>menus.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
<folder>presets</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_menus.ini</language>
<language tag="en-GB">language/en-GB.com_menus.sys.ini</language>
</languages>
</administration>
</extension>
PK V^$]ż�1 1 menus.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if (!JFactory::getUser()->authorise('core.manage', 'com_menus'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
$controller = JControllerLegacy::getInstance('Menus');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
PK V^$]4P��H H
access.xmlnu &1i� <?xml version="1.0" encoding="utf-8" ?>
<access component="com_menus">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.options" title="JACTION_OPTIONS" description="JACTION_OPTIONS_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
</section>
<section name="menu">
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
</section>
</access>
PK V^$]��ǹ � helpers/associations.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Association\AssociationExtensionHelper;
/**
* Menu associations helper.
*
* @since 3.7.0
*/
class MenusAssociationsHelper extends AssociationExtensionHelper
{
/**
* The extension name
*
* @var array $extension
*
* @since 3.7.0
*/
protected $extension = 'com_menus';
/**
* Array of item types
*
* @var array $itemTypes
*
* @since 3.7.0
*/
protected $itemTypes = array('item');
/**
* Has the extension association support
*
* @var boolean $associationsSupport
*
* @since 3.7.0
*/
protected $associationsSupport = true;
/**
* Get the associated items for an item
*
* @param string $typeName The item type
* @param int $id The id of item for which we need the associated items
*
* @return array
*
* @since 3.7.0
*/
public function getAssociations($typeName, $id)
{
$type = $this->getType($typeName);
$context = $this->extension . '.item';
// Get the associations.
$associations = JLanguageAssociations::getAssociations(
$this->extension,
$type['tables']['a'],
$context,
$id,
'id',
'alias',
''
);
return $associations;
}
/**
* Get item information
*
* @param string $typeName The item type
* @param int $id The id of item for which we need the associated items
*
* @return JTable|null
*
* @since 3.7.0
*/
public function getItem($typeName, $id)
{
if (empty($id))
{
return null;
}
$table = null;
switch ($typeName)
{
case 'item':
$table = JTable::getInstance('menu');
break;
}
if (is_null($table))
{
return null;
}
$table->load($id);
return $table;
}
/**
* Get information about the type
*
* @param string $typeName The item type
*
* @return array Array of item types
*
* @since 3.7.0
*/
public function getType($typeName = '')
{
$fields = $this->getFieldsTemplate();
$tables = array();
$joins = array();
$support = $this->getSupportTemplate();
$title = '';
if (in_array($typeName, $this->itemTypes))
{
switch ($typeName)
{
case 'item':
$fields['ordering'] = 'a.lft';
$fields['level'] = 'a.level';
$fields['catid'] = '';
$fields['state'] = 'a.published';
$fields['created_user_id'] = '';
$fields['menutype'] = 'a.menutype';
$support['state'] = true;
$support['acl'] = true;
$support['checkout'] = true;
$support['level'] = true;
$tables = array(
'a' => '#__menu'
);
$title = 'menu';
break;
}
}
return array(
'fields' => $fields,
'support' => $support,
'tables' => $tables,
'joins' => $joins,
'title' => $title
);
}
}
PK V^$]�����6 �6 helpers/menus.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Joomla\CMS\Menu\MenuHelper;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
defined('_JEXEC') or die;
/**
* Menus component helper.
*
* @since 1.6
*/
class MenusHelper
{
/**
* Defines the valid request variables for the reverse lookup.
*
* @since 1.6
*/
protected static $_filter = array('option', 'view', 'layout');
/**
* Configure the Linkbar.
*
* @param string $vName The name of the active view.
*
* @return void
*
* @since 1.6
*/
public static function addSubmenu($vName)
{
JHtmlSidebar::addEntry(
JText::_('COM_MENUS_SUBMENU_MENUS'),
'index.php?option=com_menus&view=menus',
$vName == 'menus'
);
JHtmlSidebar::addEntry(
JText::_('COM_MENUS_SUBMENU_ITEMS'),
'index.php?option=com_menus&view=items',
$vName == 'items'
);
}
/**
* Gets a list of the actions that can be performed.
*
* @param integer $parentId The menu ID.
*
* @return JObject
*
* @since 1.6
* @deprecated 3.2 Use JHelperContent::getActions() instead
*/
public static function getActions($parentId = 0)
{
// Log usage of deprecated function
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperContent::getActions() with new arguments order instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
// Get list of actions
return JHelperContent::getActions('com_menus');
}
/**
* Gets a standard form of a link for lookups.
*
* @param mixed $request A link string or array of request variables.
*
* @return mixed A link in standard option-view-layout form, or false if the supplied response is invalid.
*
* @since 1.6
*/
public static function getLinkKey($request)
{
if (empty($request))
{
return false;
}
// Check if the link is in the form of index.php?...
if (is_string($request))
{
$args = array();
if (strpos($request, 'index.php') === 0)
{
parse_str(parse_url(htmlspecialchars_decode($request), PHP_URL_QUERY), $args);
}
else
{
parse_str($request, $args);
}
$request = $args;
}
// Only take the option, view and layout parts.
foreach ($request as $name => $value)
{
if ((!in_array($name, self::$_filter)) && (!($name == 'task' && !array_key_exists('view', $request))))
{
// Remove the variables we want to ignore.
unset($request[$name]);
}
}
ksort($request);
return 'index.php?' . http_build_query($request, '', '&');
}
/**
* Get the menu list for create a menu module
*
* @param int $clientId Optional client id - viz 0 = site, 1 = administrator, can be NULL for all
*
* @return array The menu array list
*
* @since 1.6
*/
public static function getMenuTypes($clientId = 0)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.menutype')
->from('#__menu_types AS a');
if (isset($clientId))
{
$query->where('a.client_id = ' . (int) $clientId);
}
$db->setQuery($query);
return $db->loadColumn();
}
/**
* Get a list of menu links for one or all menus.
*
* @param string $menuType An option menu to filter the list on, otherwise all menu with given client id links
* are returned as a grouped array.
* @param integer $parentId An optional parent ID to pivot results around.
* @param integer $mode An optional mode. If parent ID is set and mode=2, the parent and children are excluded from the list.
* @param array $published An optional array of states
* @param array $languages Optional array of specify which languages we want to filter
* @param int $clientId Optional client id - viz 0 = site, 1 = administrator, can be NULL for all (used only if menutype not givein)
*
* @return array
*
* @since 1.6
*/
public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0, $published = array(), $languages = array(), $clientId = 0)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT(a.id) AS value,
a.title AS text,
a.alias,
a.level,
a.menutype,
a.client_id,
a.type,
a.published,
a.template_style_id,
a.checked_out,
a.language,
a.lft'
)
->from('#__menu AS a');
$query->select('e.name as componentname, e.element')
->join('left', '#__extensions e ON e.extension_id = a.component_id');
if (JLanguageMultilang::isEnabled())
{
$query->select('l.title AS language_title, l.image AS language_image, l.sef AS language_sef')
->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
}
// Filter by the type if given, this is more specific than client id
if ($menuType)
{
$query->where('(a.menutype = ' . $db->quote($menuType) . ' OR a.parent_id = 0)');
}
elseif (isset($clientId))
{
$query->where('a.client_id = ' . (int) $clientId);
}
// Prevent the parent and children from showing if requested.
if ($parentId && $mode == 2)
{
$query->join('LEFT', '#__menu AS p ON p.id = ' . (int) $parentId)
->where('(a.lft <= p.lft OR a.rgt >= p.rgt)');
}
if (!empty($languages))
{
if (is_array($languages))
{
$languages = '(' . implode(',', array_map(array($db, 'quote'), $languages)) . ')';
}
$query->where('a.language IN ' . $languages);
}
if (!empty($published))
{
if (is_array($published))
{
$published = '(' . implode(',', $published) . ')';
}
$query->where('a.published IN ' . $published);
}
$query->where('a.published != -2');
$query->order('a.lft ASC');
// Get the options.
$db->setQuery($query);
try
{
$links = $db->loadObjectList();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
return false;
}
if (empty($menuType))
{
// If the menutype is empty, group the items by menutype.
$query->clear()
->select('*')
->from('#__menu_types')
->where('menutype <> ' . $db->quote(''))
->order('title, menutype');
if (isset($clientId))
{
$query->where('client_id = ' . (int) $clientId);
}
$db->setQuery($query);
try
{
$menuTypes = $db->loadObjectList();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
return false;
}
// Create a reverse lookup and aggregate the links.
$rlu = array();
foreach ($menuTypes as &$type)
{
$rlu[$type->menutype] = & $type;
$type->links = array();
}
// Loop through the list of menu links.
foreach ($links as &$link)
{
if (isset($rlu[$link->menutype]))
{
$rlu[$link->menutype]->links[] = & $link;
// Cleanup garbage.
unset($link->menutype);
}
}
return $menuTypes;
}
else
{
return $links;
}
}
/**
* Get the associations
*
* @param integer $pk Menu item id
*
* @return array
*
* @since 3.0
*/
public static function getAssociations($pk)
{
$langAssociations = JLanguageAssociations::getAssociations('com_menus', '#__menu', 'com_menus.item', $pk, 'id', '', '');
$associations = array();
foreach ($langAssociations as $langAssociation)
{
$associations[$langAssociation->language] = $langAssociation->id;
}
return $associations;
}
/**
* Load the menu items from database for the given menutype
*
* @param string $menutype The selected menu type
* @param boolean $enabledOnly Whether to load only enabled/published menu items.
* @param int[] $exclude The menu items to exclude from the list
*
* @return array
*
* @since 3.8.0
*
* @deprecated 4.0 This method will return a node object to iterate over in 4.0.
*/
public static function getMenuItems($menutype, $enabledOnly = false, $exclude = array())
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Prepare the query.
$query->select('m.*')
->from('#__menu AS m')
->where('m.menutype = ' . $db->q($menutype))
->where('m.client_id = 1')
->where('m.id > 1');
if ($enabledOnly)
{
$query->where('m.published = 1');
}
// Filter on the enabled states.
$query->select('e.element')
->join('LEFT', '#__extensions AS e ON m.component_id = e.extension_id')
->where('(e.enabled = 1 OR e.enabled IS NULL)');
if (count($exclude))
{
$exId = array_filter($exclude, 'is_numeric');
$exEl = array_filter($exclude, 'is_string');
if ($exId)
{
$query->where('m.id NOT IN (' . implode(', ', array_map('intval', $exId)) . ')');
$query->where('m.parent_id NOT IN (' . implode(', ', array_map('intval', $exId)) . ')');
}
if ($exEl)
{
$query->where('e.element NOT IN (' . implode(', ', $db->quote($exEl)) . ')');
}
}
// Order by lft.
$query->order('m.lft');
$db->setQuery($query);
try
{
$menuItems = $db->loadObjectList();
foreach ($menuItems as &$menuitem)
{
$menuitem->params = new Registry($menuitem->params);
}
}
catch (RuntimeException $e)
{
$menuItems = array();
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
}
return $menuItems;
}
/**
* Method to install a preset menu into database and link them to the given menutype
*
* @param string $preset The preset name
* @param string $menutype The target menutype
*
* @return void
*
* @throws Exception
*
* @since 3.8.0
*/
public static function installPreset($preset, $menutype)
{
$items = MenuHelper::loadPreset($preset, false);
if (count($items) == 0)
{
throw new Exception(JText::_('COM_MENUS_PRESET_LOAD_FAILED'));
}
static::installPresetItems($items, $menutype, 1);
}
/**
* Method to install a preset menu item into database and link it to the given menutype
*
* @param stdClass[] $items The single menuitem instance with a list of its descendants
* @param string $menutype The target menutype
* @param int $parent The parent id or object
*
* @return void
*
* @throws Exception
*
* @since 3.8.0
*/
protected static function installPresetItems(&$items, $menutype, $parent = 1)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
static $components = array();
if (!$components)
{
$query->select('extension_id, element')->from('#__extensions')->where('type = ' . $db->q('component'));
$components = $db->setQuery($query)->loadObjectList();
$components = ArrayHelper::getColumn((array) $components, 'element', 'extension_id');
}
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onPreprocessMenuItems', array('com_menus.administrator.import', &$items, null, true));
foreach ($items as &$item)
{
/** @var JTableMenu $table */
$table = JTable::getInstance('Menu');
$item->alias = $menutype . '-' . $item->title;
if ($item->type == 'separator')
{
// Do not reuse a separator
$item->title = $item->title ?: '-';
$item->alias = microtime(true);
}
elseif ($item->type == 'heading' || $item->type == 'container')
{
// Try to match an existing record to have minimum collision for a heading
$keys = array(
'menutype' => $menutype,
'type' => $item->type,
'title' => $item->title,
'parent_id' => $parent,
'client_id' => 1,
);
$table->load($keys);
}
elseif ($item->type == 'url' || $item->type == 'component')
{
if (substr($item->link, 0, 8) === 'special:')
{
$special = substr($item->link, 8);
if ($special === 'language-forum')
{
$item->link = 'index.php?option=com_admin&view=help&layout=langforum';
}
elseif ($special === 'custom-forum')
{
$item->link = '';
}
}
// Try to match an existing record to have minimum collision for a link
$keys = array(
'menutype' => $menutype,
'type' => $item->type,
'link' => $item->link,
'parent_id' => $parent,
'client_id' => 1,
);
$table->load($keys);
}
// Translate "hideitems" param value from "element" into "menu-item-id"
if ($item->type == 'container' && count($hideitems = (array) $item->params->get('hideitems')))
{
foreach ($hideitems as &$hel)
{
if (!is_numeric($hel))
{
$hel = array_search($hel, $components);
}
}
$query->clear()->select('id')->from('#__menu')->where('component_id IN (' . implode(', ', $hideitems) . ')');
$hideitems = $db->setQuery($query)->loadColumn();
$item->params->set('hideitems', $hideitems);
}
$record = array(
'menutype' => $menutype,
'title' => $item->title,
'alias' => $item->alias,
'type' => $item->type,
'link' => $item->link,
'browserNav' => $item->browserNav ? 1 : 0,
'img' => $item->class,
'access' => $item->access,
'component_id' => array_search($item->element, $components),
'parent_id' => $parent,
'client_id' => 1,
'published' => 1,
'language' => '*',
'home' => 0,
'params' => (string) $item->params,
);
if (!$table->bind($record))
{
throw new Exception('Bind failed: ' . $table->getError());
}
$table->setLocation($parent, 'last-child');
if (!$table->check())
{
throw new Exception('Check failed: ' . $table->getError());
}
if (!$table->store())
{
throw new Exception('Saved failed: ' . $table->getError());
}
$item->id = $table->get('id');
if (!empty($item->submenu))
{
static::installPresetItems($item->submenu, $menutype, $item->id);
}
}
}
}
PK V^$]l22� � helpers/html/menus.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
/**
* Menus HTML helper class.
*
* @package Joomla.Administrator
* @subpackage com_menus
* @since 1.7
*/
abstract class MenusHtmlMenus
{
/**
* Generate the markup to display the item associations
*
* @param int $itemid The menu item id
*
* @return string
*
* @since 3.0
*
* @throws Exception If there is an error on the query
*/
public static function association($itemid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = MenusHelper::getAssociations($itemid))
{
// Get the associated menu items
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('m.id, m.title')
->select('l.sef as lang_sef, l.lang_code')
->select('mt.title as menu_title')
->from('#__menu as m')
->join('LEFT', '#__menu_types as mt ON mt.menutype=m.menutype')
->where('m.id IN (' . implode(',', array_values($associations)) . ')')
->where('m.id != ' . $itemid)
->join('LEFT', '#__languages as l ON m.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (runtimeException $e)
{
throw new Exception($e->getMessage(), 500);
}
// Construct html
if ($items)
{
foreach ($items as &$item)
{
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_menus&task=item.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '<br />' . JText::sprintf('COM_MENUS_MENU_SPRINTF', $item->menu_title);
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}
}
JHtml::_('bootstrap.popover');
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
/**
* Returns a published state on a grid
*
* @param integer $value The state value.
* @param integer $i The row index
* @param boolean $enabled An optional setting for access control on the action.
* @param string $checkbox An optional prefix for checkboxes.
*
* @return string The Html code
*
* @see JHtmlJGrid::state
*
* @since 1.7.1
*/
public static function state($value, $i, $enabled = true, $checkbox = 'cb')
{
$states = array(
9 => array(
'unpublish',
'',
'COM_MENUS_HTML_UNPUBLISH_HEADING',
'',
true,
'publish',
'publish',
),
8 => array(
'publish',
'',
'COM_MENUS_HTML_PUBLISH_HEADING',
'',
true,
'unpublish',
'unpublish',
),
7 => array(
'unpublish',
'',
'COM_MENUS_HTML_UNPUBLISH_SEPARATOR',
'',
true,
'publish',
'publish',
),
6 => array(
'publish',
'',
'COM_MENUS_HTML_PUBLISH_SEPARATOR',
'',
true,
'unpublish',
'unpublish',
),
5 => array(
'unpublish',
'',
'COM_MENUS_HTML_UNPUBLISH_ALIAS',
'',
true,
'publish',
'publish',
),
4 => array(
'publish',
'',
'COM_MENUS_HTML_PUBLISH_ALIAS',
'',
true,
'unpublish',
'unpublish',
),
3 => array(
'unpublish',
'',
'COM_MENUS_HTML_UNPUBLISH_URL',
'',
true,
'publish',
'publish',
),
2 => array(
'publish',
'',
'COM_MENUS_HTML_PUBLISH_URL',
'',
true,
'unpublish',
'unpublish',
),
1 => array(
'unpublish',
'COM_MENUS_EXTENSION_PUBLISHED_ENABLED',
'COM_MENUS_HTML_UNPUBLISH_ENABLED',
'COM_MENUS_EXTENSION_PUBLISHED_ENABLED',
true,
'publish',
'publish',
),
0 => array(
'publish',
'COM_MENUS_EXTENSION_UNPUBLISHED_ENABLED',
'COM_MENUS_HTML_PUBLISH_ENABLED',
'COM_MENUS_EXTENSION_UNPUBLISHED_ENABLED',
true,
'unpublish',
'unpublish',
),
-1 => array(
'unpublish',
'COM_MENUS_EXTENSION_PUBLISHED_DISABLED',
'COM_MENUS_HTML_UNPUBLISH_DISABLED',
'COM_MENUS_EXTENSION_PUBLISHED_DISABLED',
true,
'warning',
'warning',
),
-2 => array(
'publish',
'COM_MENUS_EXTENSION_UNPUBLISHED_DISABLED',
'COM_MENUS_HTML_PUBLISH_DISABLED',
'COM_MENUS_EXTENSION_UNPUBLISHED_DISABLED',
true,
'trash',
'trash',
),
-3 => array(
'publish',
'',
'COM_MENUS_HTML_PUBLISH',
'',
true,
'trash',
'trash',
),
);
return JHtml::_('jgrid.state', $states, $value, $i, 'items.', $enabled, true, $checkbox);
}
/**
* Returns a visibility state on a grid
*
* @param integer $params Params of item.
*
* @return string The Html code
*
* @since 3.7.0
*/
public static function visibility($params)
{
$registry = new Registry;
try
{
$registry->loadString($params);
}
catch (Exception $e)
{
// Invalid JSON
}
$show_menu = $registry->get('menu_show');
return ($show_menu === 0) ? '<span class="label">' . JText::_('COM_MENUS_LABEL_HIDDEN') . '</span>' : '';
}
}
PK V^$]�G�c� � views/menu/tmpl/edit.xmlnu &1i� <?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_MENUS_MENU_VIEW_EDIT_TITLE">
<message>
<![CDATA[COM_MENUS_MENU_VIEW_EDIT_DESC]]>
</message>
</layout>
</metadata>
PK V^$]fp��r r views/menu/tmpl/edit.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.core');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
JText::script('ERROR');
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
var form = document.getElementById('item-form');
if (task == 'menu.cancel' || document.formvalidator.isValid(form))
{
Joomla.submitform(task, form);
}
};
");
?>
<form action="<?php echo JRoute::_('index.php?option=com_menus&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form">
<?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>
<div class="form-horizontal">
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', JText::_('COM_MENUS_MENU_DETAILS')); ?>
<?php
echo $this->form->renderField('menutype');
echo $this->form->renderField('description');
echo $this->form->renderField('client_id');
echo $this->form->renderField('preset');
?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php if ($this->canDo->get('core.admin')) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'permissions', JText::_('COM_MENUS_FIELDSET_RULES')); ?>
<?php echo $this->form->getInput('rules'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
PK V^$]�� w w views/menu/view.html.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* The HTML Menus Menu Item View.
*
* @since 1.6
*/
class MenusViewMenu extends JViewLegacy
{
/**
* @var JForm
*/
protected $form;
/**
* @var mixed
*/
protected $item;
/**
* @var JObject
*/
protected $state;
/**
*
* @var JObject
*/
protected $canDo;
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 1.6
*/
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->canDo = JHelperContent::getActions('com_menus', 'menu', $this->item->id);
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
parent::display($tpl);
$this->addToolbar();
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
$input = JFactory::getApplication()->input;
$input->set('hidemainmenu', true);
$isNew = ($this->item->id == 0);
JToolbarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'list menu');
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
if ($isNew && $this->canDo->get('core.create'))
{
if ($this->canDo->get('core.edit'))
{
JToolbarHelper::apply('menu.apply');
}
JToolbarHelper::save('menu.save');
}
// If user can edit, can save the item.
if (!$isNew && $this->canDo->get('core.edit'))
{
JToolbarHelper::apply('menu.apply');
JToolbarHelper::save('menu.save');
}
// If the user can create new items, allow them to see Save & New
if ($this->canDo->get('core.create'))
{
JToolbarHelper::save2new('menu.save2new');
}
if ($isNew)
{
JToolbarHelper::cancel('menu.cancel');
}
else
{
JToolbarHelper::cancel('menu.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_MENUS_MENU_MANAGER_EDIT');
}
}
PK V^$]8�
�
views/menu/view.xml.phpnu &1i� <?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Menu\MenuHelper;
/**
* The HTML Menus Menu Item View.
*
* @since 3.8.0
*/
class MenusViewMenu extends JViewLegacy
{
/**
* @var stdClass[]
*
* @since 3.8.0
*/
protected $items;
/**
* @var JObject
*
* @since 3.8.0
*/
protected $state;
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 3.8.0
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$menutype = $app->input->getCmd('menutype');
if ($menutype)
{
$items = MenusHelper::getMenuItems($menutype, true);
}
if (empty($items))
{
JLog::add(JText::_('COM_MENUS_SELECT_MENU_FIRST_EXPORT'), JLog::WARNING, 'jerror');
$app->redirect(JRoute::_('index.php?option=com_menus&view=menus', false));
return;
}
$this->items = MenuHelper::createLevels($items);
$xml = new SimpleXMLElement('<menu ' .
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' .
'xmlns="urn:joomla.org" xsi:schemaLocation="urn:joomla.org menu.xsd"' .
'></menu>'
);
foreach ($this->items as $item)
{
$this->addXmlChild($xml, $item);
}
if (headers_sent($file, $line))
{
JLog::add("Headers already sent at $file:$line.", JLog::ERROR, 'jerror');
return;
}
header('content-type: application/xml');
header('content-disposition: attachment; filename="' . $menutype . '.xml"');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header('Pragma: private');
$dom = new DOMDocument;
$dom->preserveWhiteSpace = true;
$dom->formatOutput = true;
$dom->loadXML($xml->asXML());
echo $dom->saveXML();
$app->close();
}
/**
* Add a child node to the xml
*
* @param SimpleXMLElement $xml The current XML node which would become the parent to the new node
* @param stdClass $item The menuitem object to create the child XML node from
*
* @return void
*
* @since 3.8.0
*/
protected function addXmlChild($xml, $item)
{
$node = $xml->addChild('menuitem');
$node['type'] = $item->type;
if ($item->title)
{
$node['title'] = $item->title;
}
if ($item->link)
{
$node['link'] = $item->link;
}
if ($item->element)
{
$node['element'] = $item->element;
}
if ($item->class)
{
$node['class'] = $item->class;
}
if ($item->access)
{
$node['access'] = $item->access;
}
if ($item->browserNav)
{
$node['target'] = '_blank';
}
if (count($item->params))
{
$hideitems = $item->params->get('hideitems');
if (count($hideitems))
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('e.element')->from('#__extensions e')
->join('inner', '#__menu m ON m.component_id = e.extension_id')
->where('m.id IN (' . implode(', ', $db->quote($hideitems)) . ')');
$hideitems = $db->setQuery($query)->loadColumn();
$item->params->set('hideitems', $hideitems);
}
$node->addChild('params', (string) $item->params);
}
foreach ($item->submenu as $sub)
{
$this->addXmlChild($node, $sub);
}
}
}
PK V^$]�%�0 0 '