Open joomlapl-bot opened 2 months ago
PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/43491 Poniżej zmiany w oryginale:
PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/43491 Poniżej zmiany w oryginale:
Click to expand the diff!
```diff diff --git a/administrator/components/com_scheduler/forms/filter_tasks.xml b/administrator/components/com_scheduler/forms/filter_tasks.xml index 78ad2ca21dca5..ce99fa07909d2 100644 --- a/administrator/components/com_scheduler/forms/filter_tasks.xml +++ b/administrator/components/com_scheduler/forms/filter_tasks.xml @@ -45,7 +45,7 @@ type="list" label="JGLOBAL_SORT_BY" class="js-select-submit-on-change" - default="a.title ASC" + default="a.next_execution ASC" validate="options" > @@ -59,6 +59,8 @@ + + diff --git a/administrator/components/com_scheduler/src/Model/TasksModel.php b/administrator/components/com_scheduler/src/Model/TasksModel.php index 15d41bb5764ab..ec1bbabe3dcf4 100644 --- a/administrator/components/com_scheduler/src/Model/TasksModel.php +++ b/administrator/components/com_scheduler/src/Model/TasksModel.php @@ -328,7 +328,7 @@ static function (TaskOption $taskOption): string { $multiOrdering = $this->state->get('list.multi_ordering'); if (!$multiOrdering || !\is_array($multiOrdering)) { - $orderCol = $this->state->get('list.ordering', 'a.title'); + $orderCol = $this->state->get('list.ordering', 'a.next_execution'); $orderDir = $this->state->get('list.direction', 'asc'); // Type title ordering is handled exceptionally in _getList() @@ -365,7 +365,7 @@ static function (TaskOption $taskOption): string { protected function _getList($query, $limitstart = 0, $limit = 0): array { // Get stuff from the model state - $listOrder = $this->getState('list.ordering', 'a.title'); + $listOrder = $this->getState('list.ordering', 'a.next_execution'); $listDirectionN = strtolower($this->getState('list.direction', 'asc')) === 'desc' ? -1 : 1; // Set limit parameters and get object list @@ -432,7 +432,7 @@ private function attachTaskOptions(array $items): void * @return void * @since 4.1.0 */ - protected function populateState($ordering = 'a.title', $direction = 'ASC'): void + protected function populateState($ordering = 'a.next_execution', $direction = 'ASC'): void { // Call the parent method parent::populateState($ordering, $direction); @@ -467,4 +467,15 @@ public function hasDueTasks(Date $time): bool // False if we don't have due tasks, or we have locked tasks return $taskDetails && $taskDetails->due_count && !$taskDetails->locked_count; } + + /** + * Check if we have right now any enabled due tasks and no locked tasks. + * + * @return boolean + * @since __DEPLOY_VERSION__ + */ + public function getHasDueTasks() + { + return $this->hasDueTasks(Factory::getDate('now', 'UTC')); + } } diff --git a/administrator/components/com_scheduler/src/View/Tasks/HtmlView.php b/administrator/components/com_scheduler/src/View/Tasks/HtmlView.php index 0934d91923a5f..828f486e46c61 100644 --- a/administrator/components/com_scheduler/src/View/Tasks/HtmlView.php +++ b/administrator/components/com_scheduler/src/View/Tasks/HtmlView.php @@ -97,6 +97,7 @@ public function display($tpl = null): void $this->state = $this->get('State'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); + $this->hasDueTasks = $this->get('hasDueTasks'); if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) { $this->setLayout('empty_state'); diff --git a/administrator/components/com_scheduler/tmpl/tasks/default.php b/administrator/components/com_scheduler/tmpl/tasks/default.php index 93d538ff17dfc..60ef2e27c9295 100644 --- a/administrator/components/com_scheduler/tmpl/tasks/default.php +++ b/administrator/components/com_scheduler/tmpl/tasks/default.php @@ -63,6 +63,12 @@ $saveOrderingUrl = 'index.php?option=com_scheduler&task=tasks.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1'; HTMLHelper::_('draggablelist.draggable'); } + +// When there are due Tasks show that information to the user +if ($this->hasDueTasks === true) { + $app->enqueueMessage(Text::_('COM_SCHEDULER_MSG_DUETASKS'), 'warning'); +} + ?>