Skip to content
Snippets Groups Projects
Commit 1e051bfa authored by axelbraunschweiger's avatar axelbraunschweiger
Browse files

Merge branch 'feature_UpgradeTo9LTS' of gitlab.sgalinski.de:typo3/sg_jobs into...

Merge branch 'feature_UpgradeTo9LTS' of gitlab.sgalinski.de:typo3/sg_jobs into feature_UpgradeTo9LTS
parents 97228fcd dd169049
No related branches found
No related tags found
1 merge request!12Feature upgrade to9 lts
......@@ -32,9 +32,11 @@ 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;
......@@ -80,6 +82,20 @@ class BackendController extends ActionController {
$this->jobRepository = $jobRepository;
}
/**
* @param ViewInterface $view
*/
public function initializeView(ViewInterface $view) {
parent::initializeView($view);
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addJsInlineCode('typo3_version', 'TYPO3.version='
. VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version())
. ';');
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$pageRenderer->loadExtJS();
}
}
/**
* Show all job offers and options to manage them
*
......
......@@ -41,6 +41,8 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
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
......@@ -79,6 +81,9 @@ class JobTitleMapper implements PersistedMappableAspectInterface, StaticMappable
}
/**
* 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
*/
......
......@@ -163,7 +163,7 @@ return call_user_func(
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim, required, unique'
'eval' => 'trim, required'
],
],
'job_id' => [
......
......@@ -20,6 +20,7 @@ This extension provides job application functionality for a TYPO3 installation.
* Every application is saved conveniently in a CSV format, along with the
uploaded files
* Sends mail notifications when applications are submitted
* Provides a JobTitleMapper for the TYPO3 9 route enhancers
## Integration
Typoscript files need to be included manually.
......@@ -77,6 +78,41 @@ access from the .htaccess file. Example:
RedirectMatch 403 ^/fileadmin/JobApplication/.*$
```
## Implement job title mapping in TYPO3 9
To enable the job title mapping in TYPO3 9, you need to add this routeEnhancer configuration to your config.yaml.
```
...
routeEnhancers:
SgJobs:
type: Extbase
extension: SgJobs
plugin: Jobapplication
routes:
-
routePath: '/job/{job_title}'
_controller: 'Joblist::index'
_arguments:
job_title: jobId
-
routePath: '/applyform/job/{job_title}'
_controller: 'Joblist::applyForm'
_arguments:
job_title: jobId
-
routePath: /apply
_controller: 'Joblist::apply'
defaultController: 'Joblist::index'
aspects:
job_title:
type: JobTitleMapper
```
This configuration will use the JobTitleMapper to map the job title to the jobs is.
The routePath represents the speaking URL part where {job_title} is the placeholder for the job title.
The JobTitleMapper is assigned to the job_title placeholder via aspects and will take care of the encoding and decoding
of the job title and the according job id.
## Migration from version 1 to version 2
If you update from sg_job version 1, you need to execute the Upgrade Wizard, that migrates the old area field.
......
......@@ -4,7 +4,8 @@
<f:be.container
includeRequireJsModules="{
0: 'TYPO3/CMS/Backend/ContextMenu',
1: 'TYPO3/CMS/Backend/Tooltip'}">
1: 'TYPO3/CMS/Backend/Tooltip',
2: 'TYPO3/CMS/SgJobs/Backend/SgJobs'}">
<div class="module" data-module-id="" data-module-name="">
<div class="module-docheader t3js-module-docheader">
<div class="module-docheader-bar module-docheader-bar-navigation t3js-module-docheader-bar t3js-module-docheader-bar-navigation">
......
{namespace sg=SGalinski\SgJobs\ViewHelpers}
<f:comment><!--
~
~ 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!
--></f:comment>
<p>
<f:translate key="backend.selectRootPage" />
......@@ -35,7 +11,7 @@
<f:for each="{pages}" as="page">
<tr data-uid="{page.uid}">
<td nowrap="nowrap" class="col-title">
<f:link.action action="index" additionalParams="{id: page.uid}">
<f:link.action class="sg-jobs_pageswitch" action="index" additionalParams="{id: page.uid}" additionalAttributes="{data-page: page.uid, data-path: page.path}">
<core:iconForRecord table="pages" row="{page}" />
{page._thePathFull}
</f:link.action>
......
/*
*
* 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!
*/
define([
'jquery',
'TYPO3/CMS/Backend/ModuleMenu',
'TYPO3/CMS/Backend/Viewport'
], function ($, ModuleMenu, Viewport) {
var SgJobs = {
init: function() {
$('.sg-jobs_pageswitch').on('click', function(event) {
event.preventDefault();
SgJobs.goTo('web_SgJobsBackend', event.target.dataset.page, event.target.dataset.path);
});
},
/**
* Switch the page and select it in the pagetree
*
* @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);
}
});
}
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);
}
}
};
TYPO3.SgJobs = SgJobs;
SgJobs.init();
return SgJobs;
});
......@@ -11,7 +11,7 @@
"issues": "https://gitlab.sgalinski.de/typo3/sg_jobs"
},
"require": {
"typo3/cms-core": "^8.7.22 || ^9.5.2",
"typo3/cms-core": "^9.5.2",
"sgalinski/project-base": "^4.2",
"sgalinski/sg-mail": ">=4.7",
"sgalinski/sg-seo": ">=1.1.3"
......
......@@ -16,8 +16,8 @@ $EM_CONF[$_EXTKEY] = [
[
'depends' =>
[
'typo3' => '8.7.0-9.5.99',
'php' => '7.0.0-7.3.99',
'typo3' => '9.5.0-9.5.99',
'php' => '7.2.0-7.3.99',
'project_base' => '4.2',
'sg_mail' => '4.7',
'sg_seo' => '1.1.3'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment