kitodo-presentation icon indicating copy to clipboard operation
kitodo-presentation copied to clipboard

[BUG] Multi-View not working correctly

Open beatrycze-volk opened this issue 1 year ago • 1 comments

Description

Class parameter documentArray is null if document is accessed by uid.

Reproduction

Steps to reproduce the behaviour:

  1. Install TYPO3 11.x with PHP 8.x
  2. Click on link to display document page e.g. https://sachsendigital.ddev.site
  3. See error

Expected Behavior

The documentArray parameter should be assigned for each type of document, not only ones accessed by URL.

Screenshots and Examples

documentarrayerror

Environment

  • RDBMS version: MariaDB 10.3
  • TYPO3 version: 11.5.37
  • PHP version: 8.2

Additional Context

The function getDocumentByUid is not adjusted:

    private function getDocumentByUid(int $documentId)
    {
        $doc = null;
        $this->document = $this->documentRepository->findOneByIdAndSettings($documentId);

        if ($this->document) {
            $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true);
        } else {
            $this->logger->error('Invalid UID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading');
        }

        return $doc;
    }

The function getDocumentByUrl has necessary adjustments:

    protected function getDocumentByUrl(string $documentId)
    {
        $doc = AbstractDocument::getInstance($documentId, $this->settings, true);

        if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) {
            $childDocuments = $doc->tableOfContents[0]['children'];
            $i = 0;
            foreach ($childDocuments as $document) {
                $this->documentArray[] = AbstractDocument::getInstance($document['points'], $this->settings, true);
                if (!isset($this->requestData['docPage'][$i]) && isset(explode('#', $document['points'])[1])) {
                    $initPage = explode('#', $document['points'])[1];
                    $this->requestData['docPage'][$i] = $initPage;
                }
                $i++;
            }
        } else {
            $this->documentArray[] = $doc;
        }
        .....

        return $doc;
  }

beatrycze-volk avatar Aug 15 '24 11:08 beatrycze-volk

Re-opening this, because #1345 was only a temporary fix. Multi-View still isn't completely implemented!

See also comments in https://github.com/kitodo/kitodo-presentation/blob/c014e8f3cf5e61f72d4f1363ed9faa0c23ac8709/Classes/Controller/AbstractController.php#L517-L541

sebastian-meyer avatar Oct 08 '24 15:10 sebastian-meyer

Multi-view seems to be working in general, but there are still some bugs: #1487, #1488, #1489, #1490.

sebastian-meyer avatar Feb 13 '25 16:02 sebastian-meyer

     // TODO: implement multiView as it is in getDocumentByUrl 

Will be resolved with the pull request #1485 . The multi view functionality has been generalized and is now used in both getDocumentByUid and getDocumentByUrl functions.

markusweigelt avatar Feb 14 '25 11:02 markusweigelt