first commit
This commit is contained in:
177
administrator/components/com_menus/tmpl/item/edit.php
Normal file
177
administrator/components/com_menus/tmpl/item/edit.php
Normal file
@ -0,0 +1,177 @@
|
||||
<?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\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Associations;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
$this->useCoreUI = true;
|
||||
|
||||
Text::script('ERROR');
|
||||
Text::script('JGLOBAL_VALIDATION_FORM_FAILED');
|
||||
Text::script('JGLOBAL_ROOT_PARENT');
|
||||
|
||||
$this->document->addScriptOptions('menu-item', ['itemId' => (int) $this->item->id]);
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('keepalive')
|
||||
->useScript('form.validate')
|
||||
->useScript('com_menus.admin-item-edit');
|
||||
|
||||
$assoc = Associations::isEnabled();
|
||||
$input = Factory::getApplication()->getInput();
|
||||
|
||||
// In case of modal
|
||||
$isModal = $input->get('layout') === 'modal';
|
||||
$layout = $isModal ? 'modal' : 'edit';
|
||||
$tmpl = $input->get('tmpl');
|
||||
$tmpl = $tmpl ? '&tmpl=' . $tmpl : '';
|
||||
$clientId = $this->state->get('item.client_id', 0);
|
||||
$lang = $this->getLanguage()->getTag();
|
||||
|
||||
// Load mod_menu.ini file when client is administrator
|
||||
if ($clientId === 1) {
|
||||
$this->getLanguage()->load('mod_menu', JPATH_ADMINISTRATOR);
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo Route::_('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" aria-label="<?php echo Text::_('COM_MENUS_ITEM_FORM_' . ((int) $this->item->id === 0 ? 'NEW' : 'EDIT'), true); ?>" class="form-validate">
|
||||
|
||||
<?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>
|
||||
|
||||
<?php // Add the translation of the menu item title when client is administrator ?>
|
||||
<?php if ($clientId === 1 && $this->item->id != 0) : ?>
|
||||
<div class="row title-alias form-vertical mb-3">
|
||||
<div class="col-12">
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<label for="menus_title_translation"><?php echo Text::sprintf('COM_MENUS_TITLE_TRANSLATION', $lang); ?></label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<input id="menus_title_translation" class="form-control" value="<?php echo Text::_($this->item->title); ?>" readonly="readonly" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="main-card">
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'details', 'recall' => true, 'breakpoint' => 768]); ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'details', Text::_('COM_MENUS_ITEM_DETAILS')); ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<?php
|
||||
echo $this->form->renderField('type');
|
||||
|
||||
if ($this->item->type == 'alias') {
|
||||
echo $this->form->renderField('aliasoptions', 'params');
|
||||
}
|
||||
|
||||
if ($this->item->type == 'separator') {
|
||||
echo $this->form->renderField('text_separator', 'params');
|
||||
}
|
||||
|
||||
echo $this->form->renderFieldset('request');
|
||||
|
||||
if ($this->item->type == 'url') {
|
||||
$this->form->setFieldAttribute('link', 'readonly', 'false');
|
||||
$this->form->setFieldAttribute('link', 'required', 'true');
|
||||
}
|
||||
|
||||
echo $this->form->renderField('link');
|
||||
|
||||
if ($this->item->type == 'alias') {
|
||||
echo $this->form->renderField('alias_redirect', 'params');
|
||||
}
|
||||
|
||||
echo $this->form->renderField('browserNav');
|
||||
echo $this->form->renderField('template_style_id');
|
||||
|
||||
if (!$isModal && $this->item->type == 'container') {
|
||||
echo $this->loadTemplate('container');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<?php
|
||||
// Set main fields.
|
||||
$this->fields = [
|
||||
'id',
|
||||
'client_id',
|
||||
'menutype',
|
||||
'parent_id',
|
||||
'menuordering',
|
||||
'published',
|
||||
'home',
|
||||
'publish_up',
|
||||
'publish_down',
|
||||
'access',
|
||||
'language',
|
||||
'note',
|
||||
];
|
||||
|
||||
if ($this->item->type != 'component') {
|
||||
$this->fields = array_diff($this->fields, ['home']);
|
||||
$this->form->setFieldAttribute('publish_up', 'showon', '');
|
||||
$this->form->setFieldAttribute('publish_down', 'showon', '');
|
||||
}
|
||||
|
||||
echo LayoutHelper::render('joomla.edit.global', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
|
||||
<?php
|
||||
$this->fieldsets = [];
|
||||
$this->ignore_fieldsets = ['aliasoptions', 'request', 'item_associations'];
|
||||
echo LayoutHelper::render('joomla.edit.params', $this);
|
||||
?>
|
||||
|
||||
<?php if (!$isModal && $assoc && $this->state->get('item.client_id') != 1) : ?>
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'associations', Text::_('JGLOBAL_FIELDSET_ASSOCIATIONS')); ?>
|
||||
<fieldset id="fieldset-associations" class="options-form">
|
||||
<legend><?php echo Text::_('JGLOBAL_FIELDSET_ASSOCIATIONS'); ?></legend>
|
||||
<div>
|
||||
<?php echo LayoutHelper::render('joomla.edit.associations', $this); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
<?php elseif ($isModal && $assoc) : ?>
|
||||
<div class="hidden"><?php echo LayoutHelper::render('joomla.edit.associations', $this); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($this->modules)) : ?>
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'modules', Text::_('COM_MENUS_ITEM_MODULE_ASSIGNMENT')); ?>
|
||||
<fieldset id="fieldset-modules" class="options-form">
|
||||
<legend><?php echo Text::_('COM_MENUS_ITEM_MODULE_ASSIGNMENT'); ?></legend>
|
||||
<div>
|
||||
<?php echo $this->loadTemplate('modules'); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="task" value="">
|
||||
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>">
|
||||
<input type="hidden" name="menutype" value="<?php echo $input->get('menutype', '', 'cmd'); ?>">
|
||||
<?php echo $this->form->getInput('component_id'); ?>
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
<input type="hidden" id="fieldtype" name="fieldtype" value="">
|
||||
</form>
|
||||
21
administrator/components/com_menus/tmpl/item/edit.xml
Normal file
21
administrator/components/com_menus/tmpl/item/edit.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_MENUS_ITEM_VIEW_EDIT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_MENUS_ITEM_VIEW_EDIT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
<fieldset name="request">
|
||||
<fields name="request">
|
||||
<field
|
||||
name="menutype"
|
||||
type="menu"
|
||||
label="COM_MENUS_ITEMS_CHOOSE_MENU_LABEL"
|
||||
description="COM_MENUS_ITEMS_CHOOSE_MENU_DESC"
|
||||
clientid=""
|
||||
>
|
||||
<option value="">COM_MENUS_SELECT_MENU</option>
|
||||
</field>
|
||||
</fields>
|
||||
</fieldset>
|
||||
</metadata>
|
||||
105
administrator/components/com_menus/tmpl/item/edit_container.php
Normal file
105
administrator/components/com_menus/tmpl/item/edit_container.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?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\Language\Text;
|
||||
use Joomla\Component\Menus\Administrator\Helper\MenusHelper;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// Initialise related data.
|
||||
$menuLinks = MenusHelper::getMenuLinks('main');
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('joomla.treeselectmenu')
|
||||
->useStyle('com_menus.admin-item-edit-container')
|
||||
->useScript('com_menus.admin-item-edit-container');
|
||||
|
||||
?>
|
||||
<div id="menuselect-group" class="control-group">
|
||||
<div class="control-label"><?php echo $this->form->getLabel('hideitems', 'params'); ?></div>
|
||||
|
||||
<div id="jform_params_hideitems" class="controls">
|
||||
<?php if (!empty($menuLinks)) : ?>
|
||||
<?php $id = 'jform_params_hideitems'; ?>
|
||||
|
||||
<div class="form-inline">
|
||||
<span class="small me-2"><?php echo Text::_('COM_MENUS_ACTION_EXPAND'); ?>:
|
||||
<a id="treeExpandAll" href="javascript://"><?php echo Text::_('JALL'); ?></a>,
|
||||
<a id="treeCollapseAll" href="javascript://"><?php echo Text::_('JNONE'); ?></a> |
|
||||
<?php echo Text::_('JSHOW'); ?>:
|
||||
<a id="treeUncheckAll" href="javascript://"><?php echo Text::_('JALL'); ?></a>,
|
||||
<a id="treeCheckAll" href="javascript://"><?php echo Text::_('JNONE'); ?></a>
|
||||
</span>
|
||||
<input type="text" id="treeselectfilter" name="treeselectfilter" class="form-control search-query"
|
||||
autocomplete="off" placeholder="<?php echo Text::_('JSEARCH_FILTER'); ?>"
|
||||
aria-invalid="false" aria-label="<?php echo Text::_('JSEARCH_FILTER'); ?>">
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="alert alert-info">
|
||||
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
|
||||
<?php echo Text::_('COM_MENUS_ITEM_FIELD_COMPONENTS_CONTAINER_HIDE_ITEMS_DESC'); ?>
|
||||
</div>
|
||||
<?php if (count($menuLinks)) : ?>
|
||||
<ul class="treeselect">
|
||||
<?php $prevlevel = 0; ?>
|
||||
<li>
|
||||
<?php
|
||||
$params = new Registry($this->item->params);
|
||||
$hiddenLinks = (array) $params->get('hideitems');
|
||||
|
||||
foreach ($menuLinks as $i => $link) : ?>
|
||||
<?php
|
||||
if ($extension = $link->element) :
|
||||
$lang->load("$extension.sys", JPATH_ADMINISTRATOR)
|
||||
|| $lang->load("$extension.sys", JPATH_ADMINISTRATOR . '/components/' . $extension);
|
||||
endif;
|
||||
|
||||
if ($prevlevel < $link->level) {
|
||||
echo '<ul class="treeselect-sub">';
|
||||
} elseif ($prevlevel > $link->level) {
|
||||
echo str_repeat('</li></ul>', $prevlevel - $link->level);
|
||||
} else {
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
$selected = in_array($link->value, $hiddenLinks) ? 1 : 0;
|
||||
?>
|
||||
<li>
|
||||
<div class="treeselect-item">
|
||||
<input type="checkbox" <?php echo $link->value > 1 ? ' name="jform[params][hideitems][]" ' : ''; ?>
|
||||
id="<?php echo $id . $link->value; ?>" value="<?php echo (int) $link->value; ?>" class="novalidate checkbox-toggle"
|
||||
<?php echo $selected ? ' checked="checked"' : ''; ?>>
|
||||
|
||||
<?php if ($link->value == 1) : ?>
|
||||
<label for="<?php echo $id . $link->value; ?>" class="btn btn-sm btn-info"><?php echo Text::_('JALL') ?></label>
|
||||
<?php else : ?>
|
||||
<label for="<?php echo $id . $link->value; ?>" class="btn btn-sm btn-danger btn-hide"><?php echo Text::_('JHIDE') ?></label>
|
||||
<label for="<?php echo $id . $link->value; ?>" class="btn btn-sm btn-success btn-show"><?php echo Text::_('JSHOW') ?></label>
|
||||
<label for="<?php echo $id . $link->value; ?>"><?php echo Text::_($link->text); ?></label>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
if (!isset($menuLinks[$i + 1])) {
|
||||
echo str_repeat('</li></ul>', $link->level);
|
||||
}
|
||||
$prevlevel = $link->level;
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<joomla-alert id="noresultsfound" type="warning" style="display:none"><?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?></joomla-alert>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
148
administrator/components/com_menus/tmpl/item/edit_modules.php
Normal file
148
administrator/components/com_menus/tmpl/item/edit_modules.php
Normal file
@ -0,0 +1,148 @@
|
||||
<?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\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
foreach ($this->levels as $key => $value) {
|
||||
$allLevels[$value->id] = $value->title;
|
||||
}
|
||||
|
||||
$this->document->addScriptOptions('menus-edit-modules', ['viewLevels' => $allLevels, 'itemId' => $this->item->id]);
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('com_menus.admin-item-edit-modules');
|
||||
|
||||
// Set up the bootstrap modal that will be used for all module editors
|
||||
echo HTMLHelper::_(
|
||||
'bootstrap.renderModal',
|
||||
'moduleEditModal',
|
||||
[
|
||||
'title' => Text::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
|
||||
'backdrop' => 'static',
|
||||
'keyboard' => false,
|
||||
'closeButton' => false,
|
||||
'bodyHeight' => '70',
|
||||
'modalWidth' => '80',
|
||||
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" data-bs-target="#closeBtn">'
|
||||
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
|
||||
. '<button type="button" class="btn btn-primary" data-bs-dismiss="modal" data-bs-target="#saveBtn">'
|
||||
. Text::_('JSAVE') . '</button>'
|
||||
. '<button type="button" class="btn btn-success" data-bs-target="#applyBtn">'
|
||||
. Text::_('JAPPLY') . '</button>',
|
||||
]
|
||||
);
|
||||
|
||||
?>
|
||||
<?php
|
||||
// Set main fields.
|
||||
$this->fields = ['toggle_modules_assigned', 'toggle_modules_published'];
|
||||
|
||||
echo LayoutHelper::render('joomla.menu.edit_modules', $this); ?>
|
||||
|
||||
<table class="table" id="modules_assigned">
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('COM_MENUS_MODULES_TABLE_CAPTION'); ?>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-40">
|
||||
<?php echo Text::_('COM_MENUS_HEADING_ASSIGN_MODULE'); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-15">
|
||||
<?php echo Text::_('COM_MENUS_HEADING_LEVELS'); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-15">
|
||||
<?php echo Text::_('COM_MENUS_HEADING_POSITION'); ?>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<?php echo Text::_('COM_MENUS_HEADING_DISPLAY'); ?>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<?php echo Text::_('COM_MENUS_HEADING_PUBLISHED_ITEMS'); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->modules as $i => &$module) : ?>
|
||||
<?php if (is_null($module->menuid)) : ?>
|
||||
<?php if (!$module->except || $module->menuid < 0) : ?>
|
||||
<?php $no = 'no '; ?>
|
||||
<?php else : ?>
|
||||
<?php $no = ''; ?>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<?php $no = ''; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($module->published) : ?>
|
||||
<?php $status = ''; ?>
|
||||
<?php else : ?>
|
||||
<?php $status = 'unpublished '; ?>
|
||||
<?php endif; ?>
|
||||
<tr id="tr-<?php echo $module->id; ?>" class="<?php echo $no; ?><?php echo $status; ?>row<?php echo $i % 2; ?>">
|
||||
<th scope="row">
|
||||
<button type="button"
|
||||
data-bs-target="#moduleEditModal"
|
||||
class="btn btn-link module-edit-link"
|
||||
title="<?php echo Text::_('COM_MENUS_EDIT_MODULE_SETTINGS'); ?>"
|
||||
id="title-<?php echo $module->id; ?>"
|
||||
data-module-id="<?php echo $module->id; ?>">
|
||||
<?php echo $this->escape($module->title); ?></button>
|
||||
</th>
|
||||
<td id="access-<?php echo $module->id; ?>">
|
||||
<?php echo $this->escape($module->access_title); ?>
|
||||
</td>
|
||||
<td id="position-<?php echo $module->id; ?>">
|
||||
<?php echo $this->escape($module->position); ?>
|
||||
</td>
|
||||
<td id="menus-<?php echo $module->id; ?>">
|
||||
<?php if (is_null($module->menuid)) : ?>
|
||||
<?php if ($module->except) : ?>
|
||||
<span class="badge bg-success">
|
||||
<?php echo Text::_('JYES'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-danger">
|
||||
<?php echo Text::_('JNO'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($module->menuid > 0) : ?>
|
||||
<span class="badge bg-success">
|
||||
<?php echo Text::_('JYES'); ?>
|
||||
</span>
|
||||
<?php elseif ($module->menuid < 0) : ?>
|
||||
<span class="badge bg-danger">
|
||||
<?php echo Text::_('JNO'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-info">
|
||||
<?php echo Text::_('JALL'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td id="status-<?php echo $module->id; ?>">
|
||||
<?php if ($module->published) : ?>
|
||||
<span class="badge bg-success">
|
||||
<?php echo Text::_('JYES'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-danger">
|
||||
<?php echo Text::_('JNO'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
20
administrator/components/com_menus/tmpl/item/modal.php
Normal file
20
administrator/components/com_menus/tmpl/item/modal.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<div class="subhead noshadow mb-3">
|
||||
<?php echo $this->document->getToolbar('toolbar')->render(); ?>
|
||||
</div>
|
||||
<div class="container-popup">
|
||||
<?php $this->setLayout('edit'); ?>
|
||||
<?php echo $this->loadTemplate(); ?>
|
||||
</div>
|
||||
42
administrator/components/com_menus/tmpl/item/modalreturn.php
Normal file
42
administrator/components/com_menus/tmpl/item/modalreturn.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_content
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$icon = 'icon-check';
|
||||
$title = $this->item ? $this->item->title : '';
|
||||
$content = $this->item ? $this->item->alias : '';
|
||||
$data = ['contentType' => 'com_menus.item'];
|
||||
|
||||
if ($this->item) {
|
||||
$data['id'] = $this->item->id;
|
||||
$data['title'] = $this->item->title;
|
||||
$data['uri'] = 'index.php?Itemid=' . $this->item->id;
|
||||
}
|
||||
|
||||
// Add Content select script
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('modal-content-select');
|
||||
|
||||
// The data for Content select script
|
||||
$this->document->addScriptOptions('content-select-on-load', $data, false);
|
||||
|
||||
?>
|
||||
|
||||
<div class="px-4 py-5 my-5 text-center">
|
||||
<span class="fa-8x mb-4 <?php echo $icon; ?>" aria-hidden="true"></span>
|
||||
<h1 class="display-5 fw-bold"><?php echo $title; ?></h1>
|
||||
<div class="col-lg-6 mx-auto">
|
||||
<p class="lead mb-4">
|
||||
<?php echo $content; ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
290
administrator/components/com_menus/tmpl/items/default.php
Normal file
290
administrator/components/com_menus/tmpl/items/default.php
Normal file
@ -0,0 +1,290 @@
|
||||
<?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\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Associations;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('table.columns')
|
||||
->useScript('multiselect');
|
||||
|
||||
$user = $this->getCurrentUser();
|
||||
$app = Factory::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');
|
||||
$saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc');
|
||||
$menuType = (string) $app->getUserState('com_menus.items.menutype', '');
|
||||
|
||||
if ($saveOrder && $menuType && !empty($this->items)) {
|
||||
$saveOrderingUrl = 'index.php?option=com_menus&task=items.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
|
||||
HTMLHelper::_('draggablelist.draggable');
|
||||
}
|
||||
|
||||
$assoc = Associations::isEnabled() && $this->state->get('filter.client_id') == 0;
|
||||
|
||||
?>
|
||||
<?php // Set up the filter bar. ?>
|
||||
<form action="<?php echo Route::_('index.php?option=com_menus&view=items&menutype='); ?>" method="post" name="adminForm"
|
||||
id="adminForm">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div id="j-main-container" class="j-main-container">
|
||||
<?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this, 'options' => ['selectorFieldName' => 'menutype']]); ?>
|
||||
<?php if (!empty($this->items)) : ?>
|
||||
<table class="table" id="menuitemList">
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('COM_MENUS_ITEMS_TABLE_CAPTION'); ?>,
|
||||
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
|
||||
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_('grid.checkall'); ?>
|
||||
</td>
|
||||
<?php if ($menuType) : ?>
|
||||
<th scope="col" class="w-1 text-center d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', '', 'a.lft', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th scope="col" class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="title">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_MENUS_HEADING_MENU', 'menutype_title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php if ($this->state->get('filter.client_id') == 0) : ?>
|
||||
<th scope="col" class="w-10 text-center d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_MENUS_HEADING_HOME', 'a.home', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->state->get('filter.client_id') == 0) : ?>
|
||||
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($assoc) : ?>
|
||||
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_MENUS_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if (($this->state->get('filter.client_id') == 0) && (Multilanguage::isEnabled())) : ?>
|
||||
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th scope="col" class="w-5 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody <?php if ($saveOrder && $menuType) :
|
||||
?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="false"<?php
|
||||
endif; ?>>
|
||||
<?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.' . $item->menutype_id);
|
||||
$canEdit = $user->authorise('core.edit', 'com_menus.menu.' . $item->menutype_id);
|
||||
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || is_null($item->checked_out);
|
||||
$canChange = $user->authorise('core.edit.state', 'com_menus.menu.' . $item->menutype_id) && $canCheckin;
|
||||
|
||||
// Get the parents of item for sorting
|
||||
if ($item->level > 1) {
|
||||
$parentsStr = '';
|
||||
$_currentParentId = $item->parent_id;
|
||||
$parentsStr = ' ' . $_currentParentId;
|
||||
|
||||
for ($j = 0; $j < $item->level; $j++) {
|
||||
foreach ($this->ordering as $k => $v) {
|
||||
$v = implode('-', $v);
|
||||
$v = '-' . $v . '-';
|
||||
|
||||
if (strpos($v, '-' . $_currentParentId . '-') !== false) {
|
||||
$parentsStr .= ' ' . $k;
|
||||
$_currentParentId = $k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$parentsStr = '';
|
||||
}
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->parent_id; ?>"
|
||||
data-item-id="<?php echo $item->id; ?>" data-parents="<?php echo $parentsStr; ?>"
|
||||
data-level="<?php echo $item->level; ?>">
|
||||
<td class="text-center">
|
||||
<?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
|
||||
</td>
|
||||
<?php if ($menuType) : ?>
|
||||
<td class="text-center d-none d-md-table-cell">
|
||||
<?php
|
||||
$iconClass = '';
|
||||
|
||||
if (!$canChange) {
|
||||
$iconClass = ' inactive';
|
||||
} elseif (!$saveOrder) {
|
||||
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
|
||||
}
|
||||
?>
|
||||
<span class="sortable-handler<?php echo $iconClass ?>">
|
||||
<span class="icon-ellipsis-v" aria-hidden="true"></span>
|
||||
</span>
|
||||
<?php if ($canChange && $saveOrder) : ?>
|
||||
<input type="text" class="hidden" name="order[]" size="5"
|
||||
value="<?php echo $orderkey + 1; ?>">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="text-center">
|
||||
<?php if ($item->type === 'component' && !$item->enabled) : ?>
|
||||
<span class="icon-warning" aria-hidden="true"></span>
|
||||
<div role="tooltip" id="warning<?php echo $item->id; ?>">
|
||||
<?php echo Text::_($item->enabled === null ? 'JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND' : 'COM_MENUS_LABEL_DISABLED'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<?php echo HTMLHelper::_('jgrid.published', $item->published, $i, 'items.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<th scope="row">
|
||||
<?php $prefix = LayoutHelper::render('joomla.html.treeprefix', ['level' => $item->level]); ?>
|
||||
<?php echo $prefix; ?>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'items.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($canEdit && !$item->protected) : ?>
|
||||
<a href="<?php echo Route::_('index.php?option=com_menus&task=item.edit&id=' . (int) $item->id); ?>"
|
||||
title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
|
||||
<?php echo $this->escape($item->title); ?></a>
|
||||
<?php else : ?>
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo HTMLHelper::_('menus.visibility', $item->params); ?>
|
||||
<div>
|
||||
<?php echo $prefix; ?>
|
||||
<span class="small">
|
||||
<?php if ($item->type != 'url') : ?>
|
||||
<?php if (empty($item->note)) : ?>
|
||||
<?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
|
||||
<?php else : ?>
|
||||
<?php echo Text::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($item->type == 'url' && $item->note) : ?>
|
||||
<?php echo Text::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note)); ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</div>
|
||||
<div title="<?php echo $this->escape($item->path); ?>">
|
||||
<?php echo $prefix; ?>
|
||||
<span class="small"
|
||||
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>
|
||||
</div>
|
||||
<?php if ($item->type === 'component' && !$item->enabled) : ?>
|
||||
<div>
|
||||
<span class="badge bg-secondary">
|
||||
<?php echo Text::_($item->enabled === null ? 'JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND' : 'COM_MENUS_LABEL_DISABLED'); ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php echo $this->escape($item->menutype_title ?: ucwords($item->menutype)); ?>
|
||||
</td>
|
||||
<?php if ($this->state->get('filter.client_id') == 0) : ?>
|
||||
<td class="text-center d-none d-md-table-cell">
|
||||
<?php if ($item->type == 'component') : ?>
|
||||
<?php if ($item->language == '*' || $item->home == '0') : ?>
|
||||
<?php echo HTMLHelper::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange && !$item->protected, 'cb', null, 'icon-home', 'icon-circle'); ?>
|
||||
<?php elseif ($canChange) : ?>
|
||||
<a href="<?php echo Route::_('index.php?option=com_menus&task=items.unsetDefault&cid[]=' . $item->id . '&' . Session::getFormToken() . '=1'); ?>">
|
||||
<?php if ($item->language_image) : ?>
|
||||
<?php echo HTMLHelper::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, ['title' => Text::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $item->language_title)], true); ?>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-secondary"
|
||||
title="<?php echo Text::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $item->language_title); ?>"><?php echo $item->language; ?></span>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php if ($item->language_image) : ?>
|
||||
<?php echo HTMLHelper::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, ['title' => $item->language_title], true); ?>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-secondary"
|
||||
title="<?php echo $item->language_title; ?>"><?php echo $item->language; ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->state->get('filter.client_id') == 0) : ?>
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php echo $this->escape($item->access_level); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($assoc) : ?>
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php if ($item->association) : ?>
|
||||
<?php echo HTMLHelper::_('menus.association', $item->id); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->state->get('filter.client_id') == 0 && Multilanguage::isEnabled()) : ?>
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php echo LayoutHelper::render('joomla.content.language', $item); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php echo (int) $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php // load the pagination. ?>
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
|
||||
<?php // Load the batch processing form if user is allowed ?>
|
||||
<?php if ($user->authorise('core.create', 'com_menus') || $user->authorise('core.edit', 'com_menus')) : ?>
|
||||
<?php echo HTMLHelper::_(
|
||||
'bootstrap.renderModal',
|
||||
'collapseModal',
|
||||
[
|
||||
'title' => Text::_('COM_MENUS_BATCH_OPTIONS'),
|
||||
'footer' => $this->loadTemplate('batch_footer')
|
||||
],
|
||||
$this->loadTemplate('batch_body')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="task" value="">
|
||||
<input type="hidden" name="boxchecked" value="0">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
21
administrator/components/com_menus/tmpl/items/default.xml
Normal file
21
administrator/components/com_menus/tmpl/items/default.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_MENUS_ITEMS_VIEW_DEFAULT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_MENUS_ITEMS_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
<fieldset name="request">
|
||||
<fields name="request">
|
||||
<field
|
||||
name="menutype"
|
||||
type="menu"
|
||||
label="COM_MENUS_ITEMS_CHOOSE_MENU_LABEL"
|
||||
description="COM_MENUS_ITEMS_CHOOSE_MENU_DESC"
|
||||
clientid=""
|
||||
>
|
||||
<option value="">COM_MENUS_SELECT_MENU</option>
|
||||
</field>
|
||||
</fields>
|
||||
</fieldset>
|
||||
</metadata>
|
||||
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright (C) 2015 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\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
$options = [
|
||||
HTMLHelper::_('select.option', 'c', Text::_('JLIB_HTML_BATCH_COPY')),
|
||||
HTMLHelper::_('select.option', 'm', Text::_('JLIB_HTML_BATCH_MOVE'))
|
||||
];
|
||||
$published = (int) $this->state->get('filter.published');
|
||||
$clientId = (int) $this->state->get('filter.client_id');
|
||||
$menuType = Factory::getApplication()->getUserState('com_menus.items.menutype', '');
|
||||
|
||||
if ($clientId == 1) {
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('com_menus.batch-body');
|
||||
$wa->useScript('joomla.batch-copymove');
|
||||
}
|
||||
?>
|
||||
<div class="p-3">
|
||||
<?php if (strlen($menuType) && $menuType != '*') : ?>
|
||||
<?php if ($clientId != 1) : ?>
|
||||
<div class="row">
|
||||
<?php if (Multilanguage::isEnabled()) : ?>
|
||||
<div class="form-group col-md-6">
|
||||
<div class="controls">
|
||||
<?php echo LayoutHelper::render('joomla.html.batch.language', []); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="form-group col-md-6">
|
||||
<div class="controls">
|
||||
<?php echo LayoutHelper::render('joomla.html.batch.access', []); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<?php if ($published >= 0) : ?>
|
||||
<div class="form-group col-md-6">
|
||||
<div class="control-group">
|
||||
<label id="batch-choose-action-lbl" for="batch-menu-id">
|
||||
<?php echo Text::_('COM_MENUS_BATCH_MENU_LABEL'); ?>
|
||||
</label>
|
||||
<select class="form-select" name="batch[menu_id]" id="batch-menu-id">
|
||||
<option value=""><?php echo Text::_('JLIB_HTML_BATCH_NO_CATEGORY'); ?></option>
|
||||
<?php
|
||||
$opts = [
|
||||
'published' => $this->state->get('filter.published'),
|
||||
'checkacl' => (int) $this->state->get('menutypeid'),
|
||||
'clientid' => (int) $clientId,
|
||||
];
|
||||
echo HTMLHelper::_('select.options', HTMLHelper::_('menu.menuitems', $opts));
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="batch-copy-move">
|
||||
<?php echo Text::_('JLIB_HTML_BATCH_MOVE_QUESTION'); ?>
|
||||
<?php echo HTMLHelper::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($published < 0 && $clientId == 1) : ?>
|
||||
<p><?php echo Text::_('COM_MENUS_SELECT_MENU_FILTER_NOT_TRASHED'); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="row">
|
||||
<p><?php echo Text::_('COM_MENUS_SELECT_MENU_FIRST'); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright (C) 2015 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\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
$published = $this->state->get('filter.published');
|
||||
$clientId = $this->state->get('filter.client_id');
|
||||
$menuType = Factory::getApplication()->getUserState('com_menus.items.menutype', '');
|
||||
?>
|
||||
<button type="button" class="btn btn-secondary" onclick="document.getElementById('batch-menu-id').value='';document.getElementById('batch-access').value='';document.getElementById('batch-language-id').value=''" data-bs-dismiss="modal">
|
||||
<?php echo Text::_('JCANCEL'); ?>
|
||||
</button>
|
||||
<?php if ((strlen($menuType) && $menuType != '*' && $clientId == 0) || ($published >= 0 && $clientId == 1)) : ?>
|
||||
<button type="submit" class="btn btn-success" onclick="Joomla.submitbutton('item.batch');return false;">
|
||||
<?php echo Text::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
194
administrator/components/com_menus/tmpl/items/modal.php
Normal file
194
administrator/components/com_menus/tmpl/items/modal.php
Normal file
@ -0,0 +1,194 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright (C) 2016 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\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
$app = Factory::getApplication();
|
||||
|
||||
if ($app->isClient('site')) {
|
||||
Session::checkToken('get') or die(Text::_('JINVALID_TOKEN'));
|
||||
}
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('com_menus.admin-items-modal')->useScript('modal-content-select');
|
||||
|
||||
// @todo: Use of Function and Editor is deprecated and should be removed in 6.0. It stays only for backward compatibility.
|
||||
$function = $app->getInput()->get('function', 'jSelectMenuItem', 'cmd');
|
||||
$editor = $app->getInput()->getCmd('editor', '');
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$link = 'index.php?option=com_menus&view=items&layout=modal&tmpl=component&' . Session::getFormToken() . '=1';
|
||||
$multilang = Multilanguage::isEnabled();
|
||||
|
||||
if (!empty($editor)) {
|
||||
// This view is used also in com_menus. Load the xtd script only if the editor is set!
|
||||
$this->document->addScriptOptions('xtd-menus', ['editor' => $editor]);
|
||||
$onclick = "jSelectMenuItem";
|
||||
$link = 'index.php?option=com_menus&view=items&layout=modal&tmpl=component&editor=' . $editor . '&' . Session::getFormToken() . '=1';
|
||||
}
|
||||
?>
|
||||
<div class="container-popup">
|
||||
<form action="<?php echo Route::_($link); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this, 'options' => ['selectorFieldName' => 'menutype']]); ?>
|
||||
|
||||
<?php if (empty($this->items)) : ?>
|
||||
<div class="alert alert-info">
|
||||
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
|
||||
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<table class="table table-sm">
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('COM_MENUS_ITEMS_TABLE_CAPTION'); ?>,
|
||||
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
|
||||
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="title">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_MENUS_HEADING_MENU', 'menutype_title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-5 text-center d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_MENUS_HEADING_HOME', 'a.home', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php if ($multilang) : ?>
|
||||
<th scope="col" class="w-15 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th scope="col" class="w-1 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $i => $item) : ?>
|
||||
<?php
|
||||
$language = '';
|
||||
if ($item->language && $multilang) {
|
||||
if ($item->language !== '*') {
|
||||
$language = $item->language;
|
||||
}
|
||||
}
|
||||
|
||||
$link = 'index.php?Itemid=' . $item->id;
|
||||
$itemHtml = '<a href="' . $link . ($language ? '&lang=' . $language : '') . '">' . $item->title . '</a>';
|
||||
$attribs = 'data-content-select data-content-type="com_menus.item"'
|
||||
. 'data-function="' . $this->escape($function) . '"'
|
||||
. ' data-id="' . $item->id . '"'
|
||||
. ' data-title="' . $this->escape($item->title) . '"'
|
||||
. ' data-uri="' . $this->escape($link) . '"'
|
||||
. ' data-language="' . $this->escape($language) . '"'
|
||||
. ' data-html="' . $this->escape($itemHtml) . '"';
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td class="text-center">
|
||||
<?php echo HTMLHelper::_('jgrid.published', $item->published, $i, 'items.', false, 'cb', $item->publish_up, $item->publish_down); ?>
|
||||
</td>
|
||||
<th scope="row">
|
||||
<?php $prefix = LayoutHelper::render('joomla.html.treeprefix', ['level' => $item->level]); ?>
|
||||
<?php echo $prefix; ?>
|
||||
<a class="select-link" href="javascript:void(0)" <?php echo $attribs; ?>>
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
</a>
|
||||
<?php echo HTMLHelper::_('menus.visibility', $item->params); ?>
|
||||
<div>
|
||||
<?php echo $prefix; ?>
|
||||
<span class="small">
|
||||
<?php if (empty($item->note)) : ?>
|
||||
<?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
|
||||
<?php else : ?>
|
||||
<?php echo Text::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</div>
|
||||
<div title="<?php echo $this->escape($item->path); ?>">
|
||||
<?php echo $prefix; ?>
|
||||
<span class="small" 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>
|
||||
</div>
|
||||
<?php if ($item->type === 'component' && !$item->enabled) : ?>
|
||||
<div>
|
||||
<span class="badge bg-secondary">
|
||||
<?php echo Text::_($item->enabled === null ? 'JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND' : 'COM_MENUS_LABEL_DISABLED'); ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php echo $this->escape($item->menutype_title); ?>
|
||||
</td>
|
||||
<td class="text-center d-none d-md-table-cell">
|
||||
<?php if ($item->type == 'component') : ?>
|
||||
<?php if ($item->language == '*' || $item->home == '0') : ?>
|
||||
<?php echo HTMLHelper::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && false && !$item->protected, 'cb', null, 'home', 'circle'); ?>
|
||||
<?php else : ?>
|
||||
<?php if ($item->language_image) : ?>
|
||||
<?php echo HTMLHelper::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, ['title' => $item->language_title], true); ?>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-secondary" title="<?php echo $item->language_title; ?>"><?php echo $item->language; ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php echo $this->escape($item->access_level); ?>
|
||||
</td>
|
||||
<?php if ($multilang) : ?>
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php if ($item->language == '') : ?>
|
||||
<?php echo Text::_('COM_MENUS_HOME'); ?>
|
||||
<?php elseif ($item->language == '*') : ?>
|
||||
<?php echo Text::alt('JALL', 'language'); ?>
|
||||
<?php else : ?>
|
||||
<?php echo LayoutHelper::render('joomla.content.language', $item); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php echo (int) $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php // load the pagination. ?>
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="task" value="">
|
||||
<input type="hidden" name="boxchecked" value="0">
|
||||
<input type="hidden" name="function" value="<?php echo $function; ?>">
|
||||
<input type="hidden" name="forcedLanguage" value="<?php echo $app->getInput()->get('forcedLanguage', '', 'cmd'); ?>">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
70
administrator/components/com_menus/tmpl/menu/edit.php
Normal file
70
administrator/components/com_menus/tmpl/menu/edit.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?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\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('core')
|
||||
->useScript('keepalive')
|
||||
->useScript('form.validate');
|
||||
|
||||
Text::script('ERROR');
|
||||
?>
|
||||
<form action="<?php echo Route::_('index.php?option=com_menus&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" aria-label="<?php echo Text::_('COM_MENUS_MENU_FORM_' . ((int) $this->item->id === 0 ? 'NEW' : 'EDIT'), true); ?>" class="form-validate">
|
||||
|
||||
<?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>
|
||||
|
||||
<div class="main-card">
|
||||
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'details', 'recall' => true, 'breakpoint' => 768]); ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'details', Text::_('COM_MENUS_MENU_DETAILS')); ?>
|
||||
|
||||
<fieldset id="fieldset-details" class="options-form">
|
||||
<legend><?php echo Text::_('COM_MENUS_MENU_DETAILS'); ?></legend>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<?php
|
||||
echo $this->form->renderField('menutype');
|
||||
|
||||
echo $this->form->renderField('description');
|
||||
|
||||
echo $this->form->renderField('client_id');
|
||||
|
||||
echo $this->form->renderField('preset');
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
|
||||
<?php if ($this->canDo->get('core.admin')) : ?>
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'permissions', Text::_('COM_MENUS_FIELDSET_RULES')); ?>
|
||||
<fieldset id="fieldset-rules" class="options-form">
|
||||
<legend><?php echo Text::_('COM_MENUS_FIELDSET_RULES'); ?></legend>
|
||||
<div>
|
||||
<?php echo $this->form->getInput('rules'); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
|
||||
<input type="hidden" name="task" value="">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
8
administrator/components/com_menus/tmpl/menu/edit.xml
Normal file
8
administrator/components/com_menus/tmpl/menu/edit.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?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>
|
||||
300
administrator/components/com_menus/tmpl/menus/default.php
Normal file
300
administrator/components/com_menus/tmpl/menus/default.php
Normal file
@ -0,0 +1,300 @@
|
||||
<?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;
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('table.columns')
|
||||
->useScript('multiselect')
|
||||
->useScript('com_menus.admin-menus');
|
||||
|
||||
$uri = Uri::getInstance();
|
||||
$return = base64_encode($uri);
|
||||
$user = $this->getCurrentUser();
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$modMenuId = (int) $this->get('ModMenuId');
|
||||
$itemIds = [];
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
if ($user->authorise('core.edit', 'com_menus')) {
|
||||
$itemIds[] = $item->id;
|
||||
}
|
||||
}
|
||||
|
||||
$saveOrder = $listOrder == 'a.ordering';
|
||||
|
||||
if ($saveOrder) {
|
||||
$saveOrderingUrl = 'index.php?option=com_menus&task=menus.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
|
||||
HTMLHelper::_('draggablelist.draggable');
|
||||
}
|
||||
|
||||
$this->document->addScriptOptions('menus-default', ['items' => $itemIds]);
|
||||
?>
|
||||
<form action="<?php echo Route::_('index.php?option=com_menus&view=menus'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div id="j-main-container" class="j-main-container">
|
||||
<?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this, 'options' => ['filterButton' => false]]); ?>
|
||||
<?php if (empty($this->items)) : ?>
|
||||
<div class="alert alert-info">
|
||||
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
|
||||
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<table class="table" id="menuList">
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('COM_MENUS_MENUS_TABLE_CAPTION'); ?>,
|
||||
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
|
||||
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_('grid.checkall'); ?>
|
||||
</td>
|
||||
<th scope="col" class="w-1 text-center d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-5 text-center">
|
||||
<?php echo Text::_('COM_MENUS_MENUS'); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-10 text-center d-none d-md-table-cell">
|
||||
<span class="icon-check" aria-hidden="true"></span>
|
||||
<span class="d-none d-md-inline"><?php echo Text::_('COM_MENUS_HEADING_PUBLISHED_ITEMS'); ?></span>
|
||||
</th>
|
||||
<th scope="col" class="w-10 text-center d-none d-md-table-cell">
|
||||
<span class="icon-times" aria-hidden="true"></span>
|
||||
<span class="d-none d-md-inline"><?php echo Text::_('COM_MENUS_HEADING_UNPUBLISHED_ITEMS'); ?></span>
|
||||
</th>
|
||||
<th scope="col" class="w-10 text-center d-none d-md-table-cell">
|
||||
<span class="icon-trash" aria-hidden="true"></span>
|
||||
<span class="d-none d-md-inline"><?php echo Text::_('COM_MENUS_HEADING_TRASHED_ITEMS'); ?></span>
|
||||
</th>
|
||||
<th scope="col" class="w-10 text-center d-none d-lg-table-cell">
|
||||
<span class="icon-cube" aria-hidden="true"></span>
|
||||
<span class="d-none d-md-inline"><?php echo Text::_('COM_MENUS_HEADING_LINKED_MODULES'); ?></span>
|
||||
</th>
|
||||
<th scope="col" class="w-5 d-none d-lg-table-cell text-center">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody <?php if ($saveOrder) :
|
||||
?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="false"<?php
|
||||
endif; ?>>
|
||||
<?php foreach ($this->items as $i => $item) :
|
||||
$ordering = ($listOrder == 'a.ordering');
|
||||
$canEdit = $user->authorise('core.edit', 'com_menus.menu.' . (int) $item->id);
|
||||
$canManageItems = $user->authorise('core.manage', 'com_menus.menu.' . (int) $item->id);
|
||||
$canChange = $user->authorise('core.edit.state', 'com_menus.menu.' . (int) $item->id);
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>" data-draggable-group="0">
|
||||
<td class="text-center">
|
||||
<?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
|
||||
</td>
|
||||
<td class="text-center d-none d-md-table-cell">
|
||||
<?php
|
||||
$iconClass = '';
|
||||
if (!$canChange) {
|
||||
$iconClass = ' inactive';
|
||||
} elseif (!$saveOrder) {
|
||||
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
|
||||
}
|
||||
?>
|
||||
<span class="sortable-handler<?php echo $iconClass; ?>">
|
||||
<span class="icon-ellipsis-v" aria-hidden="true"></span>
|
||||
</span>
|
||||
<?php if ($canChange && $saveOrder) : ?>
|
||||
<input type="text" name="order[]" size="5" value="<?php echo $item->ordering; ?>" class="width-20 text-area-order hidden">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<th scope="row">
|
||||
<div class="name break-word">
|
||||
<?php if ($canEdit) : ?>
|
||||
<a href="<?php echo Route::_('index.php?option=com_menus&task=menu.edit&id=' . $item->id); ?>">
|
||||
<span class="visually-hidden"><?php echo Text::_('COM_MENUS_EDIT_MENU'); ?></span><?php echo $this->escape($item->title); ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($item->description)) : ?>
|
||||
<div class="small">
|
||||
(<?php echo $this->escape($item->description); ?>)
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</th>
|
||||
<td class="text-center btns">
|
||||
<?php if ($canManageItems) : ?>
|
||||
<a href="<?php echo Route::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype); ?>">
|
||||
<span class="icon-list" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('COM_MENUS_MENUS'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="text-center btns d-none d-md-table-cell itemnumber">
|
||||
<?php if ($canManageItems) : ?>
|
||||
<a class="btn<?php echo ($item->count_published > 0) ? ' btn-success' : ' btn-secondary'; ?>"
|
||||
href="<?php echo Route::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype . '&filter[published]=1'); ?>"
|
||||
aria-describedby="tip-publish<?php echo $i; ?>">
|
||||
<?php echo $item->count_published; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<span class="btn<?php echo ($item->count_published > 0) ? ' btn-success' : ' btn-secondary'; ?>" tabindex="0"
|
||||
aria-describedby="tip-publish<?php echo $i; ?>">
|
||||
<?php echo $item->count_published; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<div role="tooltip" id="tip-publish<?php echo $i; ?>">
|
||||
<?php echo Text::_('COM_MENUS_COUNT_PUBLISHED_ITEMS'); ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center btns d-none d-md-table-cell itemnumber">
|
||||
<?php if ($canManageItems) : ?>
|
||||
<a class="btn<?php echo ($item->count_unpublished > 0) ? ' btn-danger' : ' btn-secondary'; ?>"
|
||||
href="<?php echo Route::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype . '&filter[published]=0'); ?>"
|
||||
aria-describedby="tip-unpublish<?php echo $i; ?>">
|
||||
<?php echo $item->count_unpublished; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<span class="btn<?php echo ($item->count_unpublished > 0) ? ' btn-danger' : ' btn-secondary'; ?>" tabindex="0"
|
||||
aria-describedby="tip-unpublish<?php echo $i; ?>">
|
||||
<?php echo $item->count_unpublished; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<div role="tooltip" id="tip-unpublish<?php echo $i; ?>">
|
||||
<?php echo Text::_('COM_MENUS_COUNT_UNPUBLISHED_ITEMS'); ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center btns d-none d-md-table-cell itemnumber">
|
||||
<?php if ($canManageItems) : ?>
|
||||
<a class="btn<?php echo ($item->count_trashed > 0) ? ' btn-danger' : ' btn-secondary'; ?>"
|
||||
href="<?php echo Route::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype . '&filter[published]=-2'); ?>"
|
||||
aria-describedby="tip-trash<?php echo $i; ?>">
|
||||
<?php echo $item->count_trashed; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<span class="btn<?php echo ($item->count_trashed > 0) ? ' btn-danger' : ' btn-secondary'; ?>" tabindex="0"
|
||||
aria-describedby="tip-trash<?php echo $i; ?>">
|
||||
<?php echo $item->count_trashed; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<div role="tooltip" id="tip-trash<?php echo $i; ?>">
|
||||
<?php echo Text::_('COM_MENUS_COUNT_TRASHED_ITEMS'); ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center d-none d-lg-table-cell itemnumber">
|
||||
<?php if (isset($this->modules[$item->menutype])) : ?>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown">
|
||||
<?php echo Text::_('COM_MENUS_MODULES'); ?>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<?php foreach ($this->modules[$item->menutype] as &$module) : ?>
|
||||
<?php if ($user->authorise('core.edit', 'com_modules.module.' . (int) $module->id)) : ?>
|
||||
<?php $link = Route::_('index.php?option=com_modules&task=module.edit&id=' . $module->id . '&return=' . $return . '&tmpl=component&layout=modal'); ?>
|
||||
<button type="button" class="dropdown-item" data-bs-target="#moduleEdit<?php echo $module->id; ?>Modal" data-bs-toggle="modal" title="<?php echo Text::_('COM_MENUS_EDIT_MODULE_SETTINGS'); ?>">
|
||||
<?php echo Text::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?></button>
|
||||
<?php else : ?>
|
||||
<span class="dropdown-item"><?php echo Text::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php foreach ($this->modules[$item->menutype] as &$module) : ?>
|
||||
<?php if ($user->authorise('core.edit', 'com_modules.module.' . (int) $module->id)) : ?>
|
||||
<?php $link = Route::_('index.php?option=com_modules&task=module.edit&id=' . $module->id . '&return=' . $return . '&tmpl=component&layout=modal'); ?>
|
||||
<?php echo HTMLHelper::_(
|
||||
'bootstrap.renderModal',
|
||||
'moduleEdit' . $module->id . 'Modal',
|
||||
[
|
||||
'title' => Text::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
|
||||
'backdrop' => 'static',
|
||||
'keyboard' => false,
|
||||
'closeButton' => false,
|
||||
'url' => $link,
|
||||
'height' => '400px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => 70,
|
||||
'modalWidth' => 80,
|
||||
'footer' => '<button type="button" class="btn btn-danger" data-bs-dismiss="modal"'
|
||||
. ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleEdit' . $module->id . 'Modal\', buttonSelector: \'#closeBtn\'})">'
|
||||
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
|
||||
. '<button type="button" class="btn btn-success"'
|
||||
. ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleEdit' . $module->id . 'Modal\', buttonSelector: \'#saveBtn\'})">'
|
||||
. Text::_('JSAVE') . '</button>'
|
||||
. '<button type="button" class="btn btn-success"'
|
||||
. ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleEdit' . $module->id . 'Modal\', buttonSelector: \'#applyBtn\'})">'
|
||||
. Text::_('JAPPLY') . '</button>',
|
||||
]
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php elseif ($modMenuId) : ?>
|
||||
<?php $link = Route::_('index.php?option=com_modules&task=module.add&eid=' . $modMenuId . '¶ms[menutype]=' . $item->menutype . '&tmpl=component&layout=modal'); ?>
|
||||
<button type="button" class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#moduleAddModal"><?php echo Text::_('COM_MENUS_ADD_MENU_MODULE'); ?></button>
|
||||
<?php echo HTMLHelper::_(
|
||||
'bootstrap.renderModal',
|
||||
'moduleAddModal',
|
||||
[
|
||||
'title' => Text::_('COM_MENUS_ADD_MENU_MODULE'),
|
||||
'backdrop' => 'static',
|
||||
'keyboard' => false,
|
||||
'closeButton' => false,
|
||||
'url' => $link,
|
||||
'height' => '400px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => 70,
|
||||
'modalWidth' => 80,
|
||||
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"'
|
||||
. ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleAddModal\', buttonSelector: \'#closeBtn\'})">'
|
||||
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
|
||||
. '<button type="button" class="btn btn-primary"'
|
||||
. ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleAddModal\', buttonSelector: \'#saveBtn\'})">'
|
||||
. Text::_('JSAVE') . '</button>'
|
||||
. '<button type="button" class="btn btn-success"'
|
||||
. ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleAddModal\', buttonSelector: \'#applyBtn\'})">'
|
||||
. Text::_('JAPPLY') . '</button>',
|
||||
]
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="d-none d-lg-table-cell">
|
||||
<?php echo $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php // load the pagination. ?>
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="task" value="">
|
||||
<input type="hidden" name="boxchecked" value="0">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_MENUS_MENUS_VIEW_DEFAULT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_MENUS_MENUS_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
</metadata>
|
||||
@ -0,0 +1,67 @@
|
||||
<?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\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
$input = Factory::getApplication()->getInput();
|
||||
|
||||
// Checking if loaded via index.php or component.php
|
||||
$tmpl = $input->getCmd('tmpl') ? '1' : '';
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('com_menus.admin-item-modal');
|
||||
|
||||
if ($tmpl) {
|
||||
$wa->useScript('modal-content-select');
|
||||
}
|
||||
|
||||
?>
|
||||
<?php echo HTMLHelper::_('bootstrap.startAccordion', 'collapseTypes', ['active' => 'slide1']); ?>
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach ($this->types as $name => $list) : ?>
|
||||
<?php echo HTMLHelper::_('bootstrap.addSlide', 'collapseTypes', $name, 'collapse' . ($i++)); ?>
|
||||
<div class="list-group">
|
||||
<?php foreach ($list as $title => $item) :
|
||||
$menutype = ['id' => $this->recordId, 'title' => $item->type ?? $item->title, 'request' => $item->request];
|
||||
$encoded = base64_encode(json_encode($menutype));
|
||||
|
||||
if ($tmpl) {
|
||||
$attrs = 'data-content-select data-content-type="com_menus.menutype" data-message-type="joomla:content-select-menutype"'
|
||||
. ' data-item-id="' . (int) $this->recordId . '"'
|
||||
. ' data-type="' . $this->escape($item->type ?? $item->title) . '"'
|
||||
. ' data-request="' . ($item->request ? $this->escape(json_encode($item->request)) : '') . '"'
|
||||
. ' data-encoded="' . $this->escape($encoded) . '"';
|
||||
|
||||
$link = '#';
|
||||
} else {
|
||||
$attrs = '';
|
||||
$link = $this->escape('index.php?option=com_menus&view=item&task=item.setType&layout=edit&type=' . $encoded . '&' . Session::getFormToken() . '=1');
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo $link; ?>" class="choose_type list-group-item list-group-item-action" <?php echo $attrs; ?>>
|
||||
<div class="pe-2">
|
||||
<?php echo $title; ?>
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
<?php echo Text::_($item->description); ?>
|
||||
</small>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php echo HTMLHelper::_('bootstrap.endSlide'); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php echo HTMLHelper::_('bootstrap.endSlide'); ?>
|
||||
<?php echo HTMLHelper::_('bootstrap.endAccordion');
|
||||
Reference in New Issue
Block a user