diff --git a/Classes/Common/DocumentAnnotation.php b/Classes/Common/DocumentAnnotation.php index d3b743abc..a3bcecb7f 100644 --- a/Classes/Common/DocumentAnnotation.php +++ b/Classes/Common/DocumentAnnotation.php @@ -12,6 +12,7 @@ * LICENSE.txt file that was distributed with this source code. */ +use DateTime; use Kitodo\Dlf\Domain\Model\Annotation; use Kitodo\Dlf\Domain\Model\Document; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; @@ -279,10 +280,10 @@ protected function getAudioPagesByFileId($fileId, $range = null) { } foreach ($tracks as $index => $track) { - $begin = new \DateTime("1970-01-01 " . $track['begin']); - $extent = new \DateTime("1970-01-01 " . $track['extent']); - $diff = (new \DateTime("1970-01-01 00:00:00"))->diff($extent); - $end = (new \DateTime("1970-01-01 " . $track['begin']))->add($diff); + $begin = new DateTime("1970-01-01 " . $track['begin']); + $extent = new DateTime("1970-01-01 " . $track['extent']); + $diff = (new DateTime("1970-01-01 00:00:00"))->diff($extent); + $end = (new DateTime("1970-01-01 " . $track['begin']))->add($diff); if ( !( diff --git a/Classes/Controller/PageViewController.php b/Classes/Controller/PageViewController.php index 83ab794c2..6938ad458 100644 --- a/Classes/Controller/PageViewController.php +++ b/Classes/Controller/PageViewController.php @@ -186,25 +186,37 @@ protected function multipageNavigation() { MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] - 1, 1, $document->numPages, 1) ]; - $navigateAllPageNext = array_merge($navigateAllPageNext, [ - 'tx_dlf[docPage]['.$i.']' => - MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] + 1, 1, $document->numPages, 1) - ]); + $navigateAllPageNext = array_merge( + $navigateAllPageNext, + [ + 'tx_dlf[docPage][' . $i . ']' => + MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] + 1, 1, $document->numPages, 1) + ] + ); - $navigateAllPagePrev = array_merge($navigateAllPagePrev, [ - 'tx_dlf[docPage]['.$i.']' => - MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] - 1, 1, $document->numPages, 1) - ]); + $navigateAllPagePrev = array_merge( + $navigateAllPagePrev, + [ + 'tx_dlf[docPage][' . $i . ']' => + MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] - 1, 1, $document->numPages, 1) + ] + ); - $navigateAllMeasureNext = array_merge($navigateAllMeasureNext, [ - 'tx_dlf[docMeasure]['.$i.']' => - MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] + 1, 1, $document->numMeasures, 1) - ]); + $navigateAllMeasureNext = array_merge( + $navigateAllMeasureNext, + [ + 'tx_dlf[docMeasure][' . $i . ']' => + MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] + 1, 1, $document->numMeasures, 1) + ] + ); - $navigateAllMeasurePrev = array_merge($navigateAllMeasurePrev, [ - 'tx_dlf[docMeasure]['.$i.']' => - MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] - 1, 1, $document->numMeasures, 1) - ]); + $navigateAllMeasurePrev = array_merge( + $navigateAllMeasurePrev, + [ + 'tx_dlf[docMeasure][' . $i . ']' => + MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] - 1, 1, $document->numMeasures, 1) + ] + ); if ($document->numMeasures > 0) { $navigationMeasureArray[$i]['next'] = [ @@ -241,7 +253,8 @@ protected function multipageNavigation() { * @param $page * @return false|int|mixed|string|null */ - public function convertMeasureOrPage($document, $measure = null, $page = null) { + public function convertMeasureOrPage($document, $measure = null, $page = null) + { $return = null; $measure2Page = array_column($document->musicalStructure, 'page'); if ($measure) { @@ -266,7 +279,7 @@ public function addDocumentAction(FormAddDocument $formAddDocument) } $params = array_merge( ['tx_dlf' => $this->requestData], - ['tx_dlf[multipleSource]['.$nextMultipleSourceKey.']' => $formAddDocument->getLocation()], + ['tx_dlf[multipleSource][' . $nextMultipleSourceKey . ']' => $formAddDocument->getLocation()], ['tx_dlf[multiview]' => 1] ); $uriBuilder = $this->uriBuilder; @@ -297,7 +310,8 @@ protected function getMeasures(int $page, $specificDoc = null, $docNumber = null $measureCoordsFromCurrentSite = []; $measureCounterToMeasureId = []; $measureLinks = []; - if ($defaultFileId = $doc->physicalStructureInfo[$currentPhysId]['files']['DEFAULT']) { + $defaultFileId = $doc->physicalStructureInfo[$currentPhysId]['files']['DEFAULT']; + if (isset($defaultFileId)) { $musicalStruct = $doc->musicalStructureInfo; $i = 0; diff --git a/Resources/Public/JavaScript/PageView/PageView.js b/Resources/Public/JavaScript/PageView/PageView.js index 041de7cf7..313a19391 100644 --- a/Resources/Public/JavaScript/PageView/PageView.js +++ b/Resources/Public/JavaScript/PageView/PageView.js @@ -229,7 +229,7 @@ var dlfViewer = function(settings){ * @type {Object} * @public */ - this.tk = null + this.tk = null; /** * @type {Boolean|false} @@ -344,7 +344,6 @@ dlfViewer.prototype.countPages = function () { dlfViewer.prototype.addCustomControls = function() { var fulltextControl = undefined, fulltextDownloadControl = undefined, - scoreControl = undefined, annotationControl = undefined, imageManipulationControl = undefined, images = this.images; @@ -423,7 +422,7 @@ dlfViewer.prototype.addCustomControls = function() { }); }); - let selected = null + let selected = null; map.on('pointermove', function (e) { if (selected !== null) { $('[data-annotation-id="'+selected.getId()+'"]').removeClass('hover') @@ -919,7 +918,7 @@ dlfViewer.prototype.init = function(controlNames) { dlfViewer.prototype.updateLayerSize = function() { this.map.updateSize(); -} +}; /** * Generate the OpenLayers layer objects for given image sources. Returns a promise / jQuery deferred object. diff --git a/ext_localconf.php b/ext_localconf.php index c28e897ab..37f78054e 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -219,7 +219,8 @@ 'Dlf', 'PageView', [ - \Kitodo\Dlf\Controller\PageViewController::class => 'main, addDocument', + \Kitodo\Dlf\Controller\PageViewController::class => 'main', + \Kitodo\Dlf\Controller\PageViewController::class => 'addDocument', ], // non-cacheable actions [