* ADD Page browser (pi_base)
authorjocrau <jocrau@735d13b6-9817-0410-8766-e36946ffe9aa>
Fri, 7 Nov 2008 23:49:54 +0000 (23:49 +0000)
committerBastian Bringenberg <spam@bastian-bringenberg.de>
Thu, 4 Dec 2014 23:56:05 +0000 (00:56 +0100)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/contagged/trunk@13927 735d13b6-9817-0410-8766-e36946ffe9aa

17 files changed:
ChangeLog
ext_tables.php
extensions/contagged/class.tx_rtehtmlarea_contagged.php [new file with mode: 0644]
extensions/contagged/locallang.xml [new file with mode: 0644]
extensions/contagged/skin/htmlarea.css [new file with mode: 0644]
extensions/contagged/skin/images/contagged.gif [new file with mode: 0644]
extensions/contagged/skin/images/contagged.png [new file with mode: 0644]
htmlarea/plugins/contagged/contagged.js [new file with mode: 0644]
htmlarea/plugins/contagged/locallang.xml [new file with mode: 0644]
locallang_db.xml
model/class.tx_contagged_model_terms.php
pi1/class.tx_contagged_pi1.php
pi1/contagged.tmpl
static/constants.txt
static/css/setup.txt
static/setup.txt
tca.php

index abfd0a4..8947755 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
-v0.1.6 2008-11-06 Jochen Rau <j.rau@web.de>
 
-       * IMP some code clean-up
+       * ADD Page browser (pi_base)
+       * ADD Crosslinking between terms
        * ADD You can add images to your term definitions
+       * IMP Some code clean-up and refactorings
+       * CHG Labes in list module are now term_replace, term_main, term_alt
+       * CHG CSS-margins for index chars set to 0px
        
 v0.1.5 2008-09-24 Jochen Rau <j.rau@web.de>
 
