Merge branch 'master' into fix-559
This commit is contained in:
commit
440d9bcf69
|
@ -77,7 +77,13 @@ class FulltextTool extends \Kitodo\Dlf\Common\AbstractPlugin
|
|||
$this->getTemplate();
|
||||
$fullTextFile = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
|
||||
if (!empty($fullTextFile)) {
|
||||
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="fulltext:' . htmlspecialchars($this->pi_getLL('fulltext', '')) . ';fulltext-on:' . htmlspecialchars($this->pi_getLL('fulltext-on', '')) . ';fulltext-off:' . htmlspecialchars($this->pi_getLL('fulltext-off', '')) . ';activate-full-text-initially:' . MathUtility::forceIntegerInRange($this->conf['activateFullTextInitially'], 0, 1, 0) . ';full-text-scroll-element:' . $this->conf['fullTextScrollElement'] . '"> </a>';
|
||||
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="'
|
||||
. 'fulltext:' . htmlspecialchars($this->pi_getLL('fulltext', ''))
|
||||
. ';fulltext-on:' . htmlspecialchars($this->pi_getLL('fulltext-on', ''))
|
||||
. ';fulltext-off:' . htmlspecialchars($this->pi_getLL('fulltext-off', ''))
|
||||
. ';activate-full-text-initially:' . MathUtility::forceIntegerInRange($this->conf['activateFullTextInitially'], 0, 1, 0)
|
||||
. ';full-text-scroll-element:' . $this->conf['fullTextScrollElement']
|
||||
. ';search-hl-parameters:' . $this->conf['searchHlParameters'] . '"> </a>';
|
||||
} else {
|
||||
$markerArray['###FULLTEXT_SELECT###'] = '<span class="no-fulltext">' . htmlspecialchars($this->pi_getLL('fulltext-not-available', '')) . '</span>';
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
plugin.tx_dlf_annotationtool.templateFile = EXT:dlf/Resources/Private/Templates/AnnotationTool.tmpl
|
||||
plugin.tx_dlf_fulltexttool.activateFullTextInitially = 0
|
||||
plugin.tx_dlf_fulltexttool.fullTextScrollElement = html, body
|
||||
plugin.tx_dlf_fulltexttool.searchHlParameters = tx_dlf[highlight_word]
|
||||
plugin.tx_dlf_fulltexttool.templateFile = EXT:dlf/Resources/Private/Templates/FulltextTool.tmpl
|
||||
plugin.tx_dlf_fulltextdownloadtool.templateFile = EXT:dlf/Resources/Private/Templates/FulltextDownloadTool.tmpl
|
||||
plugin.tx_dlf_imagedownloadtool.templateFile = EXT:dlf/Resources/Private/Templates/ImageDownloadTool.tmpl
|
||||
|
|
|
@ -1037,7 +1037,9 @@ Fulltext Tool
|
|||
^^^^^^^^^^^^^
|
||||
This plugin adds an activation link for fulltext to the toolbox. If no fulltext is available for the current page, a span-tag is rendered instead.
|
||||
|
||||
The default behaviour is to show the fulltext after click on the toggle link. There is a TypoScript configuration to show the fulltext initially.
|
||||
The default behavior is to show the fulltext after click on the toggle link. There is a TypoScript configuration to show the fulltext initially.
|
||||
|
||||
Plugin allows also to configure (searchHlParameters) by which URL parameters words will be highlighted in the image. The first defined parameter on the configuration has highest priority, if not found it checks the next ones.
|
||||
|
||||
:typoscript:`plugin.tx_dlf_fulltexttool.`
|
||||
|
||||
|
@ -1071,7 +1073,14 @@ The default behaviour is to show the fulltext after click on the toggle link. Th
|
|||
:Default:
|
||||
html, body
|
||||
|
||||
- :Property:
|
||||
searchHlParameters
|
||||
:Data Type:
|
||||
:ref:`t3tsref:data-type-string`
|
||||
:Default:
|
||||
tx_dlf[highlight_word]
|
||||
|
||||
The fulltext is fetched and rendered by JavaSript into the `<div id="tx-dlf-fulltextselection">` of the pageview plugin.
|
||||
|
||||
**Please note**: To allow JavaScript fetching the fulltext, the `CORS headers <https://en.wikipedia.org/wiki/Cross-origin_resource_sharing>`_ muste be configured appropriate on the providing webserver.
|
||||
The fulltext is fetched and rendered by JavaScript into the `<div id="tx-dlf-fulltextselection">` of the pageview plugin.
|
||||
|
||||
**Please note**: To allow JavaScript fetching the fulltext, the `CORS headers <https://en.wikipedia.org/wiki/Cross-origin_resource_sharing>`_ must be configured appropriate on the providing webserver.
|
||||
|
|
|
@ -57,7 +57,13 @@ 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':'Fulltext', 'fulltext-on':'Activate Fulltext','fulltext-off':'Deactivate Fulltext', 'activate-full-text-initially':'0', 'full-text-scroll-element':'html, body'};
|
||||
{
|
||||
'fulltext':'Fulltext',
|
||||
'fulltext-on':'Activate Fulltext',
|
||||
'fulltext-off':'Deactivate Fulltext',
|
||||
'activate-full-text-initially':'0',
|
||||
'full-text-scroll-element':'html, body',
|
||||
'search-hl-parameters':'tx_dlf[highlight_word]'};
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
|
@ -71,6 +77,12 @@ var dlfViewerFullTextControl = function(map, image, fulltextUrl) {
|
|||
*/
|
||||
this.fullTextScrollElement = this.dic['full-text-scroll-element'];
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
* @private
|
||||
*/
|
||||
this.searchHlParameters = this.dic['search-hl-parameters'];
|
||||
|
||||
/**
|
||||
* @type {ol.Feature|undefined}
|
||||
* @private
|
||||
|
|
|
@ -73,6 +73,12 @@ var dlfViewer = function(settings){
|
|||
*/
|
||||
this.highlightFieldParams = undefined;
|
||||
|
||||
/**
|
||||
* @type {string|undefined}
|
||||
* @private
|
||||
*/
|
||||
this.highlightKeys = undefined;
|
||||
|
||||
/**
|
||||
* @type {Object|undefined}
|
||||
* @private
|
||||
|
@ -149,7 +155,7 @@ var dlfViewer = function(settings){
|
|||
*
|
||||
* @param {Array.<string>} controlNames
|
||||
*/
|
||||
dlfViewer.prototype.addCustomControls = function(controlNames) {
|
||||
dlfViewer.prototype.addCustomControls = function() {
|
||||
var fulltextControl = undefined,
|
||||
fulltextDownloadControl = undefined,
|
||||
annotationControl = undefined,
|
||||
|
@ -161,6 +167,7 @@ dlfViewer.prototype.addCustomControls = function(controlNames) {
|
|||
if (this.fulltexts[0] !== undefined && this.fulltexts[0].length !== 0 && this.fulltexts[0].url !== '' && this.images.length === 1) {
|
||||
fulltextControl = new dlfViewerFullTextControl(this.map, this.images[0], this.fulltexts[0].url);
|
||||
fulltextDownloadControl = new dlfViewerFullTextDownloadControl(this.map, this.images[0], this.fulltexts[0].url);
|
||||
this.highlightKeys = fulltextControl.searchHlParameters;
|
||||
} else {
|
||||
$('#tx-dlf-tools-fulltext').remove();
|
||||
}
|
||||
|
@ -280,7 +287,7 @@ dlfViewer.prototype.createControls_ = function(controlNames, layers) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Displayes highlight words
|
||||
* Displays highlight words
|
||||
*/
|
||||
dlfViewer.prototype.displayHighlightWord = function() {
|
||||
|
||||
|
@ -322,12 +329,24 @@ dlfViewer.prototype.displayHighlightWord = function() {
|
|||
}
|
||||
}
|
||||
|
||||
// check keys for which highlighting should be made
|
||||
var keys = this.highlightKeys.split(',');
|
||||
// check if highlight by words is set
|
||||
var key = 'tx_dlf[highlight_word]',
|
||||
urlParams = dlfUtils.getUrlParams();
|
||||
var urlParams = dlfUtils.getUrlParams();
|
||||
|
||||
if (urlParams !== undefined && urlParams.hasOwnProperty(key) && this.fulltexts[0] !== undefined && this.fulltexts[0].url !== '' && this.images.length > 0) {
|
||||
var value = urlParams[key],
|
||||
var hasOwnProperty = false;
|
||||
var param = '';
|
||||
|
||||
for(let key of keys) {
|
||||
if(urlParams !== undefined && urlParams.hasOwnProperty(key.trim())) {
|
||||
hasOwnProperty = true;
|
||||
param = key.trim();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
if (hasOwnProperty && this.fulltexts[0] !== undefined && this.fulltexts[0].url !== '' && this.images.length > 0) {
|
||||
var value = urlParams[param],
|
||||
values = value.split(';'),
|
||||
fulltextData = dlfFullTextUtils.fetchFullTextDataFromServer(this.fulltexts[0].url, this.images[0]),
|
||||
fulltextDataImageTwo = undefined;
|
||||
|
@ -418,11 +437,11 @@ dlfViewer.prototype.init = function(controlNames) {
|
|||
}
|
||||
}
|
||||
|
||||
this.addCustomControls();
|
||||
|
||||
// highlight word in case a highlight field is registered
|
||||
this.displayHighlightWord();
|
||||
|
||||
this.addCustomControls(controls);
|
||||
|
||||
// trigger event after all has been initialize
|
||||
$(window).trigger("map-loadend", window);
|
||||
|
||||
|
|
Loading…
Reference in New Issue