first commit
This commit is contained in:
@ -0,0 +1,298 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_categories
|
||||
*
|
||||
* @copyright (C) 2008 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\Multilanguage;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\String\Inflector;
|
||||
|
||||
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('table.columns')
|
||||
->useScript('multiselect');
|
||||
|
||||
$user = $this->getCurrentUser();
|
||||
$userId = $user->get('id');
|
||||
$extension = $this->escape($this->state->get('filter.extension'));
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc');
|
||||
$parts = explode('.', $extension, 2);
|
||||
$component = $parts[0];
|
||||
$section = null;
|
||||
|
||||
if (count($parts) > 1) {
|
||||
$section = $parts[1];
|
||||
|
||||
$inflector = Inflector::getInstance();
|
||||
|
||||
if (!$inflector->isPlural($section)) {
|
||||
$section = $inflector->toPlural($section);
|
||||
}
|
||||
}
|
||||
|
||||
if ($saveOrder && !empty($this->items)) {
|
||||
$saveOrderingUrl = 'index.php?option=com_categories&task=categories.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
|
||||
HTMLHelper::_('draggablelist.draggable');
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo Route::_('index.php?option=com_categories&view=categories&extension=' . $this->state->get('filter.extension')); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div id="j-main-container" class="j-main-container">
|
||||
<?php
|
||||
// Search tools bar
|
||||
echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]);
|
||||
?>
|
||||
<?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="categoryList">
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('COM_CATEGORIES_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.lft', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_published')) : ?>
|
||||
<th scope="col" class="w-3 text-center d-none d-md-table-cell">
|
||||
<span class="icon-check" aria-hidden="true" title="<?php echo Text::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS'); ?>"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS'); ?></span>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_unpublished')) : ?>
|
||||
<th scope="col" class="w-3 text-center d-none d-md-table-cell">
|
||||
<span class="icon-times" aria-hidden="true" title="<?php echo Text::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS'); ?>"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS'); ?></span>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_archived')) : ?>
|
||||
<th scope="col" class="w-3 text-center d-none d-md-table-cell">
|
||||
<span class="icon-folder icon-fw" aria-hidden="true" title="<?php echo Text::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS'); ?>"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS'); ?></span>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_trashed')) : ?>
|
||||
<th scope="col" class="w-3 text-center d-none d-md-table-cell">
|
||||
<span class="icon-trash" aria-hidden="true" title="<?php echo Text::_('COM_CATEGORY_COUNT_TRASHED_ITEMS'); ?>"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('COM_CATEGORY_COUNT_TRASHED_ITEMS'); ?></span>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'access_level', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php if ($this->assoc) : ?>
|
||||
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_CATEGORY_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if (Multilanguage::isEnabled()) : ?>
|
||||
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language_title', $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) :
|
||||
?> 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) : ?>
|
||||
<?php
|
||||
$canEdit = $user->authorise('core.edit', $extension . '.category.' . $item->id);
|
||||
$canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
|
||||
$canEditOwn = $user->authorise('core.edit.own', $extension . '.category.' . $item->id) && $item->created_user_id == $userId;
|
||||
$canChange = $user->authorise('core.edit.state', $extension . '.category.' . $item->id) && $canCheckin;
|
||||
|
||||
// Get the parents of item for sorting
|
||||
if ($item->level > 1) {
|
||||
$parentsStr = '';
|
||||
$_currentParentId = $item->parent_id;
|
||||
$parentsStr = ' ' . $_currentParentId;
|
||||
for ($i2 = 0; $i2 < $item->level; $i2++) {
|
||||
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>
|
||||
<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"></span>
|
||||
</span>
|
||||
<?php if ($canChange && $saveOrder) : ?>
|
||||
<input type="text" class="hidden" name="order[]" size="5" value="<?php echo $item->lft; ?>">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?php echo HTMLHelper::_('jgrid.published', $item->published, $i, 'categories.', $canChange); ?>
|
||||
</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, 'categories.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($canEdit || $canEditOwn) : ?>
|
||||
<a href="<?php echo Route::_('index.php?option=com_categories&task=category.edit&id=' . $item->id . '&extension=' . $extension); ?>" 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; ?>
|
||||
<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>
|
||||
</th>
|
||||
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_published')) : ?>
|
||||
<td class="text-center btns d-none d-md-table-cell itemnumber">
|
||||
<a class="btn <?php echo ($item->count_published > 0) ? 'btn-success' : 'btn-secondary'; ?>"
|
||||
href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=1&filter[level]=1'); ?>"
|
||||
aria-describedby="tip-publish<?php echo $i; ?>">
|
||||
<?php echo $item->count_published; ?>
|
||||
</a>
|
||||
<div role="tooltip" id="tip-publish<?php echo $i; ?>">
|
||||
<?php echo Text::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS'); ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_unpublished')) : ?>
|
||||
<td class="text-center btns d-none d-md-table-cell itemnumber">
|
||||
<a class="btn <?php echo ($item->count_unpublished > 0) ? 'btn-danger' : 'btn-secondary'; ?>"
|
||||
href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=0&filter[level]=1'); ?>"
|
||||
aria-describedby="tip-unpublish<?php echo $i; ?>">
|
||||
<?php echo $item->count_unpublished; ?>
|
||||
</a>
|
||||
<div role="tooltip" id="tip-unpublish<?php echo $i; ?>">
|
||||
<?php echo Text::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS'); ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_archived')) : ?>
|
||||
<td class="text-center btns d-none d-md-table-cell itemnumber">
|
||||
<a class="btn <?php echo ($item->count_archived > 0) ? 'btn-info' : 'btn-secondary'; ?>"
|
||||
href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=2&filter[level]=1'); ?>"
|
||||
aria-describedby="tip-archive<?php echo $i; ?>">
|
||||
<?php echo $item->count_archived; ?>
|
||||
</a>
|
||||
<div role="tooltip" id="tip-archive<?php echo $i; ?>">
|
||||
<?php echo Text::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS'); ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_trashed')) : ?>
|
||||
<td class="text-center btns d-none d-md-table-cell itemnumber">
|
||||
<a class="btn <?php echo ($item->count_trashed > 0) ? 'btn-dark' : 'btn-secondary'; ?>"
|
||||
href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=-2&filter[level]=1'); ?>"
|
||||
aria-describedby="tip-trash<?php echo $i; ?>">
|
||||
<?php echo $item->count_trashed; ?>
|
||||
</a>
|
||||
<div role="tooltip" id="tip-trash<?php echo $i; ?>">
|
||||
<?php echo Text::_('COM_CATEGORY_COUNT_TRASHED_ITEMS'); ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php echo $this->escape($item->access_level); ?>
|
||||
</td>
|
||||
<?php if ($this->assoc) : ?>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php if ($item->association) : ?>
|
||||
<?php echo HTMLHelper::_('categoriesadministrator.association', $item->id, $extension); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if (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. ?>
|
||||
<?php
|
||||
if (
|
||||
$user->authorise('core.create', $extension)
|
||||
&& $user->authorise('core.edit', $extension)
|
||||
&& $user->authorise('core.edit.state', $extension)
|
||||
) : ?>
|
||||
<template id="joomla-dialog-batch"><?php echo $this->loadTemplate('batch_body'); ?></template>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="extension" value="<?php echo $extension; ?>">
|
||||
<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,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_CATEGORIES_CATEGORIES_VIEW_DEFAULT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_CATEGORIES_CATEGORIES_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
<fields name="request">
|
||||
<fieldset name="request">
|
||||
<field
|
||||
name="extension"
|
||||
type="ComponentsCategory"
|
||||
label="COM_CATEGORIES_CHOOSE_COMPONENT_LABEL"
|
||||
required="true"
|
||||
addfieldprefix="Joomla\Component\Categories\Administrator\Field"
|
||||
>
|
||||
<option value="">COM_MENUS_OPTION_SELECT_COMPONENT</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
||||
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_categories
|
||||
*
|
||||
* @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\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
$published = (int) $this->state->get('filter.published');
|
||||
$extension = $this->escape($this->state->get('filter.extension'));
|
||||
|
||||
?>
|
||||
|
||||
<div class="p-3">
|
||||
<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>
|
||||
<div class="row">
|
||||
<?php if ($published >= 0) : ?>
|
||||
<div class="form-group col-md-6">
|
||||
<div class="controls">
|
||||
<?php echo LayoutHelper::render('joomla.html.batch.item', ['extension' => $extension, 'addRoot' => true]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="form-group col-md-6">
|
||||
<div class="controls">
|
||||
<?php echo LayoutHelper::render('joomla.html.batch.tag', []); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($extension === 'com_content') : ?>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<div class="controls">
|
||||
<label id="flip-ordering-id-lbl" for="flip-ordering-id" class="control-label">
|
||||
<?php echo Text::_('JLIB_HTML_BATCH_FLIPORDERING_LABEL'); ?>
|
||||
</label>
|
||||
<fieldset id="flip-ordering-id">
|
||||
<?php echo HTMLHelper::_('select.booleanlist', 'batch[flip_ordering]', [], 0, 'JYES', 'JNO', 'flip-ordering-id'); ?>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="btn-toolbar p-3">
|
||||
<joomla-toolbar-button task="category.batch" class="ms-auto">
|
||||
<button type="button" class="btn btn-success"><?php echo Text::_('JGLOBAL_BATCH_PROCESS'); ?></button>
|
||||
</joomla-toolbar-button>
|
||||
</div>
|
||||
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_categories
|
||||
*
|
||||
* @copyright (C) 2021 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;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
$extension = $this->state->get('filter.extension');
|
||||
$component = $this->state->get('filter.component');
|
||||
$section = $this->state->get('filter.section');
|
||||
|
||||
// Special handling for the title as com_categories is a service component for many other components. Copied from the categories view.
|
||||
$lang = Factory::getApplication()->getLanguage();
|
||||
$lang->load($component, JPATH_BASE)
|
||||
|| $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component);
|
||||
|
||||
// If a component categories title string is present, let's use it.
|
||||
if ($lang->hasKey($component_title_key = strtoupper($component . ($section ? "_$section" : '')) . '_CATEGORIES_TITLE')) {
|
||||
$title = Text::_($component_title_key);
|
||||
} elseif ($lang->hasKey($component_section_key = strtoupper($component . ($section ? "_$section" : '')))) {
|
||||
// Else if the component section string exists, let's use it
|
||||
$title = Text::sprintf('COM_CATEGORIES_CATEGORIES_TITLE', $this->escape(Text::_($component_section_key)));
|
||||
} else // Else use the base title
|
||||
{
|
||||
$title = Text::_('COM_CATEGORIES_CATEGORIES_BASE_TITLE');
|
||||
}
|
||||
|
||||
$displayData = [
|
||||
'textPrefix' => 'COM_CATEGORIES',
|
||||
'formURL' => 'index.php?option=com_categories&extension=' . $extension,
|
||||
'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Category',
|
||||
'title' => $title,
|
||||
'icon' => 'icon-folder categories content-categories',
|
||||
];
|
||||
|
||||
if ($this->getCurrentUser()->authorise('core.create', $extension)) {
|
||||
$displayData['createURL'] = 'index.php?option=com_categories&extension=' . $extension . '&task=category.add';
|
||||
}
|
||||
|
||||
echo LayoutHelper::render('joomla.content.emptystate', $displayData);
|
||||
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_categories
|
||||
*
|
||||
* @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;
|
||||
|
||||
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;
|
||||
use Joomla\Component\Content\Site\Helper\RouteHelper;
|
||||
|
||||
$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('core');
|
||||
|
||||
$extension = $this->escape($this->state->get('filter.extension'));
|
||||
$function = $app->getInput()->getCmd('function', 'jSelectCategory');
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
?>
|
||||
<div class="container-popup">
|
||||
|
||||
<form action="<?php echo Route::_('index.php?option=com_categories&view=categories&layout=modal&tmpl=component&function=' . $function . '&' . Session::getFormToken() . '=1'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
|
||||
<?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
|
||||
|
||||
<?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="categoryList">
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('COM_CATEGORIES_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">
|
||||
<?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', 'JGRID_HEADING_ACCESS', 'access_level', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-15 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language_title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<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
|
||||
$iconStates = [
|
||||
-2 => 'icon-trash',
|
||||
0 => 'icon-times',
|
||||
1 => 'icon-check',
|
||||
2 => 'icon-folder',
|
||||
];
|
||||
?>
|
||||
<?php foreach ($this->items as $i => $item) : ?>
|
||||
<?php if ($item->language && Multilanguage::isEnabled()) {
|
||||
$tag = strlen($item->language);
|
||||
if ($tag == 5) {
|
||||
$lang = substr($item->language, 0, 2);
|
||||
} elseif ($tag == 6) {
|
||||
$lang = substr($item->language, 0, 3);
|
||||
} else {
|
||||
$lang = '';
|
||||
}
|
||||
} elseif (!Multilanguage::isEnabled()) {
|
||||
$lang = '';
|
||||
}
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td class="text-center">
|
||||
<span class="tbody-icon">
|
||||
<span class="<?php echo $iconStates[$this->escape($item->published)]; ?>" aria-hidden="true"></span>
|
||||
</span>
|
||||
</td>
|
||||
<th scope="row">
|
||||
<?php echo LayoutHelper::render('joomla.html.treeprefix', ['level' => $item->level]); ?>
|
||||
<a href="javascript:void(0)" onclick="if (window.parent) window.parent.<?php echo $this->escape($function); ?>('<?php echo $item->id; ?>', '<?php echo $this->escape(addslashes($item->title)); ?>', null, '<?php echo $this->escape(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>', '<?php echo $this->escape($lang); ?>', null);">
|
||||
<?php echo $this->escape($item->title); ?></a>
|
||||
<div class="small" title="<?php echo $this->escape($item->path); ?>">
|
||||
<?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; ?>
|
||||
</div>
|
||||
</th>
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php echo $this->escape($item->access_level); ?>
|
||||
</td>
|
||||
<td class="small d-none d-md-table-cell">
|
||||
<?php echo LayoutHelper::render('joomla.content.language', $item); ?>
|
||||
</td>
|
||||
<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="extension" value="<?php echo $extension; ?>">
|
||||
<input type="hidden" name="task" value="">
|
||||
<input type="hidden" name="boxchecked" value="0">
|
||||
<input type="hidden" name="forcedLanguage" value="<?php echo $app->getInput()->get('forcedLanguage', '', 'CMD'); ?>">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
129
administrator/components/com_categories/tmpl/category/edit.php
Normal file
129
administrator/components/com_categories/tmpl/category/edit.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_categories
|
||||
*
|
||||
* @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;
|
||||
use Joomla\CMS\Workflow\WorkflowServiceInterface;
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
$wa->useScript('keepalive')
|
||||
->useScript('form.validate');
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$input = $app->getInput();
|
||||
|
||||
$assoc = Associations::isEnabled();
|
||||
// Are associations implemented for this extension?
|
||||
$extensionassoc = array_key_exists('item_associations', $this->form->getFieldsets());
|
||||
|
||||
// Fieldsets to not automatically render by /layouts/joomla/edit/params.php
|
||||
$this->ignore_fieldsets = ['jmetadata', 'item_associations'];
|
||||
|
||||
$c = Factory::getApplication()->bootComponent($this->state->get('category.extension'));
|
||||
|
||||
if ($c instanceof WorkflowServiceInterface) {
|
||||
$wcontext = $c->getCategoryWorkflowContext($this->state->get('category.section'));
|
||||
|
||||
if (!$c->isWorkflowActive($wcontext)) {
|
||||
$this->ignore_fieldsets[] = 'workflow';
|
||||
}
|
||||
}
|
||||
|
||||
$this->useCoreUI = true;
|
||||
|
||||
// In case of modal
|
||||
$isModal = $input->get('layout') === 'modal';
|
||||
$layout = $isModal ? 'modal' : 'edit';
|
||||
$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : '';
|
||||
?>
|
||||
|
||||
<form action="<?php echo Route::_('index.php?option=com_categories&extension=' . $input->getCmd('extension', 'com_content') . '&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" aria-label="<?php echo Text::_('COM_CATEGORIES_FORM_TITLE_' . ((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' => 'general', 'recall' => true, 'breakpoint' => 768]); ?>
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'general', Text::_('JCATEGORY')); ?>
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<?php echo $this->form->getLabel('description'); ?>
|
||||
<?php echo $this->form->getInput('description'); ?>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<?php echo LayoutHelper::render('joomla.edit.global', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
|
||||
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'publishing', Text::_('JGLOBAL_FIELDSET_PUBLISHING')); ?>
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-6">
|
||||
<fieldset id="fieldset-publishingdata" class="options-form">
|
||||
<legend><?php echo Text::_('JGLOBAL_FIELDSET_PUBLISHING'); ?></legend>
|
||||
<div>
|
||||
<?php echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6">
|
||||
<fieldset id="fieldset-metadata" class="options-form">
|
||||
<legend><?php echo Text::_('JGLOBAL_FIELDSET_METADATA_OPTIONS'); ?></legend>
|
||||
<div>
|
||||
<?php echo LayoutHelper::render('joomla.edit.metadata', $this); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
|
||||
<?php if (!$isModal && $assoc && $extensionassoc) : ?>
|
||||
<?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 && $extensionassoc) : ?>
|
||||
<div class="hidden"><?php echo LayoutHelper::render('joomla.edit.associations', $this); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->canDo->get('core.admin')) : ?>
|
||||
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'rules', Text::_('COM_CATEGORIES_FIELDSET_RULES')); ?>
|
||||
<fieldset id="fieldset-rules" class="options-form">
|
||||
<legend><?php echo Text::_('COM_CATEGORIES_FIELDSET_RULES'); ?></legend>
|
||||
<div>
|
||||
<?php echo $this->form->getInput('rules'); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
|
||||
|
||||
<?php echo $this->form->getInput('extension'); ?>
|
||||
<input type="hidden" name="task" value="">
|
||||
<input type="hidden" name="return" value="<?php echo $input->getBase64('return'); ?>">
|
||||
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_CATEGORIES_CATEGORY_VIEW_EDIT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_CATEGORIES_CATEGORY_VIEW_EDIT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
<fieldset name="request">
|
||||
<fields name="request">
|
||||
<field
|
||||
name="extension"
|
||||
type="ComponentsCategory"
|
||||
label="COM_CATEGORIES_CHOOSE_COMPONENT_LABEL"
|
||||
required="true"
|
||||
addfieldprefix="Joomla\Component\Categories\Administrator\Field"
|
||||
>
|
||||
<option value="">COM_MENUS_OPTION_SELECT_COMPONENT</option>
|
||||
</field>
|
||||
<field
|
||||
name="id"
|
||||
type="hidden"
|
||||
default="0"
|
||||
/>
|
||||
</fields>
|
||||
</fieldset>
|
||||
</metadata>
|
||||
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_categories
|
||||
*
|
||||
* @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;
|
||||
?>
|
||||
<div class="container-popup">
|
||||
<?php $this->setLayout('edit'); ?>
|
||||
<?php echo $this->loadTemplate(); ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user