Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
markusweigelt committed Feb 24, 2025
2 parents f5e3ed5 + 3fab3ac commit 6109518
Show file tree
Hide file tree
Showing 34 changed files with 14,072 additions and 14,012 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

# Deprecated should be set to the main repository if the update-typo12 branch is merged.
- name: Checkout DFG-Viewer repository
uses: actions/checkout@v4
with:
repository: markusweigelt/dfg-viewer
ref: update-typo12
repository: slub/dfg-viewer
path: ./Docker/build/extensions/dfg-viewer

- name: Checkout Kitodo.Presentation repository
Expand All @@ -26,12 +24,10 @@ jobs:
repository: kitodo/kitodo-presentation
path: ./Docker/build/extensions/kitodo-presentation

# Deprecated should be set to the main repository if the update-typo12 branch is merged.
- name: Checkout SLUB Digital Collections repository
uses: actions/checkout@v4
with:
repository: markusweigelt/slub_digitalcollections
ref: update-typo12
repository: slub/slub_digitalcollections
path: ./Docker/build/extensions/slub_digitalcollections

- name: Prepare environment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: php-actions/composer@v6
with:
command: update
php_version: "7.4"
php_version: "8.1"

- name: PHPStan Static Analysis
uses: php-actions/phpstan@v3
Expand Down
20 changes: 12 additions & 8 deletions Classes/Controller/SruController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
*/

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 @@ -39,14 +41,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 @@ -55,7 +56,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 @@ -72,11 +73,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 @@ -85,6 +87,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 @@ -94,7 +98,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 @@ -24,8 +24,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 @@ -36,27 +38,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
*/
private function assignUriBook(?AbstractDocument $doc): void
{
// Get persistent identifier of book.
$uriBook = GeneralUtility::trimExplode(' ', $doc->physicalStructureInfo[$doc->physicalStructure[0]]['contentIds'], TRUE);

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

/**
* Assign the uri page.
*
* @param AbstractDocument|null $doc
* @return void
*/
private 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 @@ -129,7 +129,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 @@ -27,8 +27,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 @@ -24,7 +24,6 @@
* This copyright notice MUST APPEAR in all copies of the script!
*/

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 @@ -71,8 +70,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 @@ -26,7 +26,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
10 changes: 8 additions & 2 deletions Configuration/TypoScript/Plugins/kitodo.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,30 @@ lib.kitodo.navigation.viewfunction {
# imagedownloadtool
# imagemanipulationtool
# modeldownloadtool
# viewerselectiontool
# pdfdownloadtool
# searchindocumenttool

plugin.tx_dlf_toolbox < tt_content.list.20.dlf_toolbox
plugin.tx_dlf_toolbox {
settings {
# fileGrpsImageDownload = MIN,DEFAULT,MAX
}
}

plugin.tx_dlf_modeldownloadtool < plugin.tx_dlf_toolbox
plugin.tx_dlf_modeldownloadtool {
settings {
fileGrpsModelDownload = DEFAULT
tools = modeldownloadtool
}
}

plugin.tx_dlf_viewerselectiontool < plugin.tx_dlf_toolbox
plugin.tx_dlf_viewerselectiontool {
settings {
tools = viewerselectiontool
}
}

plugin.tx_dlf_fulltexttool < plugin.tx_dlf_toolbox
plugin.tx_dlf_fulltexttool {
settings {
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

0 comments on commit 6109518

Please sign in to comment.