index 73f7f47..0e4d87b 100644 (file)
@@ -15,8 +15,8 @@ t3lib_extMgm::addStaticFile($_EXTKEY,'static/css/','Default CSS-styles');
 $TCA["tx_contagged_terms"] = array (
        "ctrl" => array (
                'title'     => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms',         
-               'label'     => 'term_main',
-               'label_alt' => 'term_type',
+               'label'     => 'term_replace',
+               'label_alt' => 'term_main, term_alt',
                'label_alt_force' => TRUE,
                'tstamp'    => 'tstamp',
                'crdate'    => 'crdate',
diff --git a/extensions/contagged/class.tx_rtehtmlarea_contagged.php b/extensions/contagged/class.tx_rtehtmlarea_contagged.php
new file mode 100644 (file)
index 0000000..c11bf53
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Fabien Udriot <fabien.udriot(arobas)ecodev.ch>
+*  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!
+***************************************************************/
+/**
+ * Ecodocument plugin for htmlArea RTE
+ *
+ * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+ *
+ * TYPO3 SVN ID: $Id: class.tx_rtehtmlarea_contagged.php 2985 2008-01-31 11:37:57Z ingmars $
+ *
+ */
+
+require_once(t3lib_extMgm::extPath('rtehtmlarea').'class.tx_rtehtmlareaapi.php');
+
+class tx_rtehtmlarea_contagged extends tx_rtehtmlareaapi {
+
+       protected $extensionKey = 'contagged'; // The key of the extension that is extending htmlArea RTE       
+       protected $pluginName = 'contagged'; // The name of the plugin registered by the extension
+       protected $relativePathToSkin = 'extensions/contagged/skin/htmlarea.css';// Path to the skin (css) file relative to the extension dir.
+       
+       protected $pluginButtons = 'contagged';
+       protected $convertToolbarForHtmlAreaArray = array (
+               'contagged'     => 'contagged', #must be the same in the javascript var buttonId = Dummyplugin
+               );
+       
+       
+        /**
+        * Return JS configuration of the htmlArea plugins registered by the extension
+        *
+        * @param       integer         Relative id of the RTE editing area in the form
+        *
+        * @return string               JS configuration for registered plugins
+        *
+        * The returned string will be a set of JS instructions defining the configuration that will be provided to the plugin(s)
+        * Each of the instructions should be of the form:
+        *      RTEarea['.$RTEcounter.']["buttons"]["button-id"]["property"] = "value";
+        */
+       public function buildJavascriptConfiguration($RTEcounter) {
+               global $TSFE, $LANG;
+               
+               $registerRTEinJavascriptString = '';
+               return $registerRTEinJavascriptString;
+       }
+       
+
+} // end of class
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea_contagged/extensions/contagged/class.tx_rtehtmlarea_contagged.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/rtehtmlarea_contagged/contagged/class.tx_rtehtmlarea_contagged.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/extensions/contagged/locallang.xml b/extensions/contagged/locallang.xml
new file mode 100644 (file)
index 0000000..51aa09d
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <type>database</type>
+               <description>Language labels for extension 'dummyplugin'</description>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="asdf">asdf</label>
+               </languageKey>
+               <languageKey index="fr" type="array">
+                       
+               </languageKey>
+       </data>
+       
+</T3locallang>
\ No newline at end of file
diff --git a/extensions/contagged/skin/htmlarea.css b/extensions/contagged/skin/htmlarea.css
new file mode 100644 (file)
index 0000000..bc434ce
--- /dev/null
@@ -0,0 +1,3 @@
+/* Selectors for the AboutEditor plugin of htmlArea RTE */
+/* TYPO3 SVN ID: $Id $ */
+.htmlarea .toolbar .contagged {background-image:url("images/contagged.gif");}
\ No newline at end of file
diff --git a/extensions/contagged/skin/images/contagged.gif b/extensions/contagged/skin/images/contagged.gif
new file mode 100644 (file)
index 0000000..87c8b61
Binary files /dev/null and b/extensions/contagged/skin/images/contagged.gif differ
diff --git a/extensions/contagged/skin/images/contagged.png b/extensions/contagged/skin/images/contagged.png
new file mode 100644 (file)
index 0000000..75f8c13
Binary files /dev/null and b/extensions/contagged/skin/images/contagged.png differ
diff --git a/htmlarea/plugins/contagged/contagged.js b/htmlarea/plugins/contagged/contagged.js
new file mode 100644 (file)
index 0000000..aec8f5e
--- /dev/null
@@ -0,0 +1,93 @@
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  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.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  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 script is a modified version of a script published under the htmlArea License.
+*  A copy of the htmlArea License may be found in the textfile HTMLAREA_LICENSE.txt.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/*
+ * Character Map Plugin for TYPO3 htmlArea RTE
+ *
+ * TYPO3 SVN ID: $Id: $
+ */
+contagged = HTMLArea.Plugin.extend({
+
+       constructor : function(editor, pluginName) {
+               this.base(editor, pluginName);
+       },
+
+       /*
+        * This function gets called by the class constructor
+        */
+       configurePlugin : function(editor) {
+
+               /*
+                * Registering plugin "About" information
+                */
+               var pluginInformation = {
+                       version         : "1.0",
+                       developer       : "Jochen Rau",
+                       developerUrl    : "http://www.typoplanet.de/",
+                       copyrightOwner  : "Jochen Rau",
+                       sponsor         : "",
+                       sponsorUrl      : "",
+                       license         : "GPL"
+               };
+               this.registerPluginInformation(pluginInformation);
+
+               /*
+                * Registering the button
+                */
+               var buttonId = "contagged";
+               var buttonConfiguration = {
+                       id              : buttonId,
+                       tooltip         : this.localize("contagged"),
+                       action          : "onButtonPress",
+                       textMode        : true,
+                       dialog          : true
+               };
+               this.registerButton(buttonConfiguration);
+
+               return true;
+        },
+
+       /*
+        * This function gets called when the button was pressed.
+        *
+        * @param       object          editor: the editor instance
+        * @param       string          id: the button id or the key
+        *
+        * @return      boolean         false if action is completed
+        */
+       onButtonPress : function(editor, id) {
+
+               if (this.editor.hasSelectedText()) {
+                       var term = this.editor.getSelectedHTML();
+                       vHWin=window.open('http://localhost:8888/t3dev/typo3/alt_doc.php?edit[tx_contagged_terms][2]=edit&columnsOnly=term_main%2Cterm_alt%2Cterm_type%2Cterm_lang%2Cterm_replace%2Cdesc_short%2Cdesc_long%2Clink%2Cexclude&noView=0&returnUrl=close.html','FEquickEditWindow','width=540,height=400,status=0,menubar=0,scrollbars=1,resizable=1');vHWin.focus();return false;
+               }
+               
+               alert(term);
+       }
+});
+
diff --git a/htmlarea/plugins/contagged/locallang.xml b/htmlarea/plugins/contagged/locallang.xml
new file mode 100644 (file)
index 0000000..1cbfe77
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Labels for ecodocuments plugin of htmlArea RTE</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="contagged">Insert Term</label>
+               </languageKey>
+       </data>
+       <orig_hash type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_hash>
+       <orig_text type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_text>
+</T3locallang>
\ No newline at end of file
index e231ebd..903b261 100644 (file)
@@ -21,7 +21,7 @@
                        <label index="tx_contagged_terms.term_replace">Replacement</label>
                        <label index="tx_contagged_terms.desc_short">Short Description (e.g. Tool Tip Text)</label>
                        <label index="tx_contagged_terms.desc_long">Long Description</label>
-                       <label index="tx_contagged_terms.caption">Caption</label>
+                       <label index="tx_contagged_terms.imagecaption">Caption</label>
                        <label index="tx_contagged_terms.imagealt">ALT-Text</label>
                        <label index="tx_contagged_terms.imagetitle">TITLE-Text</label>
                        <label index="tx_contagged_terms.related">See also</label>
@@ -45,7 +45,7 @@
                        <label index="tx_contagged_terms.term_replace">Ersatz</label>
                        <label index="tx_contagged_terms.desc_short">Kurzbeschreibung (z.B. Tool-Tip-Text)</label>
                        <label index="tx_contagged_terms.desc_long">Ausf├╝hrliche Beschreibung</label>
-                       <label index="tx_contagged_terms.caption">Bildunterschrift</label>
+                       <label index="tx_contagged_terms.imagecaption">Bildunterschrift</label>
                        <label index="tx_contagged_terms.imagealt">ALT-Text</label>
                        <label index="tx_contagged_terms.imagetitle">TITLE-Text</label>
                        <label index="tx_contagged_terms.related">Siehe auch</label>
index 56f697b..73653e3 100644 (file)
@@ -36,6 +36,7 @@ class tx_contagged_model_terms {
        var $controller;
        var $tablesArray; // array of all tables in the database
        var $terms;
+       var $configuredSources;
 
        function tx_contagged_model_terms($controller) {
                $this->controller = $controller;
@@ -54,6 +55,10 @@ class tx_contagged_model_terms {
                        }
                }
                
+               foreach ($this->conf['dataSources.'] as $dataSource => $sourceConfiguration) {
+                       $this->configuredSources[] = $sourceConfiguration['sourceName'];
+               }
+               
                $typesArray = $this->conf['types.'];
                $this->terms = array();
                $dataSourceArray = array();
@@ -80,15 +85,20 @@ class tx_contagged_model_terms {
                uasort($this->terms,array($this,'sortByTermAscending'));
        }
 
-       /**
-        * [Describe function...]
-        *
-        * @return      [type]          ...
-        */
        function findAllTerms() {
                return $this->terms;
        }
        
+       function findAllTermsToBeListed($pid = NULL) {
+               $terms = array();
+               foreach ($this->terms as $key => $term) {
+                       if ( $term['exclude']!=1 && $this->conf['types.'][$term['term_type'].'.']['dontListTerms']!=1 && (in_array($pid,$term['listPages']) || $pid === NULL) ) {
+                               $terms[$key] = $term;
+                       }
+               }
+               return $terms;
+       }
+       
        function findTermByUid($sourceName, $uid) {
                $fetchedTerms = array();
                foreach ($this->terms as $key => $term) {
@@ -99,14 +109,11 @@ class tx_contagged_model_terms {
                
                return NULL;
        }
+       
+       function sourceIsConfigured($sourceName) {
+               return in_array($sourceName, $this->configuredSources);
+       }
 
-       /**
-        * [Describe function...]
-        *
-        * @param       [type]          $termArrayA: ...
-        * @param       [type]          $termArrayB: ...
-        * @return      [type]          ...
-        */
        function sortByTermAscending($termArrayA,$termArrayB) {
                // TODO: improve sorting (UTF8, configurable, localized->hook)
                // strcasecmp() internally converts the two strings it is comparing to lowercase, based on the server locale settings. As such, it
@@ -175,13 +182,16 @@ class tx_contagged_model_terms {
                        $result = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
                                'uid_foreign, tablenames', // SELECT ...
                                'tx_contagged_related_mm', // FROM ...
-                               'uid_local=' . $termArray['uid'] // WHERE ..
+                               'uid_local=' . $termArray['uid'], // WHERE ..
+                               'sorting'
                                );
 
                        if (!empty($result)) {
                                $termArray['related'] = array();
                                foreach ($result as $row) {
-                                       $termArray['related'][] = array('sourceName' => $row['tablenames'], 'uid' => $row['uid_foreign']);
+                                       if ($this->sourceIsConfigured($row['tablenames'])) {
+                                               $termArray['related'][] = array('sourceName' => $row['tablenames'], 'uid' => $row['uid_foreign']);
+                                       }
                                }
                        } else {
                                $termArray['related'] = NULL;
index a06a9cf..8796b36 100644 (file)
@@ -64,9 +64,10 @@ class tx_contagged_pi1 extends tslib_pibase {
                $this->typolinkConf['additionalParams'] = $this->cObj->stdWrap($typolinkConf['additionalParams'], $typolinkConf['additionalParams.']);
                unset($this->typolinkConf['additionalParams.']);
                $this->backPid = $this->piVars['backPid'] ? intval($this->piVars['backPid']) : NULL;
+               $this->pointer = $this->piVars['pointer'] ? intval($this->piVars['pointer']) : NULL;
                $this->indexChar = $this->piVars['index'] ? urldecode($this->piVars['index']) : NULL;
                if ( !is_null($this->piVars['key']) ) {
-                       $termKey = (int)$this->piVars['key'];
+                       $termKey = intval($this->piVars['key']);
                }
                $sword = $this->piVars['sword'] ? urldecode($this->piVars['sword']) : NULL;
 
@@ -77,7 +78,15 @@ class tx_contagged_pi1 extends tslib_pibase {
 
                // get the model (an associated array of terms)
                $this->model = new tx_contagged_model_terms($this);
-               $this->termsArray = $this->model->findAllTerms();
+               $this->termsArray = $this->model->findAllTermsToBeListed($GLOBALS['TSFE']->id);
+
+               // setup the page browser
+               $this->internal['res_count'] = count($this->termsArray);
+               $this->internal['results_at_a_time'] = $this->conf['pagebrowser.']['results_at_a_time'] ? intval($this->conf['pagebrowser.']['results_at_a_time']) : 20;
+               $this->internal['maxPages'] = $this->conf['pagebrowser.']['maxPages'] ? intval($this->conf['pagebrowser.']['maxPages']) : 3;
+               $this->internal['dontLinkActivePage'] = $this->conf['pagebrowser.']['dontLinkActivePage'] ? (boolean)$this->conf['pagebrowser.']['dontLinkActivePage'] : TRUE;
+               $this->internal['showFirstLast'] = $this->conf['pagebrowser.']['showFirstLast'] ? (boolean)$this->conf['pagebrowser.']['showFirstLast'] : FALSE;
+               $this->internal['pagefloat'] = 'center';
 
                if ( is_null($termKey) && is_null($sword) ) {
                        $content .= $this->renderList();
@@ -103,12 +112,16 @@ class tx_contagged_pi1 extends tslib_pibase {
                $subparts = $this->getSubparts('LIST');
                $this->renderLinks($markerArray,$wrappedSubpartArray);
                $this->renderIndex($markerArray);
-               foreach ( $this->termsArray as $termKey => $termArray ) {
-                       if ( $termArray['exclude']!=1 && $this->conf['types.'][$termArray['term_type'].'.']['dontListTerms']!=1 && in_array($GLOBALS['TSFE']->id,$termArray['listPages']) ) {
-                               if ( $this->indexChar==NULL || $termArray['indexChar']==$this->indexChar ) {
-                                       $this->renderSingleItem($termKey,$markerArray,$wrappedSubpartArray);
-                                       $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
-                               }
+               if (empty($this->indexChar)) {
+                       $this->renderPageBrowser($markerArray);
+                       $terms = array_slice($this->termsArray, ($this->pointer * $this->internal['results_at_a_time']), $this->internal['results_at_a_time'], TRUE);
+               } else {
+                       $terms = $this->termsArray;
+               }
+               foreach ( $terms as $termKey => $termArray ) {
+                       if ( $this->indexChar==NULL || $termArray['indexChar']==$this->indexChar ) {
+                               $this->renderSingleItem($termKey,$markerArray,$wrappedSubpartArray);
+                               $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
                        }
                }
                $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);
@@ -121,18 +134,14 @@ class tx_contagged_pi1 extends tslib_pibase {
                $this->renderLinks($markerArray,$wrappedSubpartArray);
                $this->renderIndex($markerArray);
                foreach ( $this->termsArray as $termKey => $termArray ) {
-                       if ( $termArray['exclude']!=1 && $this->conf['types.'][$termArray['term_type'].'.']['dontListTerms']!=1 ) {
-                               if ( $this->indexChar==NULL || $termArray['indexChar']==$this->indexChar ) {
-                                       $fieldsToSearch = t3lib_div::trimExplode(',',$this->conf['fieldsToSearch'] );
-                                       foreach ($fieldsToSearch as $field) {                                           
-                                               // TODO make arrays searchable
-                                               $swordMatched = preg_match('/'.preg_quote($sword,'/').'/Uui',$termArray[$field]) ? TRUE : FALSE;
-                                       }
-                                       if ( $swordMatched ) {
-                                               $this->renderSingleItem($termKey,$markerArray,$wrappedSubpartArray);
-                                               $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
-                                       }
-                               }
+                       $fieldsToSearch = t3lib_div::trimExplode(',',$this->conf['fieldsToSearch'] );
+                       foreach ($fieldsToSearch as $field) {                                           
+                               // TODO make arrays searchable
+                               $swordMatched = preg_match('/'.preg_quote($sword,'/').'/Uui',$termArray[$field]) ? TRUE : FALSE;
+                       }
+                       if ( $swordMatched ) {
+                               $this->renderSingleItem($termKey,$markerArray,$wrappedSubpartArray);
+                               $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
                        }
                }
                // TODO Display warning if result is empty
@@ -191,14 +200,6 @@ class tx_contagged_pi1 extends tslib_pibase {
                $wrappedSubpartArray['###LINK_TO_LIST###'] = $this->local_cObj->typolinkWrap($typolinkConf);            
        }
 
-       /**
-        * [Describe function...]
-        *
-        * @param       [type]          $termKey: ...
-        * @param       [type]          $markerArray: ...
-        * @param       [type]          $wrappedSubpartArray: ...
-        * @return      [type]          ...
-        */
        function renderSingleItem ($termKey,&$markerArray,&$wrappedSubpartArray) {
                $termArray = $this->termsArray[$termKey];
                $typeConfigArray = $this->conf['types.'][$termArray['term_type'] . '.'];
@@ -245,34 +246,41 @@ class tx_contagged_pi1 extends tslib_pibase {
                        foreach ($term['related'] as $termReference) {
                                $result = $this->model->findTermByUid($termReference['sourceName'], $termReference['uid']);
                                $key = key($result);
-                               $relatedTerm = current($result);
-                               $typolinkConf = $this->typolinkConf;
-                               $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[key]=' . $key;
-                               $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
-                               $relatedCode .= '<div>' . $this->local_cObj->typoLink($relatedTerm['term'], $typolinkConf) . '</div>';
+                               if (array_key_exists($key, $this->termsArray)) {
+                                       $relatedTerm = current($result);
+                                       $typolinkConf = $this->typolinkConf;
+                                       $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[key]=' . $key;
+                                       $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
+                                       $relatedCode .= '<div>' . $this->local_cObj->typoLink($relatedTerm['term'], $typolinkConf) . '</div>';                                  
+                               }
                        }
+                       return $this->local_cObj->wrap(trim($relatedCode), $this->conf['related.']['wrapIfAny']);
+               } else {
+                       return NULL;
                }
-               // debug($relatedTerms);
-               return $this->local_cObj->wrap(trim($relatedCode), $this->conf['related.']['wrapIfAny']);
        }
        
        function getImages($termArray) {
-               $imagesConf = $this->conf['images.']['single.'];
-               $images = t3lib_div::trimExplode(',', $termArray['image'], 1);
-               $imagesCaption = t3lib_div::trimExplode(chr(10), $termArray['imagecaption']);
-               $imagesAltText = t3lib_div::trimExplode(chr(10), $termArray['imagealt']);
-               $imagesTitleText = t3lib_div::trimExplode(chr(10), $termArray['imagetitle']);
-               $imagesCode = '';
-               foreach ($images as $key => $image) {
-                       $imagesConf['image.']['altText'] = $imagesAltText[$key];
-                       $imagesConf['image.']['titleText'] = $imagesTitleText[$key];
-                       $imagesConf['image.']['file'] = 'uploads/pics/' . $image;
-                       $imagesCode .= $this->local_cObj->IMAGE($imagesConf['image.']) . $this->local_cObj->stdWrap($imagesCaption[$key], $this->conf['images.']['caption.']['stdWrap.']);
+               if (!empty($termArray['image'])) {
+                       $imagesConf = $this->conf['images.']['single.'];
+                       $images = t3lib_div::trimExplode(',', $termArray['image'], 1);
+                       $imagesCaption = t3lib_div::trimExplode(chr(10), $termArray['imagecaption']);
+                       $imagesAltText = t3lib_div::trimExplode(chr(10), $termArray['imagealt']);
+                       $imagesTitleText = t3lib_div::trimExplode(chr(10), $termArray['imagetitle']);
+                       $imagesCode = '';
+                       foreach ($images as $key => $image) {
+                               $imagesConf['image.']['altText'] = $imagesAltText[$key];
+                               $imagesConf['image.']['titleText'] = $imagesTitleText[$key];
+                               $imagesConf['image.']['file'] = 'uploads/pics/' . $image;
+                               $imagesCode .= $this->local_cObj->IMAGE($imagesConf['image.']) . $this->local_cObj->stdWrap($imagesCaption[$key], $this->conf['images.']['caption.']['stdWrap.']);
+                       }
+                       return $this->local_cObj->wrap(trim($imagesCode), $this->conf['images.']['wrapIfAny']);
+               } else {
+                       return NULL;
                }
-               return $this->local_cObj->wrap(trim($imagesCode), $this->conf['images.']['wrapIfAny']);
        }
 
-       function renderIndex (&$markerArray) {
+       function renderIndex(&$markerArray) {
                $subparts = array();
                $subparts['template_index'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_INDEX###');
                $subparts['item'] = $this->cObj->getSubpart($subparts['template_index'],'###ITEM###');
@@ -294,13 +302,6 @@ class tx_contagged_pi1 extends tslib_pibase {
                        }
                        $subpartArray['###INDEX_CONTENT###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'], $markerArray);
                }
-
-               // // make "link to all entries"
-               // unset($typolinkConf);
-               // $typolinkConf = $this->typolinkConf;
-               // $allLink = $this->local_cObj->typolink($this->pi_getLL('all'), $typolinkConf);
-               // $markerArray['###INDEX_ALL###'] = $allLink;
-
                $markerArray['###INDEX###'] = $this->cObj->substituteMarkerArrayCached($subparts['template_index'], $markerArray, $subpartArray);
        }
 
@@ -350,6 +351,15 @@ class tx_contagged_pi1 extends tslib_pibase {
                return $indexArray;
        }
        
+       function renderPageBrowser(&$markerArray) {
+               if ($this->internal['res_count'] > $this->internal['results_at_a_time']) {
+                       $showResultCount = $this->conf['pagebrowser.']['showResultCount'] ? (boolean)$this->conf['pagebrowser.']['showResultCount'] : FALSE;
+                       $markerArray['###PAGEBROWSER###'] = $this->pi_list_browseresults($showResultCount);
+               } else {
+                       $markerArray['###PAGEBROWSER###'] = '';                 
+               }
+       }
+       
        protected function removeUnfilledMarker($content) {
                return preg_replace('/###.*?###/', '', $content);
        }
index 0fe921c..c014ff7 100644 (file)
@@ -51,6 +51,7 @@
                This is the template to display a list of terms
        -->
        ###INDEX###
+       ###PAGEBROWSER###
        ###SEARCHBOX###
        <dl class="tx-contagged-list">
                <!-- ###LIST###-->
@@ -62,6 +63,7 @@
                <!-- ###LIST###-->
        </dl>
        ###INDEX###
+       ###PAGEBROWSER###
        <!-- ###TEMPLATE_LIST### end -->
 
        <h2>TEMPLATE_SINGLE</h2>
index 2a1dc9a..45f59bd 100644 (file)
@@ -86,4 +86,18 @@ contagged {
        # cat=plugin.contagged//99; type=boolean; label=[Add Back Link]: Add the page title to the back link.
        addBackLinkDescription = 1
 
+       # cat=plugin.contagged/pagebrowser/10; type=int; label=[Results at a time]: Number of results to be displayed on a single page.
+       results_at_a_time = 20
+
+       # cat=plugin.contagged/pagebrowser/20; type=int; label=[Number of pages]: Number of pages to be displayed in the page browser at once.
+       maxPages = 3
+
+       # cat=plugin.contagged/pagebrowser/30; type=boolean; label=[Don't link active page]
+       dontLinkActivePage = 1
+
+       # cat=plugin.contagged/pagebrowser/40; type=boolean; label=[Show "First"/"Last"]: Show link to first and last page.
+       showFirstLast = 0
+
+       # cat=plugin.contagged/pagebrowser/50; type=boolean; label=[Show result counter]
+       showResultCount = 0
 }
\ No newline at end of file
index 7dd2666..25c198f 100644 (file)
@@ -16,7 +16,7 @@ plugin.tx_contagged {
                        font-size: 1.2em;
                }
                div.tx-contagged-index span {
-                       margin: 0 3px;
+                       margin: 0;
                }
        )
 }
\ No newline at end of file
index f75c6e0..dde9dbc 100644 (file)
@@ -59,6 +59,14 @@ plugin.tx_contagged {
                }
        }
        
+       pagebrowser {
+               results_at_a_time = {$contagged.results_at_a_time}
+               maxPages = {$contagged.maxPages}
+               dontLinkActivePage = {$contagged.dontLinkActivePage}
+               showFirstLast = {$contagged.showFirstLast}
+               showResultCount = {$contagged.showResultCount}
+       }
+       
        types {
 
                definition {
diff --git a/tca.php b/tca.php
index 1adf004..d149d63 100644 (file)
--- a/tca.php
+++ b/tca.php
@@ -201,7 +201,7 @@ $TCA["tx_contagged_terms"] = array (
                        ),
                        'imagecaption' => Array (
                                'exclude' => 1,
-                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagealt',
+                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagecaption',
                                'l10n_mode' => $l10n_mode,
                                'config' => Array (
                                        'type' => 'text',
@@ -238,6 +238,7 @@ $TCA["tx_contagged_terms"] = array (
                                        'internal_type' => 'db',
                                        'allowed' => '*',
                                        'MM' => 'tx_contagged_related_mm',
+                                       'show_thumbs' => 1,
                                        'size' => 3,
                                        'autoSizeMax' => 20,
                                        'maxitems' => 9999,
@@ -249,7 +250,7 @@ $TCA["tx_contagged_terms"] = array (
                                "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.link",
                                "config" => Array (
                                        "type"     => "input",
-                                       "size"     => "15",
+                                       "size"     => "28",
                                        "max"      => "255",
                                        "checkbox" => "",
                                        "eval"     => "trim",