Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINTENANCE] Update to TYPO3 12 #322

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f7e5b38
Update Typo3
markusweigelt Oct 18, 2024
9a00d01
Merge branch 'slub:master' into update-typo12
markusweigelt Oct 21, 2024
b6043dc
Updates Typo3 12
markusweigelt Oct 21, 2024
7ebde4e
Updates regarding typo3 12
markusweigelt Oct 21, 2024
f15155c
Update PHPDoc
markusweigelt Oct 21, 2024
fe5653c
Move icon to icons for reusage in TYPO3 backend
markusweigelt Oct 21, 2024
0240042
Update documentation
markusweigelt Oct 21, 2024
5aef709
Update documentation
markusweigelt Oct 22, 2024
f24f910
Remove unused code
markusweigelt Oct 22, 2024
42a067a
Improve response type
markusweigelt Oct 22, 2024
c408506
Update composer
markusweigelt Oct 22, 2024
a8a73a0
Update codeql workflow
markusweigelt Oct 22, 2024
d3d9181
Update PHP Stan
markusweigelt Oct 22, 2024
005e28b
Update improvements
markusweigelt Oct 23, 2024
93fb538
Refactore UriController to reduce complexity
markusweigelt Oct 23, 2024
b6a3e62
Get page id by rooting request attribute
markusweigelt Oct 23, 2024
b7adb24
Fix PHPDoc
markusweigelt Oct 23, 2024
9c6ef21
Fix hasty change from to getTSFE()?, improve font paths
markusweigelt Oct 25, 2024
9674cba
Change typo conversion
markusweigelt Oct 28, 2024
c0bc0dd
Remove typo
markusweigelt Oct 28, 2024
0afa7e0
Update doc
markusweigelt Oct 28, 2024
6dce0e5
Update doc
markusweigelt Oct 28, 2024
4f7a537
Update doc
markusweigelt Oct 28, 2024
2a45b14
Update webstyles
markusweigelt Oct 28, 2024
316e400
Update site configuration of default distribution
markusweigelt Oct 29, 2024
7b35945
Rename site config yaml
markusweigelt Oct 29, 2024
f15f485
Add dev
markusweigelt Nov 4, 2024
048e938
Remove dev version
markusweigelt Nov 4, 2024
a75f40f
Show replacement of composer.json
markusweigelt Nov 12, 2024
22b4c8d
Merge branch 'master' into update-typo12
markusweigelt Nov 14, 2024
8be3721
Fix wrong required extension change
markusweigelt Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql.yml

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
uses: php-actions/composer@v6
with:
command: update
php_version: "7.4"

- name: PHPStan Static Analysis
uses: php-actions/phpstan@v3
with:
configuration: ./.github/phpstan.neon
configuration: ./.github/phpstan.neon
path: ''
20 changes: 12 additions & 8 deletions Classes/Controller/SruController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Slub\Dfgviewer\Controller;

use Kitodo\Dlf\Common\MetsDocument;
use Kitodo\Dlf\Controller\AbstractController;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand All @@ -16,14 +18,13 @@
* @subpackage tx_dfgviewer
* @access public
*/
class SruController extends \Kitodo\Dlf\Controller\AbstractController
class SruController extends AbstractController
{
/**
* The main method of the controller
*
* @return void
* @return ResponseInterface
*/
public function mainAction()
public function mainAction(): ResponseInterface
{
// Load current document.
$this->loadDocument();
Expand All @@ -32,7 +33,7 @@ public function mainAction()
|| !$this->document->getCurrentDocument() instanceof MetsDocument
) {
// Quit without doing anything if required variables are not set.
return;
return $this->htmlResponse();
}

// Get digital provenance information.
Expand All @@ -49,11 +50,12 @@ public function mainAction()

if (empty($sruLink)) {
// Quit without doing anything if link is not set.
return;
return $this->htmlResponse();
}

$pageArguments = $this->request->getAttribute('routing');
$actionUrl = $this->uriBuilder->reset()
->setTargetPageUid($GLOBALS['TSFE']->id)
->setTargetPageUid($pageArguments->getPageId())
->setCreateAbsoluteUri(true)
->build();

Expand All @@ -62,6 +64,8 @@ public function mainAction()
$this->view->assign('sruLink', $sruLink);
$this->view->assign('currentDocument', $this->document->getLocation());
$this->view->assign('actionUrl', $actionUrl);

return $this->htmlResponse();
}

/**
Expand All @@ -71,7 +75,7 @@ public function mainAction()
*
* @return void
*/
protected function addSruResultsJS()
protected function addSruResultsJS(): void
{
if (!empty($this->requestData['highlight']) && !empty($this->requestData['origimage'])) {
$highlight = unserialize(urldecode($this->requestData['highlight']));
Expand Down
39 changes: 34 additions & 5 deletions Classes/Controller/UriController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

use Kitodo\Dlf\Common\AbstractDocument;
use Kitodo\Dlf\Common\Helper;
use TYPO3\CMS\Core\Utility\MathUtility;
use Kitodo\Dlf\Controller\AbstractController;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand All @@ -37,27 +39,41 @@
* @subpackage dlf
* @access public
*/
class UriController extends \Kitodo\Dlf\Controller\AbstractController
class UriController extends AbstractController
{
/**
* The main method of the plugin
*
* @return void
* @return ResponseInterface
*/
public function mainAction()
public function mainAction(): ResponseInterface
{
// Load current document.
$this->loadDocument();

if ($this->isDocMissingOrEmpty()) {
// Quit without doing anything if required variables are not set.
return;
return $this->htmlResponse();
}

$this->setPage();

$doc = $this->document->getCurrentDocument();

$this->assignUriBook($doc);
$this->assignUriPage($doc);

return $this->htmlResponse();
}

/**
* Assign the uri book.
*
* @param AbstractDocument|null $doc
* @return void
*/
public function assignUriBook(?AbstractDocument $doc): void
{
// Get persistent identifier of book.
$uriBook = GeneralUtility::trimExplode(' ', $doc->physicalStructureInfo[$doc->physicalStructure[0]]['contentIds'], TRUE);

Expand All @@ -83,6 +99,19 @@ public function mainAction()
$this->view->assign('uriBooks', $uris);
}
}
}

/**
* Assign the uri page.
*
* @param AbstractDocument|null $doc
* @return void
*/
public function assignUriPage(?AbstractDocument $doc): void
{
if (!isset($this->requestData['page'])) {
return;
}

// Get persistent identifier of page.
$uriPage = GeneralUtility::trimExplode(' ', $doc->physicalStructureInfo[$doc->physicalStructure[$this->requestData['page']]]['contentIds'], TRUE);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Middleware/SruMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private function getSruRecords(array $sruRecords): array
];
}

