Browse Source

add toolsFulltext to toolbox

pull/26/head
Alexander Bigga 7 years ago
parent
commit
a29732f320
  1. 115
      dlf/plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php
  2. 37
      dlf/plugins/toolbox/tools/fulltext/locallang.xml
  3. 25
      dlf/plugins/toolbox/tools/fulltext/template.tmpl

115
dlf/plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php

@ -0,0 +1,115 @@
<?php
/***************************************************************
* Copyright notice
*
* (c) 2015 Goobi. Digitalisieren im Verein e.V. <contact@goobi.org>
* 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!
***************************************************************/
/**
* Tool 'Fulltext selection' for the plugin 'DLF: Toolbox' of the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @author Alexander Bigga <alexander.bigga@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @access public
*/
class tx_dlf_toolsFulltext extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php';
/**
* 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);
// Merge configuration with conf array of toolbox.
$this->conf = t3lib_div::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
// Load current document.
$this->loadDocument();
if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpFulltext'])) {
// 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 (pyhsical page attribute)
if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
$this->piVars['page'] = tx_dlf_helper::intInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
} else {
$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalPages);
}
$this->piVars['double'] = tx_dlf_helper::intInRange($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/toolbox/tools/fulltext/template.tmpl'), '###TEMPLATE###');
}
$fullTextFile = $this->doc->physicalPagesInfo[$this->doc->physicalPages[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
// Get single page downloads.
if (!empty($fullTextFile)) {
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select" title="'.$this->pi_getLL('fulltext-select', '', TRUE).'" onclick="tx_dlf_viewer.fulltextSelect();">'.$this->pi_getLL('fulltext-select', '', TRUE).'</a>';
} else {
$markerArray['###FULLTEXT_SELECT###'] = $this->pi_getLL('fulltext-select', '', TRUE);
}
$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/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php']);
}
?>

37
dlf/plugins/toolbox/tools/fulltext/locallang.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<!--
Copyright notice
(c) 2011 Goobi. Digitalisieren im Verein e.V. <contact@goobi.org>
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!
-->
<T3locallang>
<meta type="array">
<type>module</type>
<description>Language labels for tool tx_dlf_toolsPdf</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="fulltext-select">Select Fulltext</label>
</languageKey>
<languageKey index="de" type="array">
<label index="fulltext-select">Volltext markieren</label>
</languageKey>
</data>
</T3locallang>

25
dlf/plugins/toolbox/tools/fulltext/template.tmpl

@ -0,0 +1,25 @@
<!--
Copyright notice
(c) 2015 Goobi. Digitalisieren im Verein e.V. <contact@goobi.org>
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!
-->
<!-- ###TEMPLATE### -->
<span class="tx-dlf-tools-fulltext">###FULLTEXT_SELECT###</span>
<!-- ###TEMPLATE### -->
Loading…
Cancel
Save