diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index 99f6ccfb6624438f97dfb19594365dc80c5f1d52..eef539ba345a612ac0ee36a68c20acde2a5c8bc6 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -32,11 +32,8 @@ use SGalinski\SgJobs\Service\BackendService; use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Messaging\FlashMessage; -use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\VersionNumberUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; -use TYPO3\CMS\Extbase\Mvc\View\ViewInterface; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; @@ -82,19 +79,6 @@ class BackendController extends ActionController { $this->jobRepository = $jobRepository; } - /** - * @param ViewInterface $view - */ - public function initializeView(ViewInterface $view): void { - parent::initializeView($view); - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); - $pageRenderer->addJsInlineCode( - 'typo3_version', 'TYPO3.version=' - . VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version()) - . ';' - ); - } - /** * Show all job offers and options to manage them * @@ -152,8 +136,6 @@ class BackendController extends ActionController { /** @var QueryResultInterface $companies */ $companies = $this->companyRepository->findByPid($pageUid); $this->view->assign('locationOptions', $companies); - $this->view->assign('typo3Version', VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version)); - if ($totalJobCount || $companies->count()) { $this->view->assign('jobs', $jobs); $this->view->assign('filters', $filters); diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index 29dabb85151b84d02cdbfb7e98f3f4620f621305..ad85155102823e83e1aab91e4fc0024afa39b49c 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -37,9 +37,10 @@ use SGalinski\SgJobs\Domain\Repository\JobRepository; use SGalinski\SgJobs\Property\TypeConverter\UploadedFileReferenceConverter; use SGalinski\SgMail\Service\MailTemplateService; use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Resource\ResourceFactory; +use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\VersionNumberUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException; @@ -256,15 +257,13 @@ class JoblistController extends ActionController { } // display country options - if (\version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) { - $sysLanguageUid = $GLOBALS['TSFE']->sys_language_uid; - } else { - $context = GeneralUtility::makeInstance(Context::class); - $sysLanguageUid = $context->getPropertyFromAspect('language', 'id'); - } - + $context = GeneralUtility::makeInstance(Context::class); + $sysLanguageUid = $context->getPropertyFromAspect('language', 'id'); + $site = GeneralUtility::makeInstance(SiteFinder::class) + ->getSiteByPageId($GLOBALS['TSFE']->id) + ->getLanguageById($sysLanguageUid); $countryRepository = $this->objectManager->get(CountryRepository::class); - $countries = $countryRepository->findAllOrderedByLanguage($GLOBALS['TSFE']->sys_language_isocode); + $countries = $countryRepository->findAllOrderedByLanguage($site->getTwoLetterIsoCode()); $this->view->assign('countries', $countries); $this->view->assign('sysLanguageUid', $sysLanguageUid); @@ -336,7 +335,7 @@ class JoblistController extends ActionController { $newName = \date('Ymd-His') . '_' . $applicationData->getJobId() . '-' . $applicationData->getFirstName() . '-' . $applicationData->getLastName(); $storage = $resourceFactory->getStorageObject(1); - $applicationFilePath = PATH_site . $storage->getConfiguration()['basePath'] . 'JobApplication/' . $folderName . + $applicationFilePath = Environment::getPublicPath() . '/' . $storage->getConfiguration()['basePath'] . 'JobApplication/' . $folderName . '/' . $newName . '.csv'; $this->writeApplicationFile($applicationData, $applicationFilePath); } diff --git a/Classes/Property/TypeConverter/UploadedFileReferenceConverter.php b/Classes/Property/TypeConverter/UploadedFileReferenceConverter.php index 577024a70c60e24fe5a9e4656d8b5523a826cad1..1edded6cd48830cf3ed4e4120919c00bf7210a22 100644 --- a/Classes/Property/TypeConverter/UploadedFileReferenceConverter.php +++ b/Classes/Property/TypeConverter/UploadedFileReferenceConverter.php @@ -29,6 +29,7 @@ namespace SGalinski\SgJobs\Property\TypeConverter; use SGalinski\SgJobs\Domain\Model\FileReference; use TYPO3\CMS\Core\Resource\DuplicationBehavior; use TYPO3\CMS\Core\Resource\File as FalFile; +use TYPO3\CMS\Core\Resource\FileInterface; use TYPO3\CMS\Core\Resource\FileReference as FalFileReference; use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -227,11 +228,13 @@ class UploadedFileReferenceConverter implements TypeConverterInterface { * @param string $targetType * @param string $propertyName * @param PropertyMappingConfigurationInterface $configuration + * @return string * @api */ public function getTypeOfChildProperty( $targetType, $propertyName, PropertyMappingConfigurationInterface $configuration - ) { + ): string { + return ''; } /** @@ -302,7 +305,7 @@ class UploadedFileReferenceConverter implements TypeConverterInterface { * @param string $targetType * @param array $convertedChildProperties * @param PropertyMappingConfigurationInterface $configuration - * @return null|FileReference|Error + * @return null|FileInterface|Error * @api */ public function convertFrom( diff --git a/Classes/Routing/Aspect/JobTitleMapper.php b/Classes/Routing/Aspect/JobTitleMapper.php deleted file mode 100644 index e793c0281943c7fbb3b8a4ac66d786ba8834f2bc..0000000000000000000000000000000000000000 --- a/Classes/Routing/Aspect/JobTitleMapper.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php - -namespace SGalinski\SgJobs\Routing\Aspect; - -/** - * - * Copyright notice - * - * (c) sgalinski Internet Services (https://www.sgalinski.de) - * - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - */ - -use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Routing\Aspect\PersistedMappableAspectInterface; -use TYPO3\CMS\Core\Routing\Aspect\StaticMappableAspectInterface; -use TYPO3\CMS\Core\Utility\GeneralUtility; - -/** - * Class JobAspect - * - * @deprecated @TODO Drop it in one of the next breaking versions. It should not be used anymore. Look at the README. We switched already to the path_segment field. - * - * @package SGalinski\SgJobs\Routing\Aspect - * @author Kevin Ditscheid <kevin.ditscheid@sgalinski.de> - */ -class JobTitleMapper implements PersistedMappableAspectInterface, StaticMappableAspectInterface { - - /** - * Generate the job title from the job id given to this function as the $value parameter - * - * @param string $value - * @return string|null - * @throws \Exception - */ - public function generate(string $value): ?string { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) - ->getQueryBuilderForTable('tx_sgjobs_domain_model_job'); - $job = $queryBuilder->select('job.uid', 'job.title') - ->from('tx_sgjobs_domain_model_job', 'job') - ->where( - $queryBuilder->expr()->eq('job.uid', $queryBuilder->createNamedParameter($value, \PDO::PARAM_INT)) - ) - ->setMaxResults(1) - ->execute()->fetch(); - - return \urlencode( - \preg_replace('/[^a-zA-Z0-9_]/', '', \str_replace([' ', '-'], '_', \strtolower($job['title']))) - . '-' . $job['uid'] - ); - } - - /** - * Resolve a job title given by the $value parameter to a job id. It is slicing the string into the various parts - * via regular expression and searches the database for a record, that matches the parts. - * - * @param string $value - * @return string|null - */ - public function resolve(string $value): ?string { - if (!\preg_match('/^(?P<title>.+)-(?P<uid>.+)/', $value, $matches)) { - return NULL; - } - - $jobUid = (int) $matches['uid']; - return ($jobUid > 0 ? $jobUid : NULL); - } -} diff --git a/Classes/Service/BackendService.php b/Classes/Service/BackendService.php index 3666744bf805101c751631a0b004b6b320753f4e..ea4812ccfb28f429a5345d91371e25549619c7d4 100644 --- a/Classes/Service/BackendService.php +++ b/Classes/Service/BackendService.php @@ -34,7 +34,6 @@ use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\VersionNumberUtility; use TYPO3\CMS\Extbase\Mvc\Request; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; @@ -86,16 +85,9 @@ class BackendService { public static function makeButtons($docHeaderComponent, $request): void { /** @var ButtonBar $buttonBar */ $buttonBar = $docHeaderComponent->getButtonBar(); - /** @var IconFactory $iconFactory */ $iconFactory = GeneralUtility::makeInstance(IconFactory::class); - - if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) { - $locallangPath = 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:'; - } else { - $locallangPath = 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:'; - } - + $locallangPath = 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:'; // Refresh $refreshButton = $buttonBar->makeLinkButton() ->setHref(GeneralUtility::getIndpEnv('REQUEST_URI')) diff --git a/Classes/SignalSlot/SitemapSignalSlot.php b/Classes/SignalSlot/SitemapSignalSlot.php index 36bef6fbcd95a07b8157c145beaa54c10d7ba28d..205160410e1e17e039c7a09234a2c1fe075e79be 100644 --- a/Classes/SignalSlot/SitemapSignalSlot.php +++ b/Classes/SignalSlot/SitemapSignalSlot.php @@ -29,7 +29,7 @@ namespace SGalinski\SgJobs\SignalSlot; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Frontend\Page\PageRepository; +use \TYPO3\CMS\Core\Domain\Repository\PageRepository; use TYPO3\Languagevisibility\Service\FrontendServices; /** diff --git a/Classes/ViewHelpers/Backend/ControlViewHelper.php b/Classes/ViewHelpers/Backend/ControlViewHelper.php index 36a43974759d5670710e6b4d8c4b9e0fb1861814..eac8f91167ca96f4ec5f2d4b8bcac9dc80230d16 100644 --- a/Classes/ViewHelpers/Backend/ControlViewHelper.php +++ b/Classes/ViewHelpers/Backend/ControlViewHelper.php @@ -29,7 +29,6 @@ namespace SGalinski\SgJobs\ViewHelpers\Backend; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\VersionNumberUtility; use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; @@ -71,12 +70,7 @@ class ControlViewHelper extends AbstractViewHelper { $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/AjaxDataHandler'); $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf'); - if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) { - $languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Lang\LanguageService::class); - } else { - $languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageService::class); - } - + $languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageService::class); $languageService->includeLLFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf'); $databaseRecordList->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageInfo); $databaseRecordList->currentTable = $sortingData; diff --git a/Resources/Private/Backend/Layouts/Default.html b/Resources/Private/Backend/Layouts/Default.html index e9052b7ed152f28dd3b8d4185330fb4da21a0ea3..b9a09ad482f184bc13c629ce4e537693833b5d33 100644 --- a/Resources/Private/Backend/Layouts/Default.html +++ b/Resources/Private/Backend/Layouts/Default.html @@ -13,14 +13,7 @@ </div> <div class="module-docheader-bar-column-right"> <span class="typo3-docheader-pagePath"> - <f:if condition="{typo3Version} < 9000000"> - <f:then> - <f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw> - </f:then> - <f:else> - <f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw> - </f:else> - </f:if> + <f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw> </span> <f:format.raw>{docHeader.metaInformation.recordInformation}</f:format.raw> </div> diff --git a/Resources/Public/JavaScript/Backend/SgJobs.js b/Resources/Public/JavaScript/Backend/SgJobs.js index d2728e1b3e68c41ed17498de699a97d38e458e4a..4d07b4d9e08626a01be559a4193b86860a6e566c 100644 --- a/Resources/Public/JavaScript/Backend/SgJobs.js +++ b/Resources/Public/JavaScript/Backend/SgJobs.js @@ -32,7 +32,7 @@ define([ init: function() { $('.sg-jobs_pageswitch').on('click', function(event) { event.preventDefault(); - SgJobs.goTo('web_SgJobsBackend', event.target.dataset.page, event.target.dataset.path); + SgJobs.goTo('web_SgJobsBackend', event.target.dataset.page); }); }, /** @@ -40,34 +40,16 @@ define([ * * @param module * @param id - * @param path */ - goTo: function(module, id, path) { - if (TYPO3.version < 9000000) { - var tree = top.Ext.getCmp('typo3-pagetree'); - if (tree) { - tree.activeTree.selectPath(path); - } else if (top.nav) { - top.nav.invokePageId(id, function(path) { - var callback = top.Ext.createDelegate(top.nav.mainTree.selectPath, top.nav.mainTree); - callback.apply(this, arguments); - var node = top.nav.getSelected(); - if (node) { - top.TYPO3.Components.PageTree.Actions.singleClick(node, top.TYPO3.Components.PageTree.Tree); - } - }); + goTo: function(module, id) { + var pageTreeNodes = Viewport.NavigationContainer.PageTree.instance.nodes; + for (var nodeIndex in pageTreeNodes) { + if (pageTreeNodes.hasOwnProperty(nodeIndex) && pageTreeNodes[nodeIndex].identifier === parseInt(id)) { + Viewport.NavigationContainer.PageTree.selectNode(pageTreeNodes[nodeIndex]); + break; } - parent.TYPO3.ModuleMenu.App.showModule(module, 'id=' + id); - } else { - var pageTreeNodes = Viewport.NavigationContainer.PageTree.instance.nodes; - for (var nodeIndex in pageTreeNodes) { - if (pageTreeNodes.hasOwnProperty(nodeIndex) && pageTreeNodes[nodeIndex].identifier === parseInt(id)) { - Viewport.NavigationContainer.PageTree.selectNode(pageTreeNodes[nodeIndex]); - break; - } - } - ModuleMenu.App.showModule(module, 'id=' + id); } + ModuleMenu.App.showModule(module, 'id=' + id); } }; TYPO3.SgJobs = SgJobs; diff --git a/ext_localconf.php b/ext_localconf.php index 1b2bdb97573e6d0c2a0cc115154259d989ed8c86..128fb356e54ecbb122aa49033d5eb19fa0dddd71 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -101,10 +101,6 @@ call_user_func( $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\SGalinski\SgJobs\Updates\DepartmentUpdateWizard::IDENTIFIER] = \SGalinski\SgJobs\Updates\DepartmentUpdateWizard::class; - if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '>')) { - $GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects']['JobTitleMapper'] = \SGalinski\SgJobs\Routing\Aspect\JobTitleMapper::class; - } - //include Plugin sg_jobs \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $extKey . '/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig">'