Merge branch 'master' into pr/290

This commit is contained in:
Sebastian Meyer 2019-03-11 15:47:50 +01:00
parent b5a56fdb7e
commit f3fd45b931
14 changed files with 95 additions and 46 deletions

View File

@ -276,6 +276,7 @@ Search
facets :ref:`t3tsref:data-type-list`
limitFacets :ref:`t3tsref:data-type-integer` 15
resetFacets :ref:`t3tsref:data-type-boolean` 0
sortingFacets :ref:`t3tsref:data-type-string`
suggest :ref:`t3tsref:data-type-boolean` 1
showSingleResult :ref:`t3tsref:data-type-boolean` 0
targetPid :ref:`t3tsref:data-type-page-id`

View File

@ -17,9 +17,6 @@ Kitodo.Presentation is highly customizable through a user-friendly backend and f
<a href="https://lgtm.com/projects/g/kitodo/kitodo-presentation/alerts/">
<img alt="LGTM Alerts" src="https://img.shields.io/lgtm/alerts/g/kitodo/kitodo-presentation.svg?logo=lgtm&logoWidth=18"/>
</a>
<a href="https://scan.coverity.com/projects/kitodo-presentation">
<img alt="Coverity Status" src="https://scan.coverity.com/projects/11566/badge.svg"/>
</a>
Requirements
------------

View File

@ -100,7 +100,7 @@ limitations under the License.
<!-- Unique identifier for the document in the index. -->
<field name="id" type="string" indexed="true" stored="true" required="true" />
<!-- Unique identifier for the document (or its top-level parent) in the TYPO3 database. -->
<field name="uid" type="int" indexed="true" stored="true" required="true" default="0" />
<field name="uid" type="int" indexed="true" stored="true" required="true" default="0" docValues="true"/>
<!-- PageID for the document (or its top-level parent) in the TYPO3 database. -->
<field name="pid" type="int" indexed="true" stored="false" required="true" default="0" />
<!-- Image number where this document starts. -->

View File

