Add switchoff class / language behavior to fulltext tool

This commit is contained in:
Jacob Mendt 2015-08-28 13:48:52 +02:00
parent 4ceb83bb03
commit 7708e65f6c
5 changed files with 30 additions and 8 deletions

View File

@ -148,7 +148,7 @@ class tx_dlf_pageview extends tx_dlf_plugin {
div: "' . $this->conf['elementId'] . '",
fulltexts: ["' . implode('", "', $this->fulltexts) . '"],
images: ["' . implode('", "', $this->images) . '"],
lang: "de"
lang: "'.$this->lang.'"
})
}
</script>';

View File

@ -433,7 +433,7 @@ dlfViewer.prototype.init = function(){
};
// Adds fulltext behavior
this.fulltextControl = new dlfViewerFullTextControl(this.map)
this.fulltextControl = new dlfViewerFullTextControl(this.map, this.lang);
// keep fulltext feature active
var isFulltextActive = dlfUtils.getCookie("tx-dlf-pageview-fulltext-select"),

View File

@ -21,8 +21,9 @@ jQuery.fn.scrollTo = function(elem, speed) {
* Encapsulates especially the fulltext behavior
* @constructor
* @param {ol.Map} map
* @param {string} lang
*/
var dlfViewerFullTextControl = function(map){
var dlfViewerFullTextControl = function(map, lang){
/**
* @private
@ -30,6 +31,12 @@ var dlfViewerFullTextControl = function(map){
*/
this.map = map;
/**
* @private
* @type {string}
*/
this.lang = lang == 'de' || lang == 'en' ? lang : 'de';
/**
* @private
* @type {ol.layer.Vector}
@ -237,7 +244,10 @@ dlfViewerFullTextControl.prototype.enableFulltextSelect = function(textBlockFeat
this.map.addLayer(this.highlightLayerTextLine);
// show fulltext container
$("#tx-dlf-fulltextselection").addClass('fulltext-visible');
var title = dlfViewerFullTextControl.dic[this.lang][1];
$("#tx-dlf-tools-fulltext").addClass('fulltext-visible')
.text(title)
.attr('title', title);
}
// add first feature of textBlockFeatures to map
@ -277,7 +287,10 @@ dlfViewerFullTextControl.prototype.disableFulltextSelect = function() {
this.selectLayer.getSource().clear();
this.highlightLayerTextLine.getSource().clear()
$("#tx-dlf-fulltextselection").removeClass('fulltext-visible');
var title = dlfViewerFullTextControl.dic[this.lang][0];
$("#tx-dlf-tools-fulltext").removeClass('fulltext-visible')
.text(title)
.attr('title', title);
};
@ -389,3 +402,12 @@ dlfViewerFullTextControl.style.textlineStyle = function() {
});
};
/**
*
* @type {{en: string[], de: string[]}}
*/
dlfViewerFullTextControl.dic = {
'en': ['Activate Fulltext', 'Deactivate Fulltext'],
'de': ['Volltexte an', 'Volltexte aus']
};

View File

@ -93,7 +93,7 @@ class tx_dlf_toolsFulltext extends tx_dlf_plugin {
$fullTextFile = $this->doc->physicalPagesInfo[$this->doc->physicalPages[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
if (!empty($fullTextFile)) {
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select" id="tx-dlf-tools-fulltext" title="'.$this->pi_getLL('fulltext-select', '', TRUE).'" onclick="tx_dlf_viewer.toggleFulltextSelect();">'.$this->pi_getLL('fulltext-select', '', TRUE).'</a>';
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="'.$this->pi_getLL('fulltext-select', '', TRUE).'" onclick="tx_dlf_viewer.toggleFulltextSelect();">'.$this->pi_getLL('fulltext-select', '', TRUE).'</a>';
} else {
$markerArray['###FULLTEXT_SELECT###'] = $this->pi_getLL('fulltext-select', '', TRUE);
}

View File

@ -28,10 +28,10 @@
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="fulltext-select">Select Fulltext</label>
<label index="fulltext-select">Activate Fulltext</label>
</languageKey>
<languageKey index="de" type="array">
<label index="fulltext-select">Volltext markieren</label>
<label index="fulltext-select">Volltexte an</label>
</languageKey>
</data>
</T3locallang>