diff --git a/dlf/common/class.tx_dlf_document.php b/dlf/common/class.tx_dlf_document.php
index 889fa629..f461d02c 100644
--- a/dlf/common/class.tx_dlf_document.php
+++ b/dlf/common/class.tx_dlf_document.php
@@ -367,6 +367,35 @@ final class tx_dlf_document {
}
+ /**
+ * This gets the MIME type of a file representing a physical page
+ *
+ * @access public
+ *
+ * @param string $id: The @ID attribute of the file node
+ *
+ * @return string The file's MIME type
+ */
+ public function getFileMimeType($id) {
+
+ if (!empty($id) && ($mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'))) {
+
+ return (string) $mimetype[0];
+
+ } else {
+
+ if (TYPO3_DLOG) {
+
+ \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_document->getFileMimeType('.$id.')] There is no file node with @ID "'.$id.'" or no MIME type specified', self::$extKey, SYSLOG_SEVERITY_WARNING);
+
+ }
+
+ return '';
+
+ }
+
+ }
+
/**
* This is a singleton class, thus an instance must be created by this method
*
diff --git a/dlf/plugins/pageview/class.tx_dlf_pageview.php b/dlf/plugins/pageview/class.tx_dlf_pageview.php
index 3df131ed..8dcdfe83 100644
--- a/dlf/plugins/pageview/class.tx_dlf_pageview.php
+++ b/dlf/plugins/pageview/class.tx_dlf_pageview.php
@@ -55,7 +55,7 @@ class tx_dlf_pageview extends tx_dlf_plugin {
protected $hasFulltexts = false;
/**
- * Holds the current images' URLs
+ * Holds the current images' URLs and MIME types
*
* @var array
* @access protected
@@ -90,10 +90,12 @@ class tx_dlf_pageview extends tx_dlf_plugin {
$output = array ();
// Add OpenLayers library.
- $output[] = '
-
-
- ';
+ $output[] = '';
+
+ $output[] = '';
+
+ $output[] = '';
+
return implode("\n", $output);
}
@@ -116,14 +118,19 @@ class tx_dlf_pageview extends tx_dlf_plugin {
$output[] = $this->addOpenLayersJS();
// Add viewer library.
- $output[] = '
-
-
-
-
-
-
- ';
+ $output[] = '';
+
+ $output[] = '';
+
+ $output[] = '';
+
+ $output[] = '';
+
+ $output[] = '';
+
+ $output[] = '';
+
+ $output[] = '';
// Add viewer configuration.
$output[] = '
@@ -145,17 +152,17 @@ class tx_dlf_pageview extends tx_dlf_plugin {
}
/**
- * Get image's URL
+ * Get image's URL and MIME type
*
* @access protected
*
* @param integer $page: Page number
*
- * @return string URL of image file
+ * @return array URL and MIME type of image file
*/
- protected function getImageUrl($page) {
+ protected function getImage($page) {
- $imageUrl = '';
+ $image = array ();
// Get @USE value of METS fileGrp.
$fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']);
@@ -165,7 +172,9 @@ class tx_dlf_pageview extends tx_dlf_plugin {
// Get image link.
if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrp])) {
- $imageUrl = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrp]);
+ $image['url'] = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrp]);
+
+ $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrp]);
break;
@@ -173,7 +182,7 @@ class tx_dlf_pageview extends tx_dlf_plugin {
if (TYPO3_DLOG) {
- \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImageUrl('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
+ \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
@@ -181,24 +190,24 @@ class tx_dlf_pageview extends tx_dlf_plugin {
}
- return $imageUrl;
+ return $image;
}
/**
- * Get ALTO XML URL
+ * Get fulltext URL and MIME type
*
* @access protected
*
* @param integer $page: Page number
*
- * @return string URL of image file
+ * @return array URL and MIME type of fulltext file
*/
- protected function getAltoUrl($page) {
+ protected function getFulltext($page) {
+
+ $fulltext = array ();
// Get @USE value of METS fileGrp.
-
- // we need USE="FULLTEXT"
$fileGrpFulltext = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrpFulltext']);
while ($fileGrpFulltext = @array_pop($fileGrpFulltext)) {
@@ -206,10 +215,13 @@ class tx_dlf_pageview extends tx_dlf_plugin {
// Get fulltext link.
if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrpFulltext])) {
- $fulltextUrl = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrpFulltext]);
+ $fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrpFulltext]);
// Build typolink configuration array.
- $fulltextUrl = '/index.php?eID=tx_dlf_fulltext_eid&url='. $fulltextUrl;
+ // @TODO change hardcoded path to real typolink configuration
+ $fulltext['url'] = '/index.php?eID=tx_dlf_fulltext_eid&url='.$fulltext['url'];
+
+ $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrpFulltext]);
$this->hasFulltexts = true;
@@ -219,7 +231,7 @@ class tx_dlf_pageview extends tx_dlf_plugin {
if (TYPO3_DLOG) {
- \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImageUrl('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
+ \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
@@ -227,7 +239,7 @@ class tx_dlf_pageview extends tx_dlf_plugin {
}
- return $fulltextUrl;
+ return $fulltext;
}
@@ -309,13 +321,13 @@ class tx_dlf_pageview extends tx_dlf_plugin {
}
// Get image data.
- $this->images[0] = $this->getImageUrl($this->piVars['page']);
- $this->fulltexts[0] = $this->getAltoUrl($this->piVars['page']);
+ $this->images[0] = $this->getImage($this->piVars['page']);
+ $this->fulltexts[0] = $this->getFulltext($this->piVars['page']);
if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) {
- $this->images[1] = $this->getImageUrl($this->piVars['page'] + 1);
- $this->fulltexts[1] = $this->getAltoUrl($this->piVars['page'] + 1);
+ $this->images[1] = $this->getImage($this->piVars['page'] + 1);
+ $this->fulltexts[1] = $this->getFulltext($this->piVars['page'] + 1);
}