diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index bfcaa65d9d7d8bb7940798c227eb818093d14b6e..ccb4445fcb8638bd0b21a1083f0dabc69808b1ab 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -106,7 +106,6 @@ class BackendController extends ActionController { public function indexAction(array $filters = []) { try { $pageUid = (int) GeneralUtility::_GP('id'); - $sortingData = []; // create docheader + buttons $pageInfo = BackendUtility::readPageAccess($pageUid, $GLOBALS['BE_USER']->getPagePermsClause(1)); @@ -127,19 +126,19 @@ class BackendController extends ActionController { $this->view->assign('pages', BackendService::getPagesWithJobRecords()); $this->view->assign('pageUid', $pageUid); - if (count($filters) === 0) { - - $prevUid = 0; - $sortingData = []; - /** @var Job $job */ - foreach ($jobs as $job) { - if ($prevUid) { - $sortingData['prev'][$job->getUid()] = $prevUid; - $sortingData['next'][$prevUid] = $job->getUid(); - } - $prevUid = $job->getUid(); - } - } + $sortingData = []; + if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_jobs']['allowManualSorting'] && count($filters) <= 0) { + $previousUid = 0; + $sortingData = []; + foreach ($jobs as $job) { + if ($previousUid) { + $sortingData['prev'][$job->getUid()] = $previousUid; + $sortingData['next'][$previousUid] = '-' . $job->getUid(); + } + $previousUid = $job->getUid(); + } + } + $this->view->assign('sortingData', $sortingData); diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index 5bbacd45ba291e3bfb83a7dbe6488571d413c4e1..b41d461e2f3695a756772cabe0c111629cf1210e 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -44,6 +44,8 @@ use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; +use SGalinski\Lfeditor\Utility\ExtensionUtility; + /** * The joblist plugin controller @@ -162,9 +164,11 @@ class JoblistController extends ActionController { $frontendPluginSettings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $frontendPluginSettings = $frontendPluginSettings['settings']; + $isManualSortingAllowed = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_jobs']['allowManualSorting']; + // get all jobs for the current page $ordering = (int)$frontendPluginSettings['orderBy']; - FrontendFilterService::setAllowManualSorting($frontendPluginSettings['allowManualSorting']); + FrontendFilterService::setAllowManualSorting((bool)$isManualSortingAllowed); $jobs = FrontendFilterService::getJobs($filters, $jobLimit, $offset, $ordering); // get all jobs for the current page diff --git a/Configuration/TCA/tx_sgjobs_domain_model_job.php b/Configuration/TCA/tx_sgjobs_domain_model_job.php index 05ff844dc8463f45ed508e6196fba66f6691e31f..be4faebfbe8c0c2e2d08dcb7b1a0e682700126d5 100644 --- a/Configuration/TCA/tx_sgjobs_domain_model_job.php +++ b/Configuration/TCA/tx_sgjobs_domain_model_job.php @@ -26,7 +26,7 @@ return call_user_func( function ($extKey, $table) { - return [ + $tca = [ 'ctrl' => [ 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '', 'label' => 'title', @@ -76,11 +76,6 @@ return call_user_func( 'palette_apply_function' => ['showitem' => 'hide_apply_by_email, hide_apply_by_postal, featured_offer', 'canNotCollapse' => 1] ], 'columns' => [ - 'sorting' => [ - 'config' => [ - 'type' => 'passthrough' - ] - ], 'crdate' => [ 'exclude' => FALSE, 'config' => [ @@ -327,6 +322,13 @@ return call_user_func( ] ], ]; + + + if (!$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_jobs']['allowManualSorting']) { + $tca['columns']['sorting']['config']['type'] = 'passthrough'; + } + + return $tca; }, 'sg_jobs', 'tx_sgjobs_domain_model_job' ); diff --git a/Configuration/TypoScript/Frontend/constants.typoscript b/Configuration/TypoScript/Frontend/constants.typoscript index 310da88baaab021c1e07eea655ebbc20ffd43896..e0f95ba9896846d07d55c8088a24e83b6428e2ef 100644 --- a/Configuration/TypoScript/Frontend/constants.typoscript +++ b/Configuration/TypoScript/Frontend/constants.typoscript @@ -13,8 +13,6 @@ plugin.tx_sgjobs { settings { # cat=plugin.tx_sgjobs/other; type=string; label=Mail address to send submitted applications to applicationEmail = - # cat=plugin.tx_sgjobs/other; type=boolean; label=Enable manual sorting - allowManualSorting = 0 # cat=plugin.tx_sgjobs/other; type=string; label=Allowed file extensions for uploads in the controller (comma separated) allowedFileExtensions = pdf # cat=plugin.tx_sgjobs/other; type=string; label=Allowed mime types for uploads in the Fluid template (comma separated) diff --git a/Configuration/TypoScript/Frontend/setup.typoscript b/Configuration/TypoScript/Frontend/setup.typoscript index 105a23bc712c9549cb046d7b6e765e8742cb1314..a1929d9be924ba5ecc702196749af88c33f3f884 100644 --- a/Configuration/TypoScript/Frontend/setup.typoscript +++ b/Configuration/TypoScript/Frontend/setup.typoscript @@ -23,7 +23,6 @@ plugin.tx_sgjobs { settings { allowedFileExtensions = {$plugin.tx_sgjobs.settings.allowedFileExtensions} - allowManualSorting = {$plugin.tx_sgjobs.settings.allowManualSorting} allowedMimeTypes = {$plugin.tx_sgjobs.settings.allowedMimeTypes} allowedMaxFileSize = {$plugin.tx_sgjobs.settings.allowedMaxFileSize} privacyPolicyPage = {$plugin.tx_sgjobs.settings.privacyPolicyPage} diff --git a/ext_conf_template.txt b/ext_conf_template.txt new file mode 100644 index 0000000000000000000000000000000000000000..692cda1f56b91d2f45b0204ffcff11910add1a44 --- /dev/null +++ b/ext_conf_template.txt @@ -0,0 +1,2 @@ +# cat=plugin.tx_sgjobs/other; type=boolean; label=Enable manual sorting +allowManualSorting = 0