-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from dvoracek-slub/pr-extbase-fluid
Migrate to Kitodo.Presentation 4
- Loading branch information
Showing
87 changed files
with
1,319 additions
and
1,933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
_build | ||
venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" | ||
Basic Sphinx configuration for TYPO3 theme. Uses configuration from Settings.cfg. | ||
""" | ||
|
||
import ConfigParser | ||
|
||
settings = globals() | ||
settings['general'] = settings | ||
|
||
config = ConfigParser.RawConfigParser() | ||
config.read('../../Documentation/Settings.cfg') | ||
|
||
for section in config.sections(): | ||
target = settings.setdefault(section, {}) | ||
|
||
for (name, value) in config.items(section): | ||
if section == 'intersphinx_mapping': | ||
target[name] = (value, None) | ||
else: | ||
target[name] = value | ||
|
||
extensions = [ | ||
'sphinx_typo3_theme', | ||
'sphinx.ext.intersphinx', | ||
'sphinxcontrib.t3fieldlisttable' | ||
] | ||
|
||
html_theme = 'sphinx_typo3_theme' | ||
|
||
# The TYPO3 convention is to capitalize the index filename, which would require | ||
# us to visit http://127.0.0.1:8000/Index.html. We thus add an `index.html` that | ||
# redirects to `Index.html`. | ||
master_doc = 'Index' | ||
html_extra_path = ['index.html'] | ||
exclude_patterns = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: '3' | ||
services: | ||
t3docs: | ||
image: t3docs/render-documentation:latest | ||
volumes: | ||
- ../../:/PROJECT:ro | ||
- ../../Documentation-GENERATED-temp:/RESULT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="refresh" content="0; url=Index.html"> | ||
</head> | ||
<body> | ||
The documentation entry is <a href="Index.html">Index.html</a>. | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
BASE_DIR=$(dirname "$0") | ||
VENV_DIR="$BASE_DIR/venv" | ||
DOCS_DIR="$BASE_DIR/../../Documentation" | ||
|
||
function usage() | ||
{ | ||
cat << EOF | ||
Usage: sphinx.sh <command> [options] | ||
Commands: | ||
i, install Install Sphinx in a virtualenv | ||
s, serve Serve documentation. Options are forwared to sphinx-autobuild. | ||
-H <host> Server host | ||
-p <port> Server port | ||
-a Write all files (from sphinx-build) | ||
-E Don't use a saved environment (from sphinx-build) | ||
EOF | ||
|
||
exit | ||
} | ||
|
||
function use_sphinx() | ||
{ | ||
source "$VENV_DIR/bin/activate" | ||
} | ||
|
||
COMMAND=$1 | ||
shift | ||
|
||
case $COMMAND in | ||
i|install) | ||
if [ ! -e "$VENV_DIR" ]; then | ||
# t3fieldlisttable doesn't seem to work with Python 3 | ||
virtualenv -p python2 "$VENV_DIR" | ||
fi | ||
|
||
use_sphinx | ||
|
||
pip install sphinx-autobuild | ||
pip install t3fieldlisttable | ||
pip install sphinx_typo3_theme | ||
|
||
;; | ||
|
||
s|serve) | ||
use_sphinx | ||
sphinx-autobuild -c "$BASE_DIR" "$@" "$DOCS_DIR" "$BASE_DIR/_build" | ||
;; | ||
|
||
*) | ||
usage | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
namespace Slub\Dfgviewer\Controller; | ||
|
||
use Kitodo\Dlf\Domain\Model\Document; | ||
use Kitodo\Dlf\Common\MetsDocument; | ||
use Kitodo\Dlf\Domain\Repository\StructureRepository; | ||
use TYPO3\CMS\Core\Database\ConnectionPool; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
/** | ||
* Controller class for the SRU plugin. | ||
* | ||
* Checks if the METS document contains a link to an SRU endpoint, and if so, | ||
* adds a search form to the pageview. | ||
* | ||
* @package TYPO3 | ||
* @subpackage tx_dfgviewer | ||
* @access public | ||
*/ | ||
class SruController extends \Kitodo\Dlf\Controller\AbstractController | ||
{ | ||
public function mainAction() | ||
{ | ||
// Load current document. | ||
$this->loadDocument($this->requestData); | ||
if ( | ||
$this->document === null | ||
|| $this->document->getDoc() === null | ||
|| !$this->document->getDoc() instanceof MetsDocument | ||
) { | ||
// Quit without doing anything if required variables are not set. | ||
return ''; | ||
} | ||
|
||
// Get digital provenance information. | ||
$digiProv = $this->document->getDoc()->mets->xpath('//mets:amdSec/mets:digiprovMD/mets:mdWrap[@OTHERMDTYPE="DVLINKS"]/mets:xmlData'); | ||
|
||
if ($digiProv) { | ||
$links = $digiProv[0]->children('http://dfg-viewer.de/')->links; | ||
|
||
// if no children found with given namespace, skip the following section | ||
if ($links && $links->sru) { | ||
$sruLink = htmlspecialchars(trim((string)$links->sru)); | ||
} | ||
} | ||
|
||
if (empty($sruLink)) { | ||
// Quit without doing anything if required variables are not set. | ||
return ''; | ||
} | ||
|
||
$actionUrl = $this->uriBuilder->reset() | ||
->setTargetPageUid($GLOBALS['TSFE']->id) | ||
->setCreateAbsoluteUri(true) | ||
->build(); | ||
|
||
$this->addSruResultsJS(); | ||
|
||
$this->view->assign('sruLink', $sruLink); | ||
$this->view->assign('currentDocument', $this->document->getLocation()); | ||
$this->view->assign('actionUrl', $actionUrl); | ||
} | ||
|
||
/** | ||
* Adds SRU Search result javascript | ||
* | ||
* @access protected | ||
* | ||
* @return string Viewer script tags ready for output | ||
*/ | ||
protected function addSruResultsJS() | ||
{ | ||
if (!empty($this->requestData['highlight']) && !empty($this->requestData['origimage'])) { | ||
$highlight = unserialize(urldecode($this->requestData['highlight'])); | ||
$origImage = $this->requestData['origimage']; | ||
|
||
// Add SRU Results if any | ||
$javascriptFooter = '$(document).ready(function(){'; | ||
foreach ($highlight as $field) { | ||
$javascriptFooter .= 'tx_dlf_viewer.addHighlightField([' . $field . '],' . $origImage . ');'; | ||
} | ||
$javascriptFooter .= '})'; | ||
|
||
$pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); | ||
$pageRenderer->addJsFooterInlineCode('tx-dfgviewer-footer', $javascriptFooter); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
namespace Slub\Dfgviewer\Controller; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2012 Sebastian Meyer <[email protected]> | ||
* (c) 2022 Alexander Bigga <[email protected]> | ||
* 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 2 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 Kitodo\Dlf\Common\Helper; | ||
use TYPO3\CMS\Core\Utility\MathUtility; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
/** | ||
* Controller class for plugin 'Uri'. | ||
* | ||
* @author Sebastian Meyer <[email protected]> | ||
* @package TYPO3 | ||
* @subpackage dlf | ||
* @access public | ||
*/ | ||
class UriController extends \Kitodo\Dlf\Controller\AbstractController | ||
{ | ||
/** | ||
* The main method of the plugin | ||
* | ||
* @return void | ||
*/ | ||
public function mainAction() | ||
{ | ||
// Load current document. | ||
$this->loadDocument($this->requestData); | ||
|
||
if ($this->document === null) { | ||
return; | ||
} | ||
|
||
$doc = $this->document->getDoc(); | ||
|
||
// Get persistent identifier of book. | ||
$uriBook = GeneralUtility::trimExplode(' ', $doc->physicalStructureInfo[$doc->physicalStructure[0]]['contentIds'], TRUE); | ||
|
||
if (empty($uriBook)) { | ||
$uriBook = $doc->getLogicalStructure($doc->toplevelId); | ||
$uriBook = GeneralUtility::trimExplode(' ', $uriBook['contentIds'], TRUE); | ||
} | ||
|
||
if (!empty($uriBook)) { | ||
$uris = []; | ||
foreach ($uriBook as $uri) { | ||
if (Helper::isValidHttpUrl($uri)) { | ||
$uris[] = $uri; | ||
} elseif (strpos($uri, 'urn:') === 0) { | ||
if (strpos($uri, '/fragment/') === false) { | ||
$uris[] = 'https://nbn-resolving.de/' . $uri; | ||
} else { | ||
$uris[] = 'https://nbn-resolving.org/' . $uri; | ||
} | ||
} | ||
} | ||
if (!empty($uris)) { | ||
$this->view->assign('uriBooks', $uris); | ||
} | ||
} | ||
|
||
// Get persistent identifier of page. | ||
$uriPage = GeneralUtility::trimExplode(' ', $doc->physicalStructureInfo[$doc->physicalStructure[$this->requestData['page']]]['contentIds'], TRUE); | ||
|
||
if (!empty($uriPage)) { | ||
$uris = []; | ||
|
||
foreach ($uriPage as $uri) { | ||
if (Helper::isValidHttpUrl($uri)) { | ||
$uris[] = $uri; | ||
} elseif (strpos($uri, 'urn:') === 0) { | ||
if (strpos($uri, '/fragment/') === false) { | ||
$uris[] = 'https://nbn-resolving.de/' . $uri; | ||
} else { | ||
$uris[] = 'https://nbn-resolving.org/' . $uri; | ||
} | ||
} | ||
} | ||
if (!empty($uris)) { | ||
$this->view->assign('uriPages', $uris); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.