From 3addc94c814a58587c74ab4b45faf51c2832fa67 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sat, 6 Jun 2020 22:00:16 +0200 Subject: [PATCH] Alphabetical sorting of cronjobs Closes #3361 --- .../files/acp/templates/cronjobList.tpl | 2 +- .../lib/acp/page/CronjobListPage.class.php | 10 +++---- .../lib/acp/page/CronjobLogListPage.class.php | 5 ++-- .../data/cronjob/I18nCronjobList.class.php | 29 +++++++++++++++++++ 4 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 wcfsetup/install/files/lib/data/cronjob/I18nCronjobList.class.php diff --git a/wcfsetup/install/files/acp/templates/cronjobList.tpl b/wcfsetup/install/files/acp/templates/cronjobList.tpl index 762a4c1526..7c3e6dd5ed 100644 --- a/wcfsetup/install/files/acp/templates/cronjobList.tpl +++ b/wcfsetup/install/files/acp/templates/cronjobList.tpl @@ -41,7 +41,7 @@ {lang}wcf.acp.cronjob.startDomShort{/lang} {lang}wcf.acp.cronjob.startMonthShort{/lang} {lang}wcf.acp.cronjob.startDowShort{/lang} - {lang}wcf.acp.cronjob.description{/lang} + {lang}wcf.acp.cronjob.description{/lang} {lang}wcf.acp.cronjob.nextExec{/lang} {event name='columnHeads'} diff --git a/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php b/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php index 8f3239d3c4..efc22200ee 100755 --- a/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php @@ -1,6 +1,6 @@ * @package WoltLabSuite\Core\Acp\Page * - * @property CronjobList $objectList + * @property I18nCronjobList $objectList */ class CronjobListPage extends SortablePage { /** @@ -27,7 +27,7 @@ class CronjobListPage extends SortablePage { /** * @inheritDoc */ - public $defaultSortField = 'cronjobID'; + public $defaultSortField = 'descriptionI18n'; /** * @inheritDoc @@ -37,12 +37,12 @@ class CronjobListPage extends SortablePage { /** * @inheritDoc */ - public $validSortFields = ['cronjobID', 'nextExec', 'startMinute', 'startHour', 'startDom', 'startMonth', 'startDow']; + public $validSortFields = ['cronjobID', 'nextExec', 'startMinute', 'startHour', 'startDom', 'startMonth', 'startDow', 'descriptionI18n']; /** * @inheritDoc */ - public $objectListClassName = CronjobList::class; + public $objectListClassName = I18nCronjobList::class; /** * @inheritDoc diff --git a/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php b/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php index 4c7dfea87d..05df8b3e3a 100755 --- a/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php @@ -1,6 +1,7 @@ availableCronjobs = new CronjobList(); - $this->availableCronjobs->sqlOrderBy = 'cronjobID'; + $this->availableCronjobs = new I18nCronjobList(); + $this->availableCronjobs->sqlOrderBy = 'descriptionI18n'; $this->availableCronjobs->readObjects(); } diff --git a/wcfsetup/install/files/lib/data/cronjob/I18nCronjobList.class.php b/wcfsetup/install/files/lib/data/cronjob/I18nCronjobList.class.php new file mode 100644 index 0000000000..8e59a9de05 --- /dev/null +++ b/wcfsetup/install/files/lib/data/cronjob/I18nCronjobList.class.php @@ -0,0 +1,29 @@ + + * @package WoltLabSuite\Core\Data\Cronjob + * @since 5.3 + * + * @method Cronjob current() + * @method Cronjob[] getObjects() + * @method Cronjob|null search($objectID) + * @property Cronjob[] $objects + */ +class I18nCronjobList extends I18nDatabaseObjectList { + /** + * @inheritDoc + */ + public $i18nFields = ['description' => 'descriptionI18n']; + + /** + * @inheritDoc + */ + public $className = Cronjob::class; +} -- 2.20.1