Browse Source

Add support for missing thumbnails

tags/v1.2.0
Sebastian Meyer 9 years ago
parent
commit
0b6ba0aba6
  1. 28
      dlf/common/class.tx_dlf_document.php
  2. 2
      dlf/common/class.tx_dlf_indexing.php
  3. 2
      dlf/ext_conf_template.txt
  4. 4
      dlf/locallang.xml
  5. 18
      dlf/plugins/pagegrid/class.tx_dlf_pagegrid.php
  6. 14
      dlf/plugins/pagegrid/flexform.xml
  7. 2
      dlf/plugins/pagegrid/locallang.xml
  8. BIN
      dlf/plugins/pagegrid/placeholder.jpg

28
dlf/common/class.tx_dlf_document.php

@ -316,7 +316,7 @@ final class tx_dlf_document {
*/
public function getFileLocation($id) {
if (($location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'))) {
if (!empty($id) && ($location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'))) {
return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href;
@ -556,7 +556,7 @@ final class tx_dlf_document {
$details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalPages, TRUE)), 1);
$details['thumbnailId'] = $this->physicalPagesInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][strtolower($extConf['fileGrpThumbs'])];
$details['thumbnailId'] = @$this->physicalPagesInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][strtolower($extConf['fileGrpThumbs'])];
// Get page number of the first page related to this structure element.
$details['pagination'] = $this->physicalPagesInfo[$id]['label'];
@ -567,7 +567,7 @@ final class tx_dlf_document {
// Yes. Point to itself.
$details['points'] = 1;
$details['thumbnailId'] = $this->physicalPagesInfo[$this->physicalPages[1]]['files'][strtolower($extConf['fileGrpThumbs'])];
$details['thumbnailId'] = @$this->physicalPagesInfo[$this->physicalPages[1]]['files'][strtolower($extConf['fileGrpThumbs'])];
}
@ -1699,6 +1699,12 @@ final class tx_dlf_document {
$useGrps = t3lib_div::trimExplode(',', $extConf['fileGrps']);
if (!empty($extConf['fileGrpThumbs'])) {
$useGrps[] = $extConf['fileGrpThumbs'];
}
// Yes. Get concordance of @FILEID and @USE attributes.
$fileUse = array ();
@ -1908,9 +1914,23 @@ final class tx_dlf_document {
}
// Load plugin configuration.
// Load extension configuration.
$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]);
if (empty($extConf['fileGrpThumbs'])) {
if (TYPO3_DLOG) {
t3lib_div::devLog('[tx_dlf_document->_getThumbnail()] No fileGrp for thumbnails specified', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
$this->thumbnailLoaded = TRUE;
return $this->thumbnail;
}
$strctId = $this->_getToplevelId();
$metadata = $this->getTitledata($cPid);

2
dlf/common/class.tx_dlf_indexing.php

@ -553,7 +553,7 @@ class tx_dlf_indexing {
$solrDoc->setField('thumbnail', $doc->thumbnail);
} else {
} elseif (!empty($logicalUnit['thumbnailId'])) {
$solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId']));

2
dlf/ext_conf_template.txt

@ -17,7 +17,7 @@ publishNewCollections = 1
unhideOnIndex = 0
# cat=Files; type=string; label=LLL:EXT:dlf/locallang.xml:config.fileGrps
fileGrps = THUMBS,MIN,DEFAULT,MAX
fileGrps = MIN,DEFAULT,MAX
# cat=Files; type=string; label=LLL:EXT:dlf/locallang.xml:config.fileGrpThumbs
fileGrpThumbs = THUMBS

4
dlf/locallang.xml

@ -128,7 +128,7 @@
<label index="config.caching">Cache parsed METS files: caching improves performance a little bit but can result in a very large "fe_session_data" table (default is "FALSE")</label>
<label index="config.publishNewCollections">Publish new collections?: Should new collections automatically be published in the OAI interface? (default is "TRUE")</label>
<label index="config.unhideOnIndex">Unhide indexed documents?: Should hidden documents be unhidden when re-indexing them? (default is "FALSE")</label>
<label index="config.fileGrps">METS fileGrps: comma-separated list of all @USE attribute values (default is "THUMBS,MIN,DEFAULT,MAX")</label>
<label index="config.fileGrps">Page fileGrps: comma-separated list of @USE attribute values (default is "MIN,DEFAULT,MAX")</label>
<label index="config.fileGrpThumbs">Thumbnail fileGrp: @USE attribute value (default is "THUMBS")</label>
<label index="config.solrConnect">Solr Connection</label>
<label index="config.solrHost">Solr Server Host: (default is "localhost")</label>
@ -290,7 +290,7 @@
<label index="config.caching">Eingelesene METS Dateien zwischenspeichern: Dies kann die Geschwindigkeit geringfügig verbessern, führt aber zu einer sehr großen "fe_session_data" Tabelle (Standard ist "FALSE")</label>
<label index="config.publishNewCollections">Neue Kollektionen publizieren?: Sollen neue Kollektionen automatisch in der OAI-Schnittstelle veröffentlicht werden? (Standard ist "TRUE")</label>
<label index="config.unhideOnIndex">Indexierte Dokumente einblenden?: Sollen ausgeblendete Dokumente bei der erneuten Indexierung wieder eingeblendet werden? (Standard ist "FALSE")</label>
<label index="config.fileGrps">METS fileGrps: Komma-getrennte Liste aller @USE Attributwerte (Standard ist "THUMBS,MIN,DEFAULT,MAX")</label>
<label index="config.fileGrps">Seiten fileGrps: Komma-getrennte Liste der @USE Attributwerte der Seitenansichten (Standard ist "MIN,DEFAULT,MAX")</label>
<label index="config.fileGrpThumbs">Vorschau fileGrp: @USE Attributwert der Vorschaubilder (Standard ist "THUMBS")</label>
<label index="config.solrConnect">Solr Verbindung</label>
<label index="config.solrHost">Solr Server Host: (Standard ist "localhost")</label>

18
dlf/plugins/pagegrid/class.tx_dlf_pagegrid.php

@ -68,8 +68,20 @@ class tx_dlf_pagegrid extends tx_dlf_plugin {
// Set pagination.
$markerArray['###PAGINATION###'] = $this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['label'];
// Get thumbnail and link it to page view.
$thumbnailFile = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['files'][strtolower($this->conf['fileGrpThumbs'])]);
// Get thumbnail or placeholder.
if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['files'][strtolower($this->conf['fileGrpThumbs'])])) {
$thumbnailFile = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['files'][strtolower($this->conf['fileGrpThumbs'])]);
} elseif (!empty($this->conf['placeholder'])) {
$thumbnailFile = $this->conf['placeholder'];
} else {
$thumbnailFile = t3lib_extMgm::siteRelPath($this->extKey).'plugins/pagegrid/placeholder.jpg';
}
$thumbnail = '<img alt="'.$markerArray['###PAGINATION###'].'" src="'.$thumbnailFile.'" />';
@ -191,7 +203,7 @@ class tx_dlf_pagegrid extends tx_dlf_plugin {
$this->loadDocument();
if ($this->doc === NULL || $this->doc->numPages < 1) {
if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpThumbs'])) {
// Quit without doing anything if required variables are not set.
return $content;

14
dlf/plugins/pagegrid/flexform.xml

@ -36,6 +36,20 @@
</config>
</TCEforms>
</limit>
<placeholder>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/plugins/pagegrid/locallang.xml:tt_content.pi_flexform.placeholder</label>
<config>
<type>group</type>
<internal_type>file_reference</internal_type>
<allowed>jpg,png,gif</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
</config>
</TCEforms>
</placeholder>
<targetPid>
<TCEforms>
<exclude>1</exclude>

2
dlf/plugins/pagegrid/locallang.xml

@ -8,6 +8,7 @@
<languageKey index="default" type="array">
<label index="tt_content.pi_flexform.sheet_general">Options</label>
<label index="tt_content.pi_flexform.limit">Thumbnails per page</label>
<label index="tt_content.pi_flexform.placeholder">Placeholder for pages without thumbnail</label>
<label index="tt_content.pi_flexform.targetPid">Target page (with "DLF: Page View" plugin)</label>
<label index="tt_content.pi_flexform.templateFile">Template file</label>
<label index="prevPage">&lt;</label>
@ -19,6 +20,7 @@
<languageKey index="de" type="array">
<label index="tt_content.pi_flexform.sheet_general">Einstellungen</label>
<label index="tt_content.pi_flexform.limit">Vorschaubilder pro Seite</label>
<label index="tt_content.pi_flexform.placeholder">Platzhalter für Seiten ohne Vorschaubild</label>
<label index="tt_content.pi_flexform.targetPid">Zielseite (mit Plugin "DLF: Seitenansicht")</label>
<label index="tt_content.pi_flexform.templateFile">HTML-Template</label>
<label index="prevPage">&lt;</label>

BIN
dlf/plugins/pagegrid/placeholder.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Loading…
Cancel
Save