@ -736,7 +736,7 @@ class tx_dlf_basket extends tx_dlf_plugin {
$mailData = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail);
$body = $this->pi_getLL('mailBody', '', TRUE)."\n";
$mailText = $this->pi_getLL('mailBody', '', TRUE)."\n";
$numberOfPages = 0;
@ -772,8 +772,22 @@ class tx_dlf_basket extends tx_dlf_plugin {
// Remove leading/tailing pdfparamseperator
$pdfUrl = trim($pdfUrl, $this->conf['pdfparamseparator']);
$body .= $pdfUrl;
$mailBody = $mailText.$pdfUrl;
// Get hook objects.
$hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath);
// Hook for getting a customized mail body.
foreach ($hookObjects as $hookObj) {
if (method_exists($hookObj, 'customizeMailBody')) {
$mailBody = $hookObj->customizeMailBody($mailText, $pdfUrl);
}
}
$from = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom();
// send mail
@ -790,7 +804,7 @@ class tx_dlf_basket extends tx_dlf_plugin {
// Set the To addresses with an associative array
->setTo(array ($mailData['mail'] => $mailData['name']))
->setBody($body, 'text/html')
->setBody($mailBody, 'text/html')
->send()
;

View File

@ -49,7 +49,7 @@ class tx_dlf_pagegrid extends tx_dlf_plugin {
$markerArray['###NUMBER###'] = $number;
// Set pagination.
$markerArray['###PAGINATION###'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['orderlabel'];
$markerArray['###PAGINATION###'] = htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['orderlabel']);
// Get thumbnail or placeholder.
if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']])) {

View File

@ -389,7 +389,7 @@ dlfViewer.prototype.init = function(controlNames) {
if (!dlfUtils.isNullEmptyUndefinedOrNoNumber(lon) && !dlfUtils.isNullEmptyUndefinedOrNoNumber(lat) && !dlfUtils.isNullEmptyUndefinedOrNoNumber(zoom)) {
// make sure, zoom center is on viewport
var center = this.map.getView().getCenter();
if ((lon < (2.2 * center[0])) && (lat < (2.2 * center[1]))) {
if ((lon < (2.2 * center[0])) && (lat < (-0.2 * center[1])) && (lat > (2.2 * center[1]))) {
this.map.zoomTo([lon, lat], zoom);
}
}

View File

@ -57,7 +57,7 @@ var dlfViewerFullTextControl = function(map, image, fulltextUrl) {
*/
this.dic = $('#tx-dlf-tools-fulltext').length > 0 && $('#tx-dlf-tools-fulltext').attr('data-dic') ?
dlfUtils.parseDataDic($('#tx-dlf-tools-fulltext')) :
{'fulltext-on':'Activate Fulltext','fulltext-off':'Dectivate Fulltext'};
{'fulltext-on':'Activate Fulltext','fulltext-off':'Deactivate Fulltext'};
/**
* @type {ol.Feature|undefined}
@ -414,41 +414,31 @@ dlfViewerFullTextControl.fetchFulltextDataFromServer = function(url, image, opt_
*/
dlfViewerFullTextControl.prototype.showFulltext = function(features) {
var popupHTML = '',
/**
* Functions wraps fulltext context of a given textblock to a html string
* @param {ol.Feature} feature
* @return {string}
*/
appendHTML = function(feature) {
var html = '',
textlines = feature.get('textlines');
for (var i = 0; i < textlines.length; i++) {
html = html + '<span class="textline" id="' + textlines[i].getId() + '">';
var content = textlines[i].get('content');
for (var j = 0; j < content.length; j++) {
html = html + '<span class="' + content[j].get('type') + '" id="' + content[j].getId()
+ '">' + content[j].get('fulltext').replace(/\n/g, '<br />') + '</span>';
}
html = html + '</span>';
}
return html;
};
// iterate over given textblocks
if (features !== undefined) {
$('#tx-dlf-fulltextselection').children().remove();
for (var i = 0; i < features.length; i++) {
popupHTML = popupHTML + appendHTML(features[i]) + '<br /><br />';
var textlines = features[i].get('textlines');
for (var j = 0; j < textlines.length; j++) {
var textLineSpan = $('<span class="textline" id="' + textlines[j].getId() + '">');
var content = textlines[j].get('content');
for (var k = 0; k < content.length; k++) {
var span = $('<span class="' + content[k].get('type') + '" id="' + content[k].getId() + '"/>');
var spanText = content[k].get('fulltext');
var spanTextLines = spanText.split(/\n/g);
for (var l = 0; l < spanTextLines.length; l++) {
span.append(document.createTextNode(spanTextLines[l]));
if (l < spanTextLines.length - 1) {
span.append($('<br />'));
}
}
textLineSpan.append(span);
}
$('#tx-dlf-fulltextselection').append(textLineSpan);
}
$('#tx-dlf-fulltextselection').append('<br /><br />');
}
};
$('#tx-dlf-fulltextselection').html(popupHTML);
};

View File

@ -30,7 +30,7 @@ dlfViewerImageManipulationControl = function(options) {
*/
this.dic = $('#tx-dlf-tools-imagetools').length > 0 && $('#tx-dlf-tools-imagetools').attr('data-dic') ?
dlfUtils.parseDataDic($('#tx-dlf-tools-imagetools')) :
{'imagemanipulation-on':'Activate image manipulation', 'imagemanipulation-off':'Dectivate image manipulation', 'saturation':'Saturation', 'hue':'Hue', 'brightness': 'Brightness', 'contrast':'Contrast', 'reset': 'Reset', 'invert': 'Color inverting'};
{'imagemanipulation-on':'Activate image manipulation', 'imagemanipulation-off':'Deactivate image manipulation', 'saturation':'Saturation', 'hue':'Hue', 'brightness': 'Brightness', 'contrast':'Contrast', 'reset': 'Reset', 'invert': 'Color inverting'};
/**
* @type {Array.<ol.layer.Layer>}

View File

@ -10,6 +10,18 @@
* LICENSE.txt file that was distributed with this source code.
*/
// Internet Explorer does not support String.prototype.endsWith
if (String.prototype.endsWith === undefined) {
String.prototype.endsWith = function(searchString, length) {
if (searchString == null || searchString == '' || length!=null && searchString.length > length || searchString.length > this.length) {
return false;
}
length = length == null || length > this.length || length <= 0 ? this.length : length;
var substr = this.substr(0, length);
return substr.lastIndexOf(searchString) == length - searchString.length;
};
}
/**
* Base namespace for utility functions used by the dlf module.
*
@ -400,6 +412,12 @@ dlfUtils.iiifProfiles = {
*/
dlfUtils.buildImageV2 = function buildImageV2(mimetype, uri, jsonld) {
if (typeof jsonld.profile == "string") {
jsonld.profile = [jsonld.profile, {}];
}
if (jsonld.profile !== undefined && jsonld.profile.length < 2) {
jsonld.profile.push({});
}
var levelProfile = jsonld.profile === undefined || dlfUtils.iiifProfiles[jsonld.profile[0]] === undefined ? dlfUtils.iiifProfiles['none'] : dlfUtils.iiifProfiles[jsonld.profile[0]];
return {
src: uri,

View File

@ -498,7 +498,7 @@ class tx_dlf_search extends tx_dlf_plugin {
// Fill markers.
$markerArray = array (
'###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf),
'###LABEL_QUERY###' => (!empty($search['query']) ? $search['query'] : $this->pi_getLL('label.query')),
'###LABEL_QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : $this->pi_getLL('label.query')),
'###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'),
'###FIELD_QUERY###' => $this->prefixId.'[query]',
'###QUERY###' => (!empty($search['query']) ? $search['query'] : ''),
@ -811,7 +811,8 @@ class tx_dlf_search extends tx_dlf_plugin {
'type' => 'field',
'key' => $field,
'field' => $field,
'limit' => $this->conf['limitFacets']
'limit' => $this->conf['limitFacets'],
'sort' => isset($this->conf['sortingFacets']) ? $this->conf['sortingFacets'] : 'count'
);
}

View File

@ -198,6 +198,28 @@
</config>
</TCEforms>
</resetFacets>
<sortingFacets>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/plugins/search/locallang.xml:tt_content.pi_flexform.sortingFacets</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:dlf/plugins/search/locallang.xml:tt_content.pi_flexform.sortingFacets.count</numIndex>
<numIndex index="1">count</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:dlf/plugins/search/locallang.xml:tt_content.pi_flexform.sortingFacets.index</numIndex>
<numIndex index="1">index</numIndex>
</numIndex>
</items>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
</config>
</TCEforms>
</sortingFacets>
<suggest>
<TCEforms>
<exclude>1</exclude>

View File

@ -31,6 +31,9 @@
<label index="tt_content.pi_flexform.facets">Show these facets</label>
<label index="tt_content.pi_flexform.limitFacets">Maximum facet values</label>
<label index="tt_content.pi_flexform.resetFacets">Allow to reset facets</label>
<label index="tt_content.pi_flexform.sortingFacets">Facet sorting</label>
<label index="tt_content.pi_flexform.sortingFacets.count">Count (highest count first)</label>
<label index="tt_content.pi_flexform.sortingFacets.index">Lexicographic by indexed term (alphabetically for terms in the ASCII range)</label>
<label index="tt_content.pi_flexform.suggest">Show search suggestions</label>
<label index="tt_content.pi_flexform.targetPid">Target page (with "DLF: List View" plugin)</label>
<label index="tt_content.pi_flexform.targetPidPageView">Target page (with "DLF: Page View" plugin)</label>
@ -68,6 +71,9 @@
<label index="tt_content.pi_flexform.facets">Diese Facetten anzeigen</label>
<label index="tt_content.pi_flexform.limitFacets">Maximale Facettenwerte</label>
<label index="tt_content.pi_flexform.resetFacets">Facetten zurücksetzen erlauben</label>
<label index="tt_content.pi_flexform.sortingFacets">Facetten Sortierung</label>
<label index="tt_content.pi_flexform.sortingFacets.count">Anzahl (höchste Anzahl zuerst)</label>
<label index="tt_content.pi_flexform.sortingFacets.index">Lexikographisch nach indexiertem Begriff (alphabetisch für Begriffe im ASCII-Bereich)</label>
<label index="tt_content.pi_flexform.suggest">Suchvorschläge anzeigen</label>
<label index="tt_content.pi_flexform.targetPid">Zielseite (mit Plugin "DLF: Listenansicht")</label>
<label index="tt_content.pi_flexform.targetPidPageView">Zielseite (mit Plugin "DLF: Seitenansicht")</label>

View File

@ -52,7 +52,7 @@ class tx_dlf_toc extends tx_dlf_plugin {
$entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']);
$entryArray['pagination'] = $entry['pagination'];
$entryArray['pagination'] = htmlspecialchars($entry['pagination']);
$entryArray['_OVERRIDE_HREF'] = '';

View File

@ -16,7 +16,7 @@
<data type="array">
<languageKey index="default" type="array">
<label index="fulltext-on">Activate Fulltext</label>
<label index="fulltext-off">Dectivate Fulltext</label>
<label index="fulltext-off">Deactivate Fulltext</label>
<label index="fulltext-not-available">No Fulltext available</label>
</languageKey>
<languageKey index="de" type="array">