diff --git a/administrator/components/com_admin/sql/updates/mysql/6.0.0-2024-06-01.sql b/administrator/components/com_admin/sql/updates/mysql/6.0.0-2024-06-01.sql deleted file mode 100644 index 8394d2b2098f2..0000000000000 --- a/administrator/components/com_admin/sql/updates/mysql/6.0.0-2024-06-01.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This file is a dummy which can be removed or renamed and filled with content --- when the first update SQL script for Joomla 6 will be added. diff --git a/administrator/components/com_admin/sql/updates/mysql/6.0.0-2024-08-11.sql b/administrator/components/com_admin/sql/updates/mysql/6.0.0-2024-08-11.sql new file mode 100644 index 0000000000000..fa9269cf76003 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/6.0.0-2024-08-11.sql @@ -0,0 +1,6 @@ +-- Update link to featured + +UPDATE `#__menu` +SET `link` = 'index.php?option=com_content&view=articles&filter[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/6.0.0-2024-06-01.sql b/administrator/components/com_admin/sql/updates/postgresql/6.0.0-2024-06-01.sql deleted file mode 100644 index 8394d2b2098f2..0000000000000 --- a/administrator/components/com_admin/sql/updates/postgresql/6.0.0-2024-06-01.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This file is a dummy which can be removed or renamed and filled with content --- when the first update SQL script for Joomla 6 will be added. diff --git a/administrator/components/com_admin/sql/updates/postgresql/6.0.0-2024-08-11.sql b/administrator/components/com_admin/sql/updates/postgresql/6.0.0-2024-08-11.sql new file mode 100644 index 0000000000000..e6fba47a2cfaa --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/6.0.0-2024-08-11.sql @@ -0,0 +1,6 @@ +-- Update link to featured + +UPDATE "#__menu" +SET "link" = 'index.php?option=com_content&view=articles&filter[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 a79e0f62f4c76..129e938ade06d 100644 --- a/administrator/components/com_content/forms/filter_articles.xml +++ b/administrator/components/com_content/forms/filter_articles.xml @@ -14,8 +14,8 @@ name="featured" type="list" label="JFEATURED" + filtermode="selector" class="js-select-submit-on-change" - default="" validate="options" > diff --git a/administrator/components/com_content/forms/filter_featured.xml b/administrator/components/com_content/forms/filter_featured.xml deleted file mode 100644 index 8e4a479156c83..0000000000000 --- a/administrator/components/com_content/forms/filter_featured.xml +++ /dev/null @@ -1,152 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/administrator/components/com_content/presets/content.xml b/administrator/components/com_content/presets/content.xml index 214cf4c8ce64c..3b64b9cbb73da 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&filter[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 dc86b71f090e5..485864b1b78e1 100644 --- a/administrator/components/com_content/src/Controller/ArticlesController.php +++ b/administrator/components/com_content/src/Controller/ArticlesController.php @@ -16,6 +16,7 @@ use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\Response\JsonResponse; use Joomla\CMS\Router\Route; +use Joomla\Component\Content\Administrator\Model\ArticlesModel; use Joomla\Input\Input; use Joomla\Utilities\ArrayHelper; @@ -145,9 +146,7 @@ public function getQuickiconContent() { $model = $this->getModel('articles'); - $model->setState('filter.published', 1); - - $amount = (int) $model->getTotal(); + $amount = (int) $model->getTotal($featured = ''); $result = []; @@ -157,4 +156,31 @@ public function getQuickiconContent() echo new JsonResponse($result); } + + /** + * Method to get the number of published featured articles for quickicons + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function getQuickiconFeatured() + { + /** + * @var ArticlesModel $model + */ + $model = $this->getModel('articles'); + + $model->setState('filter.featured', '1'); + + $amount = (int) $model->getTotal(); + + $result = []; + + $result['amount'] = $amount; + $result['sronly'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON_SRONLY', $amount); + $result['name'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON', $amount); + + echo new JsonResponse($result); + } } diff --git a/administrator/components/com_content/src/Controller/DisplayController.php b/administrator/components/com_content/src/Controller/DisplayController.php index 158c8f3a17ce3..1afb8032bd43d 100644 --- a/administrator/components/com_content/src/Controller/DisplayController.php +++ b/administrator/components/com_content/src/Controller/DisplayController.php @@ -62,6 +62,11 @@ public function display($cachable = false, $urlparams = []) return false; } + if ($view === 'featured' || $this->input->getInt('featured')) { + $this->setRedirect(Route::_('index.php?option=com_content&view=articles&filter[featured]=1', false)); + return false; + } + return parent::display(); } } diff --git a/administrator/components/com_content/src/Controller/FeaturedController.php b/administrator/components/com_content/src/Controller/FeaturedController.php index 92756c9fc89c6..021c7b92bba5c 100644 --- a/administrator/components/com_content/src/Controller/FeaturedController.php +++ b/administrator/components/com_content/src/Controller/FeaturedController.php @@ -6,13 +6,12 @@ * * @copyright (C) 2009 Open Source Matters, Inc. * @license GNU General Public License version 2 or later; see LICENSE.txt + * + * @deprecated 6.0 will be removed in 8.0 */ namespace Joomla\Component\Content\Administrator\Controller; -use Joomla\CMS\Language\Text; -use Joomla\CMS\Response\JsonResponse; - // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects @@ -21,107 +20,11 @@ * Featured content controller class. * * @since 1.6 + * + * @deprecated 6.0 will be removed in 8.0 + * Use \Joomla\Component\Content\Administrator\Controller\ArticlesController instead + * For Quickicons use articles.getQuickiconFeatured() */ 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 = (array) $this->input->get('cid', [], 'int'); - - // Access checks. - foreach ($ids as $i => $id) { - // Remove zero value resulting from input filter - if ($id === 0) { - unset($ids[$i]); - - continue; - } - - 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 = ['ignore_request' => true]) - { - return parent::getModel($name, $prefix, $config); - } - - /** - * Method to get the number of published featured articles for quickicons - * - * @return void - * - * @since 4.3.0 - */ - public function getQuickiconContent() - { - $model = $this->getModel('articles'); - - $model->setState('filter.published', 1); - $model->setState('filter.featured', 1); - - $amount = (int) $model->getTotal(); - - $result = []; - - $result['amount'] = $amount; - $result['sronly'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON_SRONLY', $amount); - $result['name'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON', $amount); - - echo new JsonResponse($result); - } } diff --git a/administrator/components/com_content/src/Model/ArticlesModel.php b/administrator/components/com_content/src/Model/ArticlesModel.php index dfa545d0ad7bd..d526d9699acbe 100644 --- a/administrator/components/com_content/src/Model/ArticlesModel.php +++ b/administrator/components/com_content/src/Model/ArticlesModel.php @@ -76,6 +76,7 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null) 'rating_count', 'rating', 'stage', 'wa.stage_id', 'ws.title', + 'fp.ordering', ]; if (Associations::isEnabled()) { @@ -175,6 +176,7 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.search'); $id .= ':' . serialize($this->getState('filter.access')); $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.featured'); $id .= ':' . serialize($this->getState('filter.category_id')); $id .= ':' . serialize($this->getState('filter.author_id')); $id .= ':' . $this->getState('filter.language'); @@ -310,12 +312,22 @@ protected function getListQuery() } // Filter by featured. - $featured = (string) $this->getState('filter.featured'); + $featured = $this->getState('filter.featured'); - if (\in_array($featured, ['0','1'])) { + $defaultOrdering = 'a.id'; + + if (is_numeric($featured) && \in_array($featured, [0, 1])) { $featured = (int) $featured; $query->where($db->quoteName('a.featured') . ' = :featured') ->bind(':featured', $featured, ParameterType::INTEGER); + + $query->where($db->quoteName('a.featured') . ' = :featured') + ->bind(':featured', $featured, ParameterType::INTEGER); + + if ($featured) { + $query->select($db->quoteName('fp.ordering')); + $defaultOrdering = 'fp.ordering'; + } } // Filter by access level on categories. @@ -493,7 +505,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') { 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 4491380af7a88..0000000000000 --- a/administrator/components/com_content/src/Model/FeaturedModel.php +++ /dev/null @@ -1,107 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -namespace Joomla\Component\Content\Administrator\Model; - -use Joomla\CMS\MVC\Factory\MVCFactoryInterface; -use Joomla\Database\QueryInterface; - -// phpcs:disable PSR1.Files.SideEffects -\defined('_JEXEC') or die; -// phpcs:enable PSR1.Files.SideEffects - -/** - * 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. - * @param ?MVCFactoryInterface $factory The factory. - * - * @see \Joomla\CMS\MVC\Controller\BaseController - * @since 1.6 - */ - public function __construct($config = [], ?MVCFactoryInterface $factory = null) - { - if (empty($config['filter_fields'])) { - $config['filter_fields'] = [ - '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, $factory); - } - - /** - * 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 QueryInterface - * - * @since 4.0.0 - */ - protected function getListQuery() - { - $query = parent::getListQuery(); - - $query->select($this->getDatabase()->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 0cee1695afe44..2500dd2ff8a58 100644 --- a/administrator/components/com_content/src/View/Articles/HtmlView.php +++ b/administrator/components/com_content/src/View/Articles/HtmlView.php @@ -131,6 +131,7 @@ public function display($tpl = null) } // Check for errors. + if (\count($errors = $model->getErrors()) || $this->transitions === false) { throw new GenericDataException(implode("\n", $errors), 500); } @@ -181,9 +182,9 @@ public function display($tpl = null) */ protected function addToolbar() { - $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id')); - $user = $this->getCurrentUser(); - $toolbar = $this->getDocument()->getToolbar(); + $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id')); + $user = $this->getCurrentUser(); + $toolbar = $this->getDocument()->getToolbar(); ToolbarHelper::title(Text::_('COM_CONTENT_ARTICLES_TITLE'), 'copy article'); @@ -227,11 +228,9 @@ protected function addToolbar() $childBar->unpublish('articles.unpublish')->listCheck(true); - $childBar->standardButton('featured', 'JFEATURE', 'articles.featured') - ->listCheck(true); + $childBar->standardButton('featured', 'JFEATURE', 'articles.featured')->listCheck(true); - $childBar->standardButton('unfeatured', 'JUNFEATURE', 'articles.unfeatured') - ->listCheck(true); + $childBar->standardButton('unfeatured', 'JUNFEATURE', 'articles.unfeatured')->listCheck(true); $childBar->archive('articles.archive')->listCheck(true); diff --git a/administrator/components/com_content/src/View/Featured/HtmlView.php b/administrator/components/com_content/src/View/Featured/HtmlView.php index 8cf0f4f49dda2..7a7730b551e35 100644 --- a/administrator/components/com_content/src/View/Featured/HtmlView.php +++ b/administrator/components/com_content/src/View/Featured/HtmlView.php @@ -10,17 +10,7 @@ namespace Joomla\Component\Content\Administrator\View\Featured; -use Joomla\CMS\Component\ComponentHelper; -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\Button\DropdownButton; -use Joomla\CMS\Toolbar\ToolbarHelper; -use Joomla\Component\Content\Administrator\Extension\ContentComponent; -use Joomla\Component\Content\Administrator\Helper\ContentHelper; -use Joomla\Component\Content\Administrator\Model\FeaturedModel; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -30,181 +20,9 @@ * View class for a list of featured articles. * * @since 1.6 + * + * @deprecated 6.0 will be removed in 8.0 is integrated in Articles view */ 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\Registry\Registry - */ - 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) - { - /** @var FeaturedModel $model */ - $model = $this->getModel(); - - $this->items = $model->getItems(); - $this->pagination = $model->getPagination(); - $this->state = $model->getState(); - $this->filterForm = $model->getFilterForm(); - $this->activeFilters = $model->getActiveFilters(); - $this->vote = PluginHelper::isEnabled('content', 'vote'); - $this->hits = ComponentHelper::getParams('com_content')->get('record_hits', 1); - - if (!\count($this->items) && $this->isEmptyState = $model->getIsEmptyState()) { - $this->setLayout('emptystate'); - } - - if (ComponentHelper::getParams('com_content')->get('workflow_enabled')) { - PluginHelper::importPlugin('workflow'); - - $this->transitions = $model->getTransitions(); - } - - // Check for errors. - if (\count($errors = $model->getErrors())) { - 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 = $this->getCurrentUser(); - $toolbar = $this->getDocument()->getToolbar(); - - 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))) { - /** @var DropdownButton $dropdown */ - $dropdown = $toolbar->dropdownButton('status-group', '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', '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', $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', 'JUNFEATURE') - ->task('articles.unfeatured') - ->listCheck(true); - - $childBar->archive('articles.archive')->listCheck(true); - $childBar->checkin('articles.checkin'); - - 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', 'JTOOLBAR_DELETE_FROM_TRASH') - ->message('JGLOBAL_CONFIRM_DELETE') - ->listCheck(true); - } - - if ($user->authorise('core.admin', 'com_content') || $user->authorise('core.options', 'com_content')) { - $toolbar->preferences('com_content'); - } - - $toolbar->help('Articles:_Featured'); - } } diff --git a/administrator/components/com_content/tmpl/articles/default.php b/administrator/components/com_content/tmpl/articles/default.php index 862896a10057c..5db2d18bf0946 100644 --- a/administrator/components/com_content/tmpl/articles/default.php +++ b/administrator/components/com_content/tmpl/articles/default.php @@ -37,7 +37,9 @@ $userId = $user->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) { $orderingColumn = 'publish_up'; @@ -78,7 +80,7 @@
$this]); + echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this, 'options' => ['selectorFieldName' => 'featured']]); ?> items)) : ?>
@@ -88,7 +90,7 @@ @@ -98,15 +100,15 @@ - +
- , + , ,
- + - - + + - + @@ -156,6 +158,9 @@ endif; ?>> 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; 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 df58b6aa66b58..0000000000000 --- a/administrator/components/com_content/tmpl/featured/default.php +++ /dev/null @@ -1,400 +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\Component\Content\Administrator\View\Featured\HtmlView $this */ - -/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */ -$wa = $this->getDocument()->getWebAssetManager(); -$wa->useScript('table.columns') - ->useScript('multiselect'); - -$app = Factory::getApplication(); -$user = $this->getCurrentUser(); -$userId = $user->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) : - $wa->getRegistry()->addExtensionRegistryFile('com_workflow'); - $wa->useScript('com_workflow.admin-items-workflow-buttons') - ->useScript('com_content.articles-status'); - - $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.runTransition' - ]; - - echo (new TransitionButton($options)) - ->render(0, $i); - ?> -
- stage_title); ?> -
-
- '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, - 'category_published' => $item->category_published - ]; - - 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 ($this->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; - } - if ($item->category_published < '1') : - echo $item->category_published == '0' ? ' (' . Text::_('JUNPUBLISHED') . ')' : ' (' . Text::_('JTRASHED') . ')'; - 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 34a2929f6e8e1..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/default_stage_body.php b/administrator/components/com_content/tmpl/featured/default_stage_body.php deleted file mode 100644 index d5f510e40a892..0000000000000 --- a/administrator/components/com_content/tmpl/featured/default_stage_body.php +++ /dev/null @@ -1,25 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -?> - -
-
-
-