$page = (string) $pageAttributes['id'];
$page = (int) $pageAttributes['id'];

// get METS file of search hit
$parentUrl = (string) $fullTextHit[$id]->children('http://dfg-viewer.de/')->page->parent->attributes()->url;
Expand Down
2 changes: 0 additions & 2 deletions Classes/ViewHelpers/CalendarDataVariableViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* Viewhelper to filter calendar data and inject a variable with the result.
Expand Down
4 changes: 0 additions & 4 deletions Classes/ViewHelpers/TitleTagViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* LICENSE.txt file that was distributed with this source code.
*/

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
Expand Down Expand Up @@ -58,8 +57,5 @@ public static function renderStatic(
if ($title !== null) {
$GLOBALS['TSFE']->page['title'] = $title;
}

// return first found result
return;
}
}
8 changes: 8 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

Slub\Dfgviewer\:
resource: '../Classes/*'
2 changes: 1 addition & 1 deletion Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined('TYPO3_MODE') or die();
defined('TYPO3') or die();

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile (
'dfgviewer',
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TCA/Overrides/sys_template.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined('TYPO3_MODE') or die();
defined('TYPO3') or die();

// Register static typoscript.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined('TYPO3_MODE') or die();
defined('TYPO3') or die();

// Plugin "uri".
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dfgviewer_uri'] = 'layout,select_key,pages,recursive';
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TsConfig/Page.tsconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
##############
#### PAGE ####
##############
<INCLUDE_TYPOSCRIPT: source="DIR:EXT:dfgviewer/Configuration/TsConfig/Page/" extensions="tsconfig">
@import 'EXT:dfgviewer/Configuration/TypoScript/TsConfig/Page/*.tsconfig'


# PAGE DEFAULT PERMISSIONS
Expand Down
6 changes: 4 additions & 2 deletions Configuration/TypoScript/Navigation/language.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Header Language Navigation
# ----------------------------------------


lib.menu {
language = COA
language {
Expand All @@ -11,7 +12,7 @@ lib.menu {
# show only Default and English
special.value = 0,1

addQueryString = 1
addQueryString = untrusted
addQueryString.method = GET
addQueryString.exclude = cHash

Expand All @@ -21,7 +22,8 @@ lib.menu {
noBlur = 1
NO = 1
NO {
linkWrap=<li>|</li>
before = <li>
after = </li>
stdWrap.override = DE || EN
ATagTitle.override = Sprache: Deutsch || Language: English
}
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TypoScript/Page/header.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ page {
}


[getTSFE().id == {$plugin.tx_dfgviewer.kitodoPageView}]
[getTSFE() && getTSFE().id == {$plugin.tx_dfgviewer.kitodoPageView}]
page {
includeCSS {
style = EXT:dfgviewer/Resources/Public/Css/allStyles.css
Expand Down
6 changes: 3 additions & 3 deletions Configuration/TypoScript/Page/page.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ page {
bodyTag = <body class="website">

adminPanelStyles = 0
shortcutIcon = EXT:dfgviewer/Resources/Public/Images/dfgviewerFavicon.png
shortcutIcon = EXT:dfgviewer/Resources/Public/Icons/Extension.png

10 = FLUIDTEMPLATE
10 {
Expand Down Expand Up @@ -60,11 +60,11 @@ lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.nonWrappedTag >
# -------------------------------
# Diverses
# -------------------------------
[getTSFE().id == {$plugin.tx_dfgviewer.rootPid}]
[getTSFE() && getTSFE().id == {$plugin.tx_dfgviewer.rootPid}]
page.bodyTag = <body class="website home">
[END]

[getTSFE().id == {$plugin.tx_dfgviewer.kitodoPageView}]
[getTSFE() && getTSFE().id == {$plugin.tx_dfgviewer.kitodoPageView}]
page {
bodyTag = <body class="dfgviewer">
10 {
Expand Down
11 changes: 4 additions & 7 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Configuration
<INCLUDE_TYPOSCRIPT: source="DIR:./Config/" extensions="typoscript">

@import 'EXT:dfgviewer/Configuration/TypoScript/Config/*.typoscript'
# Navigation
<INCLUDE_TYPOSCRIPT: source="DIR:./Navigation/" extensions="typoscript">

@import 'EXT:dfgviewer/Configuration/TypoScript/Navigation/*.typoscript'
# Plugin
<INCLUDE_TYPOSCRIPT: source="DIR:./Plugins/" extensions="typoscript">

@import 'EXT:dfgviewer/Configuration/TypoScript/Plugins/*.typoscript'
# Page
<INCLUDE_TYPOSCRIPT: source="DIR:./Page/" extensions="typoscript">
@import 'EXT:dfgviewer/Configuration/TypoScript/Page/*.typoscript'
Loading
Loading