diff --git a/administrator/components/com_admin/sql/updates/mysql/4.2.0-2022-03-27.sql b/administrator/components/com_admin/sql/updates/mysql/4.2.0-2022-03-27.sql new file mode 100644 index 0000000000000..22bbcb807e35c --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/4.2.0-2022-03-27.sql @@ -0,0 +1,5 @@ +-- Update link to featured +UPDATE `#__menu` + SET `link` = 'index.php?option=com_content&view=articles&featured=1' + WHERE `link` = 'index.php?option=com_content&view=featured' + AND `client_id` = 1; diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.2.0-2022-03-27.sql b/administrator/components/com_admin/sql/updates/postgresql/4.2.0-2022-03-27.sql new file mode 100644 index 0000000000000..6d3e8e384fd92 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/4.2.0-2022-03-27.sql @@ -0,0 +1,5 @@ +-- Update link to featured +UPDATE "#__menu" + SET "link" = 'index.php?option=com_content&view=articles&featured=1' + WHERE "link" = 'index.php?option=com_content&view=featured' + AND "client_id" = 1; diff --git a/administrator/components/com_content/forms/filter_articles.xml b/administrator/components/com_content/forms/filter_articles.xml index 5bc5cf786f44c..ef0de6d36a006 100644 --- a/administrator/components/com_content/forms/filter_articles.xml +++ b/administrator/components/com_content/forms/filter_articles.xml @@ -1,5 +1,18 @@
+ + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/administrator/components/com_content/presets/content.xml b/administrator/components/com_content/presets/content.xml index 214cf4c8ce64c..8e7a9cb6c6481 100644 --- a/administrator/components/com_content/presets/content.xml +++ b/administrator/components/com_content/presets/content.xml @@ -32,7 +32,7 @@ title="COM_CONTENT_MENUS_FEATURED" type="component" element="com_content" - link="index.php?option=com_content&view=featured" + link="index.php?option=com_content&view=articles&featured=1" class="class:featured" /> diff --git a/administrator/components/com_content/src/Controller/ArticlesController.php b/administrator/components/com_content/src/Controller/ArticlesController.php index 6bfa1850b484e..a6e91db13c3d8 100644 --- a/administrator/components/com_content/src/Controller/ArticlesController.php +++ b/administrator/components/com_content/src/Controller/ArticlesController.php @@ -155,4 +155,60 @@ public function getQuickiconContent() echo new JsonResponse($result); } + + /** + * Removes an item. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function delete() + { + $articlesModel = $this->getModel('articles'); + $featured = $articlesModel->isFeatured(); + + if ($featured === '1') + { + // Check for request forgeries + $this->checkToken(); + + $user = $this->app->getIdentity(); + $ids = $this->input->get('cid', [], 'array'); + + // Access checks. + foreach ($ids as $i => $id) + { + if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) + { + // Prune items that you can't delete. + unset($ids[$i]); + $this->app->enqueueMessage(Text::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'notice'); + } + } + + if (empty($ids)) + { + $this->app->enqueueMessage(Text::_('JERROR_NO_ITEMS_SELECTED'), 'error'); + } + else + { + /** @var \Joomla\Component\Content\Administrator\Model\FeatureModel $model */ + $featureModel = $this->getModel('Feature'); + + // Remove the items. + if (!$featureModel->featured($ids, 0)) + { + $this->app->enqueueMessage($featureModel->getError(), 'error'); + } + } + + $this->setMessage(Text::plural('COM_CONTENT_N_ITEMS_DELETED', \count($ids))); + $this->setRedirect('index.php?option=com_content&view=articles&featured=1'); + } + else + { + parent::delete(); + } + } } diff --git a/administrator/components/com_content/src/Controller/FeaturedController.php b/administrator/components/com_content/src/Controller/FeaturedController.php deleted file mode 100644 index 0751014dc7fea..0000000000000 --- a/administrator/components/com_content/src/Controller/FeaturedController.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -namespace Joomla\Component\Content\Administrator\Controller; - -\defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -/** - * Featured content controller class. - * - * @since 1.6 - */ -class FeaturedController extends ArticlesController -{ - /** - * Removes an item. - * - * @return void - * - * @since 1.6 - */ - public function delete() - { - // Check for request forgeries - $this->checkToken(); - - $user = $this->app->getIdentity(); - $ids = $this->input->get('cid', array(), 'array'); - - // Access checks. - foreach ($ids as $i => $id) - { - if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) - { - // Prune items that you can't delete. - unset($ids[$i]); - $this->app->enqueueMessage(Text::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'notice'); - } - } - - if (empty($ids)) - { - $this->app->enqueueMessage(Text::_('JERROR_NO_ITEMS_SELECTED'), 'error'); - } - else - { - /** @var \Joomla\Component\Content\Administrator\Model\FeatureModel $model */ - $model = $this->getModel(); - - // Remove the items. - if (!$model->featured($ids, 0)) - { - $this->app->enqueueMessage($model->getError(), 'error'); - } - } - - $this->setRedirect('index.php?option=com_content&view=featured'); - } - - /** - * Method to publish a list of articles. - * - * @return void - * - * @since 1.0 - */ - public function publish() - { - parent::publish(); - - $this->setRedirect('index.php?option=com_content&view=featured'); - } - - /** - * Method to get a model object, loading it if required. - * - * @param string $name The model name. Optional. - * @param string $prefix The class prefix. Optional. - * @param array $config Configuration array for model. Optional. - * - * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model. - * - * @since 1.6 - */ - public function getModel($name = 'Feature', $prefix = 'Administrator', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); - } -} diff --git a/administrator/components/com_content/src/Model/ArticlesModel.php b/administrator/components/com_content/src/Model/ArticlesModel.php index 8c9f46e058746..e4f6626622295 100644 --- a/administrator/components/com_content/src/Model/ArticlesModel.php +++ b/administrator/components/com_content/src/Model/ArticlesModel.php @@ -40,6 +40,8 @@ class ArticlesModel extends ListModel */ public function __construct($config = array()) { + $featured = $this->isFeatured(); + if (empty($config['filter_fields'])) { $config['filter_fields'] = array( @@ -50,13 +52,13 @@ public function __construct($config = array()) 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'state', 'a.state', + 'featured', 'a.featured', 'access', 'a.access', 'access_level', 'created', 'a.created', 'modified', 'a.modified', 'created_by', 'a.created_by', 'created_by_alias', 'a.created_by_alias', 'ordering', 'a.ordering', - 'featured', 'a.featured', 'featured_up', 'fp.featured_up', 'featured_down', 'fp.featured_down', 'language', 'a.language', @@ -73,6 +75,11 @@ public function __construct($config = array()) 'ws.title' ); + if ($featured === '1') + { + $config['filter_fields'][] = 'fp.ordering'; + } + if (Associations::isEnabled()) { $config['filter_fields'][] = 'association'; @@ -146,7 +153,7 @@ protected function populateState($ordering = 'a.id', $direction = 'desc') $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $featured = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured', ''); + $featured = $this->isFeatured(); $this->setState('filter.featured', $featured); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); @@ -350,9 +357,19 @@ protected function getListQuery() } // Filter by featured. - $featured = (string) $this->getState('filter.featured'); + $featured = $this->isFeatured(); - if (\in_array($featured, ['0','1'])) + if ($featured === '1') + { + $query->select($db->quoteName('fp.ordering')); + $defaultOrdering = 'fp.ordering'; + } + else + { + $defaultOrdering = 'a.id'; + } + + if (\in_array($featured, ['0', '1'])) { $featured = (int) $featured; $query->where($db->quoteName('a.featured') . ' = :featured') @@ -561,7 +578,7 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderCol = $this->state->get('list.ordering', $defaultOrdering); $orderDirn = $this->state->get('list.direction', 'DESC'); if ($orderCol === 'a.ordering' || $orderCol === 'category_title') @@ -715,4 +732,16 @@ public function getItems() return $items; } + + /** + * Method to get the value of featured selector. + * + * @return string Returns the value of featured selector. + * + * @since __DEPLOY_VERSION__ + */ + public function isFeatured() + { + return $this->getUserStateFromRequest($this->context . '.featured', 'featured', 'int'); + } } diff --git a/administrator/components/com_content/src/Model/FeaturedModel.php b/administrator/components/com_content/src/Model/FeaturedModel.php deleted file mode 100644 index 450cd74507972..0000000000000 --- a/administrator/components/com_content/src/Model/FeaturedModel.php +++ /dev/null @@ -1,101 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -namespace Joomla\Component\Content\Administrator\Model; - -\defined('_JEXEC') or die; - -/** - * Methods supporting a list of featured article records. - * - * @since 1.6 - */ -class FeaturedModel extends ArticlesModel -{ - /** - * Constructor. - * - * @param array $config An optional associative array of configuration settings. - * - * @see \Joomla\CMS\MVC\Controller\BaseController - * @since 1.6 - */ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( - 'id', 'a.id', - 'title', 'a.title', - 'alias', 'a.alias', - 'checked_out', 'a.checked_out', - 'checked_out_time', 'a.checked_out_time', - 'catid', 'a.catid', 'category_title', - 'state', 'a.state', - 'access', 'a.access', 'access_level', - 'created', 'a.created', - 'created_by', 'a.created_by', - 'created_by_alias', 'a.created_by_alias', - 'ordering', 'a.ordering', - 'featured_up', 'fp.featured_up', - 'featured_down', 'fp.featured_down', - 'language', 'a.language', - 'hits', 'a.hits', - 'publish_up', 'a.publish_up', - 'publish_down', 'a.publish_down', - 'fp.ordering', - 'published', 'a.published', - 'author_id', - 'category_id', - 'level', - 'tag', - 'rating_count', 'rating', - 'ws.title', - ); - } - - parent::__construct($config); - } - - /** - * Method to auto-populate the model state. - * - * Note. Calling getState in this method will result in recursion. - * - * @param string $ordering An optional ordering field. - * @param string $direction An optional direction (asc|desc). - * - * @return void - * - * @since 3.5 - */ - protected function populateState($ordering = 'a.title', $direction = 'asc') - { - parent::populateState($ordering, $direction); - - // Filter by featured articles. - $this->setState('filter.featured', 1); - } - - /** - * Build an SQL query to load the list data. - * - * @return \Joomla\Database\DatabaseQuery - * - * @since 4.0.0 - */ - protected function getListQuery() - { - $query = parent::getListQuery(); - - $query->select($this->getDbo()->quoteName('fp.ordering')); - - return $query; - } -} diff --git a/administrator/components/com_content/src/View/Articles/HtmlView.php b/administrator/components/com_content/src/View/Articles/HtmlView.php index deb7a7c86b6fd..20084e66b4e4c 100644 --- a/administrator/components/com_content/src/View/Articles/HtmlView.php +++ b/administrator/components/com_content/src/View/Articles/HtmlView.php @@ -96,6 +96,7 @@ public function display($tpl = null) $this->activeFilters = $this->get('ActiveFilters'); $this->vote = PluginHelper::isEnabled('content', 'vote'); $this->hits = ComponentHelper::getParams('com_content')->get('record_hits', 1); + $featured = $this->state->get('filter.featured'); if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) { @@ -110,7 +111,7 @@ public function display($tpl = null) } // Check for errors. - if (\count($errors = $this->get('Errors')) || $this->transitions === false) + if (\count($errors = $this->get('Errors')) || ($this->transitions === false && $featured === '1')) { throw new GenericDataException(implode("\n", $errors), 500); } @@ -129,8 +130,10 @@ public function display($tpl = null) } else { - // In article associations modal we need to remove language filter if forcing a language. - // We also need to change the category filter to show show categories with All or the forced language. + /** + * In article associations modal we need to remove language filter if forcing a language. + * We also need to change the category filter to show categories with All or the forced language. + */ if ($forcedLanguage = Factory::getApplication()->input->get('forcedLanguage', '', 'CMD')) { // If the language is forced we can't allow to select the language, so transform the language selector filter into a hidden field. @@ -157,13 +160,21 @@ public function display($tpl = null) */ protected function addToolbar() { - $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id')); - $user = Factory::getApplication()->getIdentity(); + $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id')); + $user = Factory::getApplication()->getIdentity(); + $featured = $this->state->get('filter.featured'); // Get the toolbar object instance $toolbar = Toolbar::getInstance('toolbar'); - ToolbarHelper::title(Text::_('COM_CONTENT_ARTICLES_TITLE'), 'copy article'); + if ($featured === '1') + { + ToolbarHelper::title(Text::_('COM_CONTENT_FEATURED_TITLE'), 'star featured'); + } + else + { + ToolbarHelper::title(Text::_('COM_CONTENT_ARTICLES_TITLE'), 'copy article'); + } if ($canDo->get('core.create') || \count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) { @@ -210,15 +221,24 @@ protected function addToolbar() $childBar->unpublish('articles.unpublish')->listCheck(true); - $childBar->standardButton('featured') - ->text('JFEATURE') - ->task('articles.featured') - ->listCheck(true); - - $childBar->standardButton('unfeatured') - ->text('JUNFEATURE') - ->task('articles.unfeatured') - ->listCheck(true); + if (!ComponentHelper::getParams('com_content')->get('workflow_enabled')) + { + if ($featured !== '1') + { + $childBar->standardButton('featured') + ->text('JFEATURE') + ->task('articles.featured') + ->listCheck(true); + } + + if ($featured !== '0') + { + $childBar->standardButton('circle') + ->text('JUNFEATURE') + ->task('articles.unfeatured') + ->listCheck(true); + } + } $childBar->archive('articles.archive')->listCheck(true); @@ -233,7 +253,8 @@ protected function addToolbar() // Add a batch button if ($user->authorise('core.create', 'com_content') && $user->authorise('core.edit', 'com_content') - && $user->authorise('core.execute.transition', 'com_content')) + && $user->authorise('core.execute.transition', 'com_content') + && $featured !== '1') { $childBar->popupButton('batch') ->text('JTOOLBAR_BATCH') @@ -255,6 +276,6 @@ protected function addToolbar() $toolbar->preferences('com_content'); } - $toolbar->help('Articles'); + $toolbar->help('JHELP_CONTENT_ARTICLE_MANAGER'); } } diff --git a/administrator/components/com_content/src/View/Featured/HtmlView.php b/administrator/components/com_content/src/View/Featured/HtmlView.php deleted file mode 100644 index ca034b3767112..0000000000000 --- a/administrator/components/com_content/src/View/Featured/HtmlView.php +++ /dev/null @@ -1,223 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -namespace Joomla\Component\Content\Administrator\View\Featured; - -\defined('_JEXEC') or die; - -use Joomla\CMS\Component\ComponentHelper; -use Joomla\CMS\Factory; -use Joomla\CMS\Language\Multilanguage; -use Joomla\CMS\Language\Text; -use Joomla\CMS\MVC\View\GenericDataException; -use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; -use Joomla\CMS\Plugin\PluginHelper; -use Joomla\CMS\Toolbar\Toolbar; -use Joomla\CMS\Toolbar\ToolbarHelper; -use Joomla\Component\Content\Administrator\Extension\ContentComponent; -use Joomla\Component\Content\Administrator\Helper\ContentHelper; - -/** - * View class for a list of featured articles. - * - * @since 1.6 - */ -class HtmlView extends BaseHtmlView -{ - /** - * An array of items - * - * @var array - */ - protected $items; - - /** - * The pagination object - * - * @var \Joomla\CMS\Pagination\Pagination - */ - protected $pagination; - - /** - * The model state - * - * @var \Joomla\CMS\Object\CMSObject - */ - protected $state; - - /** - * Form object for search filters - * - * @var \Joomla\CMS\Form\Form - */ - public $filterForm; - - /** - * The active search filters - * - * @var array - */ - public $activeFilters; - - /** - * All transition, which can be executed of one if the items - * - * @var array - */ - protected $transitions = []; - - /** - * Is this view an Empty State - * - * @var boolean - * @since 4.0.0 - */ - private $isEmptyState = false; - - /** - * Display the view - * - * @param string $tpl The name of the template file to parse; automatically searches through the template paths. - * - * @return void - */ - public function display($tpl = null) - { - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - $this->state = $this->get('State'); - $this->filterForm = $this->get('FilterForm'); - $this->activeFilters = $this->get('ActiveFilters'); - $this->vote = PluginHelper::isEnabled('content', 'vote'); - $this->hits = ComponentHelper::getParams('com_content')->get('record_hits', 1); - - if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) - { - $this->setLayout('emptystate'); - } - - if (ComponentHelper::getParams('com_content')->get('workflow_enabled')) - { - PluginHelper::importPlugin('workflow'); - - $this->transitions = $this->get('Transitions'); - } - - // Check for errors. - if (\count($errors = $this->get('Errors'))) - { - throw new GenericDataException(implode("\n", $errors), 500); - } - - $this->addToolbar(); - - // We do not need to filter by language when multilingual is disabled - if (!Multilanguage::isEnabled()) - { - unset($this->activeFilters['language']); - $this->filterForm->removeField('language', 'filter'); - } - - parent::display($tpl); - } - - /** - * Add the page title and toolbar. - * - * @return void - * - * @since 1.6 - */ - protected function addToolbar() - { - $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id')); - $user = Factory::getApplication()->getIdentity(); - - // Get the toolbar object instance - $toolbar = Toolbar::getInstance('toolbar'); - - ToolbarHelper::title(Text::_('COM_CONTENT_FEATURED_TITLE'), 'star featured'); - - if ($canDo->get('core.create') || \count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) - { - $toolbar->addNew('article.add'); - } - - if (!$this->isEmptyState && ($canDo->get('core.edit.state') || \count($this->transitions))) - { - $dropdown = $toolbar->dropdownButton('status-group') - ->text('JTOOLBAR_CHANGE_STATUS') - ->toggleSplit(false) - ->icon('icon-ellipsis-h') - ->buttonClass('btn btn-action') - ->listCheck(true); - - $childBar = $dropdown->getChildToolbar(); - - if (\count($this->transitions)) - { - $childBar->separatorButton('transition-headline') - ->text('COM_CONTENT_RUN_TRANSITIONS') - ->buttonClass('text-center py-2 h3'); - - $cmd = "Joomla.submitbutton('articles.runTransition');"; - $messages = "{error: [Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}"; - $alert = 'Joomla.renderMessages(' . $messages . ')'; - $cmd = 'if (document.adminForm.boxchecked.value == 0) { ' . $alert . ' } else { ' . $cmd . ' }'; - - foreach ($this->transitions as $transition) - { - $childBar->standardButton('transition') - ->text($transition['text']) - ->buttonClass('transition-' . (int) $transition['value']) - ->icon('icon-project-diagram') - ->onclick('document.adminForm.transition_id.value=' . (int) $transition['value'] . ';' . $cmd); - } - - $childBar->separatorButton('transition-separator'); - } - - if ($canDo->get('core.edit.state')) - { - $childBar->publish('articles.publish')->listCheck(true); - - $childBar->unpublish('articles.unpublish')->listCheck(true); - - $childBar->standardButton('unfeatured') - ->text('JUNFEATURE') - ->task('articles.unfeatured') - ->listCheck(true); - - $childBar->archive('articles.archive')->listCheck(true); - - $childBar->checkin('articles.checkin')->listCheck(true); - - if (!$this->state->get('filter.published') == ContentComponent::CONDITION_TRASHED) - { - $childBar->trash('articles.trash')->listCheck(true); - } - } - } - - if (!$this->isEmptyState && $this->state->get('filter.published') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete')) - { - $toolbar->delete('articles.delete') - ->text('JTOOLBAR_EMPTY_TRASH') - ->message('JGLOBAL_CONFIRM_DELETE') - ->listCheck(true); - } - - if ($user->authorise('core.admin', 'com_content') || $user->authorise('core.options', 'com_content')) - { - $toolbar->preferences('com_content'); - } - - ToolbarHelper::help('Articles:_Featured'); - } -} diff --git a/administrator/components/com_content/tmpl/articles/default.php b/administrator/components/com_content/tmpl/articles/default.php index 599b0ec92372b..502fd8a44599c 100644 --- a/administrator/components/com_content/tmpl/articles/default.php +++ b/administrator/components/com_content/tmpl/articles/default.php @@ -34,7 +34,9 @@ $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$saveOrder = $listOrder == 'a.ordering'; +$featured = $this->state->get('filter.featured'); +$orderName = $featured === '1' ? 'fp.ordering' : 'a.ordering'; +$saveOrder = $listOrder == $orderName; if (strpos($listOrder, 'publish_up') !== false) { @@ -98,7 +100,7 @@
$this)); + echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => ['selectorFieldName' => 'featured'])); ?> items)) : ?>
@@ -108,7 +110,7 @@ @@ -118,15 +120,15 @@ - +
- , + , ,
- + - - + + - + @@ -174,6 +176,9 @@ class="js-draggable" data-url="" data-direction="" data-nested="true"> items as $i => $item) : $item->max_ordering = 0; + $ordering = ($listOrder == 'fp.ordering'); + $assetId = 'com_content.article.' . $item->id; + $canCreate = $user->authorise('core.create', 'com_content.category.' . $item->catid); $canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out); $canEditOwn = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId; @@ -389,19 +394,30 @@ pagination->getListFooter(); ?> - - authorise('core.create', 'com_content') - && $user->authorise('core.edit', 'com_content') - && $user->authorise('core.edit.state', 'com_content')) : ?> + Text::_('COM_CONTENT_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer'), - ), - $this->loadTemplate('batch_body') + 'stageModal', + [ + 'title' => Text::_('JTOOLBAR_CHANGE_STATUS'), + 'footer' => $this->loadTemplate('stage_footer'), + ], + $this->loadTemplate('stage_body') ); ?> + + authorise('core.create', 'com_content') + && $user->authorise('core.edit', 'com_content') + && $user->authorise('core.edit.state', 'com_content')) : ?> + Text::_('COM_CONTENT_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer'), + ], + $this->loadTemplate('batch_body') + ); ?> + diff --git a/administrator/components/com_content/tmpl/featured/default_stage_body.php b/administrator/components/com_content/tmpl/articles/default_stage_body.php similarity index 100% rename from administrator/components/com_content/tmpl/featured/default_stage_body.php rename to administrator/components/com_content/tmpl/articles/default_stage_body.php diff --git a/administrator/components/com_content/tmpl/featured/default_stage_footer.php b/administrator/components/com_content/tmpl/articles/default_stage_footer.php similarity index 100% rename from administrator/components/com_content/tmpl/featured/default_stage_footer.php rename to administrator/components/com_content/tmpl/articles/default_stage_footer.php diff --git a/administrator/components/com_content/tmpl/featured/default.php b/administrator/components/com_content/tmpl/featured/default.php deleted file mode 100644 index 5ca431d64fe21..0000000000000 --- a/administrator/components/com_content/tmpl/featured/default.php +++ /dev/null @@ -1,419 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Button\FeaturedButton; -use Joomla\CMS\Button\PublishedButton; -use Joomla\CMS\Button\TransitionButton; -use Joomla\CMS\Component\ComponentHelper; -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; -use Joomla\Component\Content\Administrator\Helper\ContentHelper; -use Joomla\Utilities\ArrayHelper; - -/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */ -$wa = $this->document->getWebAssetManager(); -$wa->useScript('table.columns') - ->useScript('multiselect'); - -$app = Factory::getApplication(); -$user = Factory::getUser(); -$userId = $user->get('id'); -$listOrder = $this->escape($this->state->get('list.ordering')); -$listDirn = $this->escape($this->state->get('list.direction')); -$saveOrder = $listOrder == 'fp.ordering'; - -if (strpos($listOrder, 'publish_up') !== false) -{ - $orderingColumn = 'publish_up'; -} -elseif (strpos($listOrder, 'publish_down') !== false) -{ - $orderingColumn = 'publish_down'; -} -elseif (strpos($listOrder, 'modified') !== false) -{ - $orderingColumn = 'modified'; -} -else -{ - $orderingColumn = 'created'; -} - - -if ($saveOrder && !empty($this->items)) -{ - $saveOrderingUrl = 'index.php?option=com_content&task=featured.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1'; - HTMLHelper::_('draggablelist.draggable'); -} - -$workflow_enabled = ComponentHelper::getParams('com_content')->get('workflow_enabled'); -$workflow_state = false; -$workflow_featured = false; - -if ($workflow_enabled) : - -// @todo move the script to a file -$js = <<getRegistry()->addExtensionRegistryFile('com_workflow'); -$wa->useScript('com_workflow.admin-items-workflow-buttons') - ->addInlineScript($js, [], ['type' => 'module']); - -$workflow_state = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.state', 'com_content.article'); -$workflow_featured = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.featured', 'com_content.article'); - -endif; - -$assoc = Associations::isEnabled(); - -?> - -
-
-
-
- $this)); - ?> - items)) : ?> -
- - -
- - - - - - - - - - - - - - - - - - - - - - - hits) : ?> - - - vote) : ?> - - - - - - - class="js-draggable" data-url="" data-direction=""> - items); ?> - items as $i => $item) : - $item->max_ordering = 0; - $ordering = ($listOrder == 'fp.ordering'); - $assetId = 'com_content.article.' . $item->id; - $canCreate = $user->authorise('core.create', 'com_content.category.' . $item->catid); - $canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id); - $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out); - $canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin; - $canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid); - $canEditOwnCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId; - $canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id); - $canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId; - - $transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id); - - $transition_ids = ArrayHelper::getColumn($transitions, 'value'); - $transition_ids = ArrayHelper::toInteger($transition_ids); - - ?> - - - - - - - - - - - - - - - - - - - hits) : ?> - - - vote) : ?> - - - - - - - -
- , - , - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- id, false, 'cid', 'cb', $item->title); ?> - - - - - - - - - - $transitions, - 'title' => Text::_($item->stage_title), - 'tip_content' => Text::sprintf('JWORKFLOW', Text::_($item->workflow_title)), - 'id' => 'workflow-' . $item->id, - 'task' => 'articles.runTransitions' - ]; - - echo (new TransitionButton($options)) - ->render(0, $i); - ?> - - 'articles.', - 'disabled' => $workflow_featured || !$canChange, - 'id' => 'featured-' . $item->id - ]; - - echo (new FeaturedButton) - ->render((int) $item->featured, $i, $options, $item->featured_up, $item->featured_down); - ?> - - 'articles.', - 'disabled' => $workflow_state || !$canChange, - 'id' => 'state-' . $item->id - ]; - - echo (new PublishedButton)->render((int) $item->state, $i, $options, $item->publish_up, $item->publish_down); - ?> - -
- checked_out) : ?> - editor, $item->checked_out_time, 'articles.', $canCheckin); ?> - - - - escape($item->title); ?> - - escape($item->title); ?> - -
- note)) : ?> - escape($item->alias)); ?> - - escape($item->alias), $this->escape($item->note)); ?> - -
-
- parent_category_id . '&extension=com_content'); - $CurrentCatUrl = Route::_('index.php?option=com_categories&task=category.edit&id=' . $item->catid . '&extension=com_content'); - $EditCatTxt = Text::_('COM_CONTENT_EDIT_CATEGORY'); - echo Text::_('JCATEGORY') . ': '; - if ($item->category_level != '1') : - if ($item->parent_category_level != '1') : - echo ' » '; - endif; - endif; - if (Factory::getLanguage()->isRtl()) - { - if ($canEditCat || $canEditOwnCat) : - echo ''; - endif; - echo $this->escape($item->category_title); - if ($canEditCat || $canEditOwnCat) : - echo ''; - endif; - if ($item->category_level != '1') : - echo ' « '; - if ($canEditParCat || $canEditOwnParCat) : - echo ''; - endif; - echo $this->escape($item->parent_category_title); - if ($canEditParCat || $canEditOwnParCat) : - echo ''; - endif; - endif; - } - else - { - if ($item->category_level != '1') : - if ($canEditParCat || $canEditOwnParCat) : - echo ''; - endif; - echo $this->escape($item->parent_category_title); - if ($canEditParCat || $canEditOwnParCat) : - echo ''; - endif; - echo ' » '; - endif; - if ($canEditCat || $canEditOwnCat) : - echo ''; - endif; - echo $this->escape($item->category_title); - if ($canEditCat || $canEditOwnCat) : - echo ''; - endif; - } - ?> -
-
-
- escape($item->access_level); ?> - - created_by != 0) : ?> - - escape($item->author_name); ?> - - - - - created_by_alias) : ?> -
escape($item->created_by_alias)); ?>
- -
- association) : ?> - id); ?> - - - - - {$orderingColumn}; - echo $date > 0 ? HTMLHelper::_('date', $date, Text::_('DATE_FORMAT_LC4')) : '-'; - ?> - - - hits; ?> - - - - rating_count; ?> - - - - rating; ?> - - - id; ?> -
- - - pagination->getListFooter(); ?> - - Text::_('JTOOLBAR_CHANGE_STATUS'), - 'footer' => $this->loadTemplate('stage_footer'), - ), - $this->loadTemplate('stage_body') - ); ?> - - - - - - - - - - - -
-
-
-
diff --git a/administrator/components/com_content/tmpl/featured/default.xml b/administrator/components/com_content/tmpl/featured/default.xml deleted file mode 100644 index 4697ce1704542..0000000000000 --- a/administrator/components/com_content/tmpl/featured/default.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/administrator/components/com_content/tmpl/featured/emptystate.php b/administrator/components/com_content/tmpl/featured/emptystate.php deleted file mode 100644 index 99bc733f48366..0000000000000 --- a/administrator/components/com_content/tmpl/featured/emptystate.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Factory; -use Joomla\CMS\Layout\LayoutHelper; - -$displayData = [ - 'textPrefix' => 'COM_CONTENT', - 'formURL' => 'index.php?option=com_content&view=featured', - 'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Adding_a_new_article', -]; - -$user = Factory::getApplication()->getIdentity(); - -if ($user->authorise('core.create', 'com_content') || count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) -{ - $displayData['createURL'] = 'index.php?option=com_content&task=article.add'; -} - -echo LayoutHelper::render('joomla.content.emptystate', $displayData); diff --git a/administrator/components/com_menus/presets/alternate.xml b/administrator/components/com_menus/presets/alternate.xml index 8b4e74c23498e..2732873a60560 100644 --- a/administrator/components/com_menus/presets/alternate.xml +++ b/administrator/components/com_menus/presets/alternate.xml @@ -294,7 +294,7 @@ title="COM_CONTENT_MENUS_FEATURED" type="component" element="com_content" - link="index.php?option=com_content&view=featured" + link="index.php?option=com_content&view=articles&featured=1" />