-
-
-
-
-
diff --git a/administrator/components/com_content/tmpl/featured/default_stage_footer.php b/administrator/components/com_content/tmpl/featured/default_stage_footer.php deleted file mode 100644 index 8c6d2bfccdad4..0000000000000 --- a/administrator/components/com_content/tmpl/featured/default_stage_footer.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Language\Text; - -/** @var \Joomla\Component\Content\Administrator\View\Featured\HtmlView $this */ - -/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ -$wa = $this->getDocument()->getWebAssetManager(); -$wa->useScript('com_content.admin-articles-stage'); - -?> - - 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 3f20dbd6f98e9..0000000000000 --- a/administrator/components/com_content/tmpl/featured/emptystate.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Layout\LayoutHelper; - -/** @var \Joomla\Component\Content\Administrator\View\Featured\HtmlView $this */ - -$displayData = [ - 'textPrefix' => 'COM_CONTENT', - 'formURL' => 'index.php?option=com_content&view=featured', - 'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Adding_a_new_article', -]; - -$user = $this->getCurrentUser(); - -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 3f2a69d0b8d9f..8f824b0bceded 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&filter[featured]=1" /> diff --git a/administrator/modules/mod_quickicon/src/Helper/QuickIconHelper.php b/administrator/modules/mod_quickicon/src/Helper/QuickIconHelper.php index caad7839758ea..ba902e6402cd6 100644 --- a/administrator/modules/mod_quickicon/src/Helper/QuickIconHelper.php +++ b/administrator/modules/mod_quickicon/src/Helper/QuickIconHelper.php @@ -258,14 +258,14 @@ public function getButtons(Registry $params, ?CMSApplication $application = null if ($params->get('show_featured')) { $tmp = [ 'image' => 'icon-star featured', - 'link' => Route::_('index.php?option=com_content&view=featured'), + 'link' => Route::_('index.php?option=com_content&view=articles&filter[featured]=1'), 'name' => 'MOD_QUICKICON_FEATURED_MANAGER', 'access' => ['core.manage', 'com_content'], 'group' => 'MOD_QUICKICON_SITE', ]; if ($params->get('show_featured') == 2) { - $tmp['ajaxurl'] = 'index.php?option=com_content&task=featured.getQuickiconContent&format=json'; + $tmp['ajaxurl'] = 'index.php?option=com_content&task=articles.getQuickiconFeatured&format=json'; } $this->buttons[$key][] = $tmp;