diff --git a/dlf/common/class.tx_dlf_document.php b/dlf/common/class.tx_dlf_document.php
index f461d02c..78c09ef3 100644
--- a/dlf/common/class.tx_dlf_document.php
+++ b/dlf/common/class.tx_dlf_document.php
@@ -1758,6 +1758,12 @@ final class tx_dlf_document {
}
+ if (!empty($extConf['fileGrpAudio'])) {
+
+ $useGrps[] = $extConf['fileGrpAudio'];
+
+ }
+
// Get all file groups.
$fileGrps = $this->mets->xpath('./mets:fileSec/mets:fileGrp');
diff --git a/dlf/ext_autoload.php b/dlf/ext_autoload.php
index 1f3831fe..a2c48774 100644
--- a/dlf/ext_autoload.php
+++ b/dlf/ext_autoload.php
@@ -45,6 +45,7 @@ return array (
'tx_dlf_tcemain' => $extensionPath.'hooks/class.tx_dlf_tcemain.php',
'tx_dlf_modIndexing' => $extensionPath.'modules/indexing/index.php',
'tx_dlf_modNewclient' => $extensionPath.'modules/newclient/index.php',
+ 'tx_dlf_audioplayer' => $extensionPath.'plugins/audioplayer/class.tx_dlf_audioplayer.php',
'tx_dlf_collection' => $extensionPath.'plugins/collection/class.tx_dlf_collection.php',
'tx_dlf_feeds' => $extensionPath.'plugins/feeds/class.tx_dlf_feeds.php',
'tx_dlf_listview' => $extensionPath.'plugins/listview/class.tx_dlf_listview.php',
diff --git a/dlf/ext_conf_template.txt b/dlf/ext_conf_template.txt
index 7215ee04..9fa16738 100644
--- a/dlf/ext_conf_template.txt
+++ b/dlf/ext_conf_template.txt
@@ -31,6 +31,9 @@ fileGrpDownload = DOWNLOAD
# cat=Files; type=string; label=LLL:EXT:dlf/locallang.xml:config.fileGrpFulltext
fileGrpFulltext = FULLTEXT
+# cat=Files; type=string; label=LLL:EXT:dlf/locallang.xml:config.fileGrpAudio
+fileGrpAudio = AUDIO
+
# cat=Solr; type=user[EXT:dlf/hooks/class.tx_dlf_em.php:tx_dlf_em->checkSolrConnection]; label=LLL:EXT:dlf/locallang.xml:config.solrConnect
solrConnect = 0
diff --git a/dlf/locallang.xml b/dlf/locallang.xml
index 016bee5c..495f237e 100644
--- a/dlf/locallang.xml
+++ b/dlf/locallang.xml
@@ -136,6 +136,7 @@
+
@@ -161,6 +162,7 @@
+
@@ -316,6 +318,7 @@
+
@@ -341,6 +344,7 @@
+
diff --git a/dlf/plugins/audioplayer/class.tx_dlf_audioplayer.php b/dlf/plugins/audioplayer/class.tx_dlf_audioplayer.php
new file mode 100644
index 00000000..0d11dffa
--- /dev/null
+++ b/dlf/plugins/audioplayer/class.tx_dlf_audioplayer.php
@@ -0,0 +1,170 @@
+
+* 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!
+***************************************************************/
+
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ */
+
+/**
+ * Plugin 'DLF: Audioplayer' for the 'dlf' extension.
+ *
+ * @author Sebastian Meyer
+ * @package TYPO3
+ * @subpackage tx_dlf
+ * @access public
+ */
+class tx_dlf_audioplayer extends tx_dlf_plugin {
+
+ public $scriptRelPath = 'plugins/audioplayer/class.tx_dlf_audioplayer.php';
+
+ /**
+ * Holds the current audio file's URL and MIME type
+ *
+ * @var array
+ * @access protected
+ */
+ protected $audio = array ();
+
+ /**
+ * Adds Player javascript
+ *
+ * @access protected
+ *
+ * @return string Player script tags ready for output
+ */
+ protected function addPlayerJS() {
+
+ $output = array ();
+
+ // $this->audio holds an array with URL and MIME type of the audio file.
+ // $this->audio = array ('url' => URL, 'mimetype' => MIME type)
+
+ return implode("\n", $output);
+
+ }
+
+ /**
+ * Get audio's URL and MIME type
+ *
+ * @access protected
+ *
+ * @param integer $page: Page number
+ *
+ * @return array URL and MIME type of audio file
+ */
+ protected function getAudio($page) {
+
+ // Get audio link.
+ if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$this->conf['fileGrpAudio']])) {
+
+ $this->audio['url'] = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$this->conf['fileGrpAudio']]);
+
+ $this->audio['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$this->conf['fileGrpAudio']]);
+
+ break;
+
+ } else {
+
+ if (TYPO3_DLOG) {
+
+ \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_audioplayer->getAudio('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpAudio'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
+
+ }
+
+ }
+
+ return $this->audio;
+
+ }
+
+ /**
+ * The main method of the PlugIn
+ *
+ * @access public
+ *
+ * @param string $content: The PlugIn content
+ * @param array $conf: The PlugIn configuration
+ *
+ * @return string The content that is displayed on the website
+ */
+ public function main($content, $conf) {
+
+ $this->init($conf);
+
+ // Load current document.
+ $this->loadDocument();
+
+ if ($this->doc === NULL || $this->doc->numPages < 1) {
+
+ // Quit without doing anything if required variables are not set.
+ return $content;
+
+ } else {
+
+ // Set default values if not set.
+ // page may be integer or string (physical page attribute)
+ if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
+
+ $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
+
+ } else {
+
+ $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalPages);
+
+ }
+
+ $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
+
+ }
+
+ // Load template file.
+ if (!empty($this->conf['templateFile'])) {
+
+ $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
+
+ } else {
+
+ $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/audioplayer/template.tmpl'), '###TEMPLATE###');
+
+ }
+
+ // Get audio data.
+ $this->audio = $this->getAudio($this->piVars['page']);
+
+ // Fill in the template markers.
+ $markerArray = array (
+ '###PLAYER_JS###' => $this->addPlayerJS()
+ );
+
+ $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
+
+ return $this->pi_wrapInBaseClass($content);
+
+ }
+
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/audioplayer/class.tx_dlf_audioplayer.php']) {
+ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/audioplayer/class.tx_dlf_audioplayer.php']);
+}
diff --git a/dlf/plugins/audioplayer/flexform.xml b/dlf/plugins/audioplayer/flexform.xml
new file mode 100644
index 00000000..ffeecea6
--- /dev/null
+++ b/dlf/plugins/audioplayer/flexform.xml
@@ -0,0 +1,90 @@
+
+
+
+
+ 1
+
+
+
+
+
+ LLL:EXT:dlf/plugins/audioplayer/locallang.xml:tt_content.pi_flexform.sheet_general
+
+ array
+
+
+
+ 1
+
+
+ group
+ db
+ pages
+ 1
+ 1
+ 1
+
+
+
+
+
+ 1
+
+
+ check
+ 1
+
+
+
+
+
+ 1
+
+
+ input
+ required,alphanum_x,nospace
+ tx-dlf-audio
+
+
+
+
+
+ 1
+
+
+ group
+ file_reference
+ tmpl,tpl,html,htm,txt
+ 1
+ 1
+ 0
+ upload
+
+
+
+
+
+
+
+
diff --git a/dlf/plugins/audioplayer/locallang.xml b/dlf/plugins/audioplayer/locallang.xml
new file mode 100644
index 00000000..ea679a0d
--- /dev/null
+++ b/dlf/plugins/audioplayer/locallang.xml
@@ -0,0 +1,43 @@
+
+
+
+
+ module
+ Language labels for plugin tx_dlf_audioplayer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dlf/plugins/audioplayer/template.tmpl b/dlf/plugins/audioplayer/template.tmpl
new file mode 100644
index 00000000..06818eef
--- /dev/null
+++ b/dlf/plugins/audioplayer/template.tmpl
@@ -0,0 +1,26 @@
+
+
+
+###PLAYER_JS###
+
diff --git a/dlf/plugins/pageview/class.tx_dlf_pageview.php b/dlf/plugins/pageview/class.tx_dlf_pageview.php
index 8dcdfe83..5fcdc718 100644
--- a/dlf/plugins/pageview/class.tx_dlf_pageview.php
+++ b/dlf/plugins/pageview/class.tx_dlf_pageview.php
@@ -47,14 +47,6 @@ class tx_dlf_pageview extends tx_dlf_plugin {
protected $controls = array ();
/**
- * Flag if fulltexts are present
- *
- * @var boolean
- * @access protected
- */
- protected $hasFulltexts = false;
-
- /**
* Holds the current images' URLs and MIME types
*
* @var array
@@ -71,36 +63,6 @@ class tx_dlf_pageview extends tx_dlf_plugin {
protected $fulltexts = array ();
/**
- * Holds the language code for OpenLayers
- *
- * @var string
- * @access protected
- */
- protected $lang = 'en';
-
- /**
- * Adds OpenLayers javascript
- *
- * @access protected
- *
- * @return string OpenLayers script tags ready for output.
- */
- protected function addOpenLayersJS() {
-
- $output = array ();
-
- // Add OpenLayers library.
- $output[] = '';
-
- $output[] = '';
-
- $output[] = '';
-
- return implode("\n", $output);
-
- }
-
- /**
* Adds Viewer javascript
*
* @access protected
@@ -115,7 +77,11 @@ class tx_dlf_pageview extends tx_dlf_plugin {
tx_dlf_helper::loadJQuery();
// Add OpenLayers library.
- $output[] = $this->addOpenLayersJS();
+ $output[] = '';
+
+ $output[] = '';
+
+ $output[] = '';
// Add viewer library.
$output[] = '';
@@ -207,33 +173,24 @@ class tx_dlf_pageview extends tx_dlf_plugin {
$fulltext = array ();
- // Get @USE value of METS fileGrp.
- $fileGrpFulltext = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrpFulltext']);
-
- while ($fileGrpFulltext = @array_pop($fileGrpFulltext)) {
-
- // Get fulltext link.
- if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$fileGrpFulltext])) {
+ // Get fulltext link.
+ if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$this->conf['fileGrpFulltext']])) {
- $fulltext['url'] = $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'][$this->conf['fileGrpFulltext']]);
- // Build typolink configuration array.
- // @TODO change hardcoded path to real typolink configuration
- $fulltext['url'] = '/index.php?eID=tx_dlf_fulltext_eid&url='.$fulltext['url'];
+ // Build typolink configuration array.
+ // @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]);
+ $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalPagesInfo[$this->doc->physicalPages[$page]]['files'][$this->conf['fileGrpFulltext']]);
- $this->hasFulltexts = true;
-
- break;
+ break;
- } else {
+ } else {
- if (TYPO3_DLOG) {
+ if (TYPO3_DLOG) {
- \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$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 "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
@@ -244,32 +201,6 @@ class tx_dlf_pageview extends tx_dlf_plugin {
}
/**
- * Get map controls
- *
- * @access protected
- *
- * @return array Array of control keywords
- */
- protected function getMapControls() {
-
- $controls = explode(',', $this->conf['features']);
-
- // Sanitize input.
- foreach ($controls as $key => $control) {
-
- if (empty($this->controlDependency[$control])) {
-
- unset ($controls[$key]);
-
- }
-
- }
-
- return $controls;
-
- }
-
- /**
* The main method of the PlugIn
*
* @access public
@@ -332,7 +263,7 @@ class tx_dlf_pageview extends tx_dlf_plugin {
}
// Get the controls for the map.
- $this->controls = $this->getMapControls();
+ $this->controls = explode(',', $this->conf['features']);
// Fill in the template markers.
$markerArray = array (