* ADD Mini list of terms found on a single page (CODE: "MINILIST")
authorjocrau <jocrau@735d13b6-9817-0410-8766-e36946ffe9aa>
Thu, 13 Nov 2008 12:17:11 +0000 (12:17 +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@14106 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
class.tx_contagged.php
ext_tables.sql
model/class.tx_contagged_model_terms.php
pi1/class.tx_contagged_pi1.php
pi1/contagged.tmpl
static/constants.txt
static/examples/setup.txt
static/setup.txt
tca.php

index 7a31d57..be0a652 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 
+       * ADD Mini list of terms found on a single page (CODE: "MINILIST")
        * CHG Restructured TS Setup for FE-List (please adapt your local TS Setup!)
        * ADD Search box (pi_base)
        * IMP You can disable the index, the search box and the page browser by TS Setup
index 4e7bf2d..abadffd 100644 (file)
@@ -106,14 +106,12 @@ class tx_contagged extends tslib_pibase {
                }
                $parsedContent = implode('',$splittedContent);
                
-
                // update the keywords (field "tx_contagged_keywords" in table "page")
-               if ($this->conf['updateKeywords']>0) {
-                       $this->insertKeywords();
+               if ($this->conf['updateKeywords'] > 0) {
+                       $this->updatePageKeywords();
                }
 
                return $parsedContent;
-
        }
        
        function sortArrayByLengthDescending($a,$b) {
@@ -173,19 +171,18 @@ class tx_contagged extends tslib_pibase {
                                foreach ($checkArray as $start => $value) {
                                        $length = strlen($value['matchedTerm']);
                                        $end = $start+$length;
-                                       if ( ($matchStart>=$start&&$matchStart<$end) || ($matchEnd>$start&&$matchEnd<=$end) ) {
+                                       if ( (($matchStart >= $start) && ($matchStart < $end)) || (($matchEnd > $start) && ($matchEnd <= $end)) ) {
                                                $isNested = TRUE;
                                        }
-                               }
-                               
-                               // change the sign of the matchStart if the matchedTerm is nested
-                               $matchStart = $isNested ? -$matchStart : $matchStart;
-                               $positionsArray[$matchStart] = array(
-                                       'termKey' => $termKey,
-                                       'matchedTerm' => $matchedTerm,
-                                       'preMatch' => $preMatch[0],
-                                       'postMatch' => $postMatch[0]
-                                       );
+                               }                               
+                               if (!$isNested) {
+                                       $positionsArray[$matchStart] = array(
+                                               'termKey' => $termKey,
+                                               'matchedTerm' => $matchedTerm,
+                                               'preMatch' => $preMatch[0],
+                                               'postMatch' => $postMatch[0]
+                                               );
+                               }       
                        }
                }
        }
@@ -195,14 +192,12 @@ class tx_contagged extends tslib_pibase {
                $newContent = '';
                if($positionsArray){
                        foreach ($positionsArray as $matchStart => $matchArray) {
-                               if ($matchStart>=0) { // ignore nested matches
-                                       $matchLength = strlen($matchArray['matchedTerm']);
-                                       $termKey = $matchArray['termKey'];
-                                       $replacement = $this->getReplacement($termKey,$matchArray['matchedTerm'],$matchArray['preMatch'],$matchArray['postMatch']);
-                                       $replacementLength = strlen($replacement);
-                                       $newContent = $newContent.substr($content,$posStart,$matchStart-$posStart).$replacement;
-                                       $posStart = $matchStart+$matchLength;
-                               }
+                               $matchLength = strlen($matchArray['matchedTerm']);
+                               $termKey = $matchArray['termKey'];
+                               $replacement = $this->getReplacement($termKey, $matchArray['matchedTerm'], $matchArray['preMatch'], $matchArray['postMatch']);
+                               $replacementLength = strlen($replacement);
+                               $newContent = $newContent.substr($content,$posStart,$matchStart-$posStart).$replacement;
+                               $posStart = $matchStart + $matchLength;
                        }
                        $newContent = $newContent.substr($content,$posStart);
                } else {
@@ -242,17 +237,17 @@ class tx_contagged extends tslib_pibase {
                        // if the first letter of the matched term is upper case
                        // make the first letter of the replacing term also upper case
                        // (\p{Lu} stands for "unicode letter uppercase")
+                       $GLOBALS['TSFE']->register['contagged_matchedTerm'] = $termArray['term_replace'];
+                       $this->updateIndex($termKey, $termArray['term_replace']);
                        if ( preg_match('/^\p{Lu}/u',$matchedTerm)>0 ) {
                                $matchedTerm = $preMatch . ucfirst($termArray['term_replace']) . $postMatch;
                                // TODO ucfirst is not UTF8 safe; it depends on the locale settings (they could be ASCII)
                        } else {
                                $matchedTerm = $preMatch . $termArray['term_replace'] . $postMatch;
                        }
-               }
-
-               $GLOBALS['TSFE']->register['contagged_matchedTerm'] = $matchedTerm;
-               if ( !$termArray['exclude'] && !$typeConfigArray['dontListTerms'] ) {
-                       $GLOBALS['TSFE']->register['contagged_termsFound'][] = strip_tags($matchedTerm);
+               } else {
+                       $GLOBALS['TSFE']->register['contagged_matchedTerm'] = $matchedTerm;
+                       $this->updateIndex($termKey, $termArray['term']);
                }
 
                // call stdWrap to handle the matched term via TS BEFORE it is wraped with a-tags
@@ -271,15 +266,27 @@ class tx_contagged extends tslib_pibase {
                if ( !empty($typeConfigArray['tag']) ) {
                        $matchedTerm = $before . $matchedTerm . $after;
                }
-               
+                               
                // TODO Edit Icons
                // $editIconsConf = array(
                //      'styleAttribute' => '',
                //      );
-               $matchedTerm = $this->cObj->editIcons($matchedTerm,'tx_contagged_terms:sys_language_uid,hidden,starttime,endtime,fe_group,term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,link,exclude',$editIconsConf,'tx_contagged_terms:'.$termArray['uid'],NULL,'&defVals[tx_contagged_terms][desc_short]=TEST');
+               $matchedTerm = $this->cObj->editIcons($matchedTerm,'tx_contagged_terms:sys_language_uid,hidden,starttime,endtime,fe_group,term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,image,dam_images,imagecaption,imagealt,imagetitle,related,link,exclude',$editIconsConf,'tx_contagged_terms:'.$termArray['uid'],NULL,'&defVals[tx_contagged_terms][desc_short]=TEST');
                
                return $matchedTerm;
+       }
 
+
+       function updateIndex($termKey, $matchedTerm) {
+               $currentRecord = split(':',$this->cObj->currentRecord);
+               $GLOBALS['T3_VAR']['ext']['contagged']['index'][$GLOBALS['TSFE']->id][$termKey] = array(
+                       'matchedTerm' => $matchedTerm,
+                       'termSourceName' => $this->termsArray[$termKey]['sourceName'],
+                       'termUid' => $this->termsArray[$termKey]['uid'],
+                       'currentRecordSourceName' => $currentRecord[0],
+                       'currentRecordUid' => $currentRecord[1],
+                       'currentPid' => $GLOBALS['TSFE']->id
+                       );
        }
 
        /**
@@ -310,37 +317,22 @@ class tx_contagged extends tslib_pibase {
                return $tagList;
        }
 
-       function insertKeywords() {
-               $GLOBALS['TSFE']->register['contagged_termsFound'] = array_unique((array)$GLOBALS['TSFE']->register['contagged_termsFound']);
-               // make a list of unique terms found in the content
-               $termsFoundList = implode(',',$GLOBALS['TSFE']->register['contagged_termsFound']);
-               // build an array to be passed to the UPDATE query
-               $updateArray = array($this->prefixId . '_keywords' => $termsFoundList);
-               // $updateArray = array('keywords' => $termsFoundList);
-               // execute sql-query
+       function updatePageKeywords() {
+               $terms = array();
+               if (is_array($GLOBALS['T3_VAR']['ext']['contagged']['index'][$GLOBALS['TSFE']->id])) {
+                       foreach ($GLOBALS['T3_VAR']['ext']['contagged']['index'][$GLOBALS['TSFE']->id] as $termKey => $indexArray) {
+                               $terms[] = $indexArray['matchedTerm'];
+                       }
+               }
+               $termsList = implode(',', $terms);
                $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
                        'pages', // TABLE ...
                        'uid=' . $GLOBALS['TSFE']->id, // WHERE ...
-                       $updateArray
+                       array($this->prefixId . '_keywords' => $termsList)
                        );
        }
        
        /**
-        * Cleans up a string of keywords. Keywords at splitted by "," (comma)  ";" (semi colon) and linebreak
-        *
-        * @param       string          String of keywords
-        * @return      string          Cleaned up string, keywords will be separated by a comma only.
-        */
-       function keywords($content)     {
-               $listArr = split(',|;|'.chr(10),$content);
-               reset($listArr);
-               while(list($k,$v)=each($listArr))       {
-                       $listArr[$k]=trim($v);
-               }
-               return implode(',',$listArr);
-       }
-       
-       /**
         * Register the fields in $GLOBALS['TSFE] to be used in the TS Setup 
         *
         * @param       array           $typeConfigArray: Configuration array of the term
@@ -388,7 +380,6 @@ class tx_contagged extends tslib_pibase {
                if ($makeLink) {
                    $cache = 0;
                    $this->pi_USER_INT_obj = 1;
-                   $this->prefixId = 'tx_contagged_pi1';
                    $label = $matchedTerm;  // the link text
                    $overrulePIvars = array(
                                'backPid' => $GLOBALS['TSFE']->id,
@@ -402,14 +393,13 @@ class tx_contagged extends tslib_pibase {
                        }
                        $GLOBALS['TSFE']->register['contagged_list_page'] = $altPageId;
                    $matchedTerm = $this->pi_linkTP_keepPIvars($matchedTerm, $overrulePIvars, $cache, $clearAnyway, $altPageId);
-                       $this->prefixId = 'tx_contagged';
                }
                
                return $matchedTerm;
        }
 
        /**
-        * undocumented function
+        * Overwrite global settings with settings of the type configuration.
         *
         * @param string $typeConfigArray 
         * @param string $attributeName 
@@ -454,7 +444,7 @@ class tx_contagged extends tslib_pibase {
        }
 
        /**
-        * undocumented function
+        * Renders the title attribute of the tag.
         *
         * @param string $typeConfigArray 
         * @param string $termArray 
@@ -470,7 +460,7 @@ class tx_contagged extends tslib_pibase {
        }
 
        /**
-        * [Describe function...]
+        * Renders the class attribute of the tag.
         *
         * @param       [type]          $typeConfigArray: ...
         * @param       [type]          $termArray: ...
index 5914712..1cda653 100644 (file)
@@ -46,22 +46,19 @@ CREATE TABLE tx_contagged_terms (
        KEY t3ver_oid (t3ver_oid,t3ver_wsid)
 );
 
-
-
 #
 # Table structure for table 'tx_contagged_related_mm'
 #
 CREATE TABLE tx_contagged_related_mm (
-  uid_local int(11) unsigned DEFAULT '0' NOT NULL,
-  uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
-  sorting int(11) unsigned DEFAULT '0' NOT NULL,
-  tablenames tinytext NOT NULL,
+       uid_local int(11) unsigned DEFAULT '0' NOT NULL,
+       uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
+       sorting int(11) unsigned DEFAULT '0' NOT NULL,
+       tablenames tinytext NOT NULL,
 
-  KEY uid_local (uid_local),
-  KEY uid_foreign (uid_foreign)
+       KEY uid_local (uid_local),
+       KEY uid_foreign (uid_foreign)
 );
 
-
 #
 # Table structure for table 'pages'
 #
index fb483f4..66a44b5 100644 (file)
@@ -89,16 +89,17 @@ class tx_contagged_model_terms {
                return $this->terms;
        }
        
-       function findAllTermsToBeListed($pid = NULL) {
+       function findAllTermsToListOnPage($pid = NULL) {
                $terms = array();
+               if ($pid === NULL) $pid = $GLOBALS['TSFE']->id;
                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) ) {
+                       if ( ($term['exclude'] == 0) && ($this->conf['types.'][$term['term_type'].'.']['dontListTerms'] == 0) && (in_array($pid, $term['listPages']) || is_array($GLOBALS['T3_VAR']['ext']['contagged']['index'][$pid][$key])) ) {
                                $terms[$key] = $term;
                        }
                }
                return $terms;
        }
-       
+               
        function findTermByUid($sourceName, $uid) {
                $fetchedTerms = array();
                foreach ($this->terms as $key => $term) {
@@ -149,8 +150,8 @@ class tx_contagged_model_terms {
                if (t3lib_div::inArray($this->tablesArray,$sourceName) ) {
                        // Build WHERE-clause
                        $whereClause = '1=1';
-                       $whereClause .= $storagePidsList ? ' AND pid IN ('.$storagePidsList.')' : '';
-                       $whereClause .= $dataSourceConfigArray['hasSysLanguageUid'] ? ' AND (sys_language_uid='.intval($GLOBALS['TSFE']->sys_language_uid) . ' OR sys_language_uid=-1)' : '';
+                       $whereClause .= $storagePidsList ? ' AND pid IN (' . $storagePidsList . ')' : '';
+                       $whereClause .= $dataSourceConfigArray['hasSysLanguageUid'] ? ' AND (sys_language_uid=' . intval($GLOBALS['TSFE']->sys_language_uid) . ' OR sys_language_uid=-1)' : '';
                        $whereClause .= tslib_cObj::enableFields($sourceName);
 
                        // execute SQL-query
@@ -164,6 +165,7 @@ class tx_contagged_model_terms {
                        $dataArray = $this->mapper->getDataArray($result,$dataSource);
                }
                $this->fetchRelatedTerms($dataArray);
+               // $this->fetchIndex($dataArray);
                
                // TODO piVars as a data source
 
@@ -193,6 +195,25 @@ class tx_contagged_model_terms {
                }
                $dataArray = $newDataArray;
        }
+
+
+       function fetchIndex(&$dataArray) {
+               foreach ($dataArray as $key => $termArray) {
+                       
+                       if (!empty($result)) {
+                               $termArray['related'] = array();
+                               foreach ($result as $row) {
+                                       if ($this->sourceIsConfigured($row['tablenames'])) {
+                                               $termArray['related'][] = array('sourceName' => $row['tablenames'], 'uid' => $row['uid_foreign']);
+                                       }
+                               }
+                       } else {
+                               $termArray['related'] = NULL;
+                       }
+                       $newDataArray[] = $termArray;
+               }
+               $dataArray = $newDataArray;
+       }
        
        
        
index efadeec..599fd7f 100644 (file)
@@ -53,11 +53,11 @@ class tx_contagged_pi1 extends tslib_pibase {
         * @param       array           $conf: The configuration
         * @return      string                  a single or list view of terms
         */
-       function main($content) {
+       function main($content, $conf) {
                $this->local_cObj = t3lib_div::makeInstance('tslib_cObj');
                $this->local_cObj->setCurrentVal($GLOBALS['TSFE']->id);
                $this->pi_loadLL();
-               $this->conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_contagged.'];
+               $this->conf = t3lib_div::array_merge_recursive_overrule($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_contagged.'], $conf);
                $this->templateCode = $this->cObj->fileResource($this->conf['templateFile']?$this->conf['templateFile']:$this->templateFile);
                $this->typolinkConf = $this->conf['typolink.'];
                $this->typolinkConf['parameter.']['current'] = 1;
@@ -65,30 +65,23 @@ class tx_contagged_pi1 extends tslib_pibase {
                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;
+               $this->indexChar = $this->piVars['index'] ? urldecode($this->piVars['index']) : NULL; // TODO The length should be configurable
                if ( !is_null($this->piVars['key']) ) {
                        $termKey = intval($this->piVars['key']);
-               }
+               }               
                $sword = $this->piVars['sword'] ? htmlspecialchars(urldecode($this->piVars['sword'])) : NULL;
 
                // get an array of all type configurations
                $this->typesArray = $this->conf['types.'];
 
-               $this->mapper = new tx_contagged_model_mapper($this);
-
                // get the model (an associated array of terms)
+               $this->mapper = new tx_contagged_model_mapper($this);
                $this->model = new tx_contagged_model_terms($this);
-               $this->termsArray = $this->model->findAllTermsToBeListed($GLOBALS['TSFE']->id);
+               $this->termsArray = $this->model->findAllTermsToListOnPage();
 
-               // 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) ) {
+               if (($this->conf['minilist'] > 0) || ($this->cObj->data['select_key'] == 'MINILIST')) {
+                       $content .= $this->renderMiniList();
+               } elseif ( is_null($termKey) && is_null($sword) ) {
                        $content .= $this->renderList();
                } elseif ( is_null($termKey) && !is_null($sword) ) {
                        $content .= $this->renderListBySword($sword);
@@ -113,17 +106,38 @@ class tx_contagged_pi1 extends tslib_pibase {
                $this->renderLinks($markerArray,$wrappedSubpartArray);
                $this->renderIndex($markerArray);
                $this->renderSearchBox($markerArray);
-               if (empty($this->indexChar) && ($this->conf['pagebrowser.']['enable'] > 0)) {
-                       $this->renderPageBrowser($markerArray);
-                       $terms = array_slice($this->termsArray, ($this->pointer * $this->internal['results_at_a_time']), $this->internal['results_at_a_time'], TRUE);
+               $indexedTerms = array();
+               foreach ( $this->termsArray as $termKey => $termArray ) {
+                       if ( $this->indexChar==NULL || $termArray['indexChar']==$this->indexChar ) {
+                               $indexedTerms[$termKey] = $termArray;
+                       }
+               }
+               if ( $this->conf['pagebrowser.']['enable'] > 0 ) {
+                       $this->renderPageBrowser($markerArray, count($indexedTerms));
+                       $terms = array_slice($indexedTerms, ($this->pointer * $this->internal['results_at_a_time']), $this->internal['results_at_a_time'], TRUE);
                } else {
-                       $terms = $this->termsArray;
+                       $terms = $indexedTerms;
                }
                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);
-                       }
+                       $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);
+
+               return $content;
+       }
+
+       /**
+        * Renders the mini list of terms
+        *
+        * @return      $string The list as HTML
+        */
+       function renderMiniList() {
+               $subparts = $this->getSubparts('MINILIST');
+               $terms = $this->termsArray;
+               foreach ( $terms as $termKey => $termArray ) {
+                       $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);
 
@@ -181,14 +195,14 @@ class tx_contagged_pi1 extends tslib_pibase {
 
        // TODO hook "newRenderFunction"
 
-       function getSubparts($templateName='LIST') {
+       function getSubparts($templateName = 'LIST') {
                $subparts['template_list'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_' . $templateName . '###');
-               $subparts['item'] = $this->cObj->getSubpart($subparts['template_list'],'###ITEM###');
+               $subparts['item'] = $this->cObj->getSubpart($subparts['template_list'], '###ITEM###');
 
                return $subparts;
        }
 
-       function renderLinks(&$markerArray,&$wrappedSubpartArray) {
+       function renderLinks(&$markerArray, &$wrappedSubpartArray) {
                // make "back to..." link
                if ($this->backPid) {
                        if($this->conf['addBackLinkDescription']>0) {
@@ -220,14 +234,14 @@ class tx_contagged_pi1 extends tslib_pibase {
                $typeConfigArray = $this->conf['types.'][$termArray['term_type'] . '.'];
 
                $markerArray['###TERM_TYPE###'] = $typeConfigArray['label'];
-               $markerArray['###TERM###'] = $this->cObj->editIcons($termArray['term'],'tx_contagged_terms:term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,link,exclude',$editIconsConf,'tx_contagged_terms:'.$termArray['uid']);
+               $markerArray['###TERM###'] = $this->cObj->editIcons($termArray['term'],'tx_contagged_terms:term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,image,dam_images,imagecaption,imagealt,imagetitle,related,link,exclude',$editIconsConf,'tx_contagged_terms:'.$termArray['uid']);
                $markerArray['###TERM_MAIN###'] = $termArray['term_main'];
                $markerArray['###TERM_ALT###'] = $termArray['term_alt']?implode(', ',$termArray['term_alt']):$this->pi_getLL('na');
                $markerArray['###TERM_REPLACE###'] = $termArray['term_replace']?$termArray['term_replace']:$this->pi_getLL('na');
                $markerArray['###DESC_SHORT###'] = $termArray['desc_short']?$termArray['desc_short']:$this->pi_getLL('na');
                $markerArray['###DESC_LONG###'] = $termArray['desc_long']?$termArray['desc_long']:$this->pi_getLL('na');
-               $markerArray['###IMAGES###'] = $this->getImages($termArray);
-               $markerArray['###RELATED###'] = $this->getRelated($termArray);
+               $markerArray['###IMAGES###'] = $this->renderImages($termArray);
+               $markerArray['###RELATED###'] = $this->renderRelated($termArray);
                $markerArray['###TERM_LANG###'] = $this->pi_getLL('lang.'.$termArray['term_lang'])?$this->pi_getLL('lang.'.$termArray['term_lang']):$this->pi_getLL('na');
 
                $labelWrap['wrap'] = $typeConfigArray['labelWrap1']?$typeConfigArray['labelWrap1']:$this->conf['labelWrap1'];
@@ -247,11 +261,13 @@ class tx_contagged_pi1 extends tslib_pibase {
                unset($typolinkConf);
                $typolinkConf = $this->typolinkConf;
                $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[key]=' . $termKey;
+               $typolinkConf['parameter'] = $termArray['listPages'][0];
+               $this->typolinkConf['parameter.']['current'] = 0;
                $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
                $wrappedSubpartArray['###LINK_DETAILS###'] = $this->local_cObj->typolinkWrap($typolinkConf);
        }
        
-       function getRelated($term) {
+       function renderRelated($term) {
                $relatedCode = '';
                if (is_array($term['related'])) {
                        foreach ($term['related'] as $termReference) {
@@ -271,7 +287,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                }
        }
        
-       function getImages($termArray) {
+       function renderImages($termArray) {
                $images = array();
                $imagesCaption = array();
                $imagesAltText = array();
@@ -379,7 +395,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                                        }
                                }
                                // If the term matches no given index char, crate one if desired and add it to the index
-                               if ( $this->termsArray[$termKey]['indexChar']=='' && $this->conf['index.']['autoAddIndexChars']==1 ) {                                  
+                               if ( ($this->termsArray[$termKey]['indexChar'] == '') && ($this->conf['index.']['autoAddIndexChars'] == 1) ) {                                  
                                        // get the first char of the term (UTF8)
                                        // TODO: Make the RegEx configurable to make ZIP-Codes possible
                                        preg_match('/^./' . $this->conf['modifier'],$termArray[$sortField],$match);
@@ -398,7 +414,14 @@ class tx_contagged_pi1 extends tslib_pibase {
                return $indexArray;
        }
        
-       function renderPageBrowser(&$markerArray) {
+       function renderPageBrowser(&$markerArray, $resultCount) {
+               // setup the page browser
+               $this->internal['res_count'] = $resultCount;
+               $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'] : FALSE;
+               $this->internal['showFirstLast'] = $this->conf['pagebrowser.']['showFirstLast'] ? (boolean)$this->conf['pagebrowser.']['showFirstLast'] : FALSE;
+               $this->internal['pagefloat'] = 'center';
                if ( ($this->internal['res_count'] > $this->internal['results_at_a_time']) && ($this->conf['pagebrowser.']['enable'] > 0)) {
                        $showResultCount = $this->conf['pagebrowser.']['showResultCount'] ? (boolean)$this->conf['pagebrowser.']['showResultCount'] : FALSE;
                        $markerArray['###PAGEBROWSER###'] = $this->pi_list_browseresults($showResultCount);
index c014ff7..2884b04 100644 (file)
        ###PAGEBROWSER###
        <!-- ###TEMPLATE_LIST### end -->
 
+
+
+       <h2>TEMPLATE_MINI_LIST</h2>
+
+       <!-- ###TEMPLATE_MINILIST### begin
+               This is the template to display a list of terms
+       -->
+       <dl class="tx-contagged-list">
+               <!-- ###LIST###-->
+                       <!-- ###ITEM###-->              
+                               <dt><!--###LINK_DETAILS###-->###TERM###<!--###LINK_DETAILS###--></dt>
+                               <dd>###DESC_SHORT###</dd>
+                       <!-- ###ITEM###-->
+               <!-- ###LIST###-->
+       </dl>
+       <!-- ###TEMPLATE_MINILIST### end -->
+
+
        <h2>TEMPLATE_SINGLE</h2>
 
        <!-- ###TEMPLATE_SINGLE### begin
index a1024d4..70c35a2 100644 (file)
@@ -51,13 +51,13 @@ contagged {
        fieldsToMap = uid,pid,term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,image,imagecaption,imagealt,imagetitle,related,link,exclude
        # cat=contagged (list)//94; type=string; label=Secured Fields
        secureFields = 
-       # cat=contagged (list)//enable/99; type=boolean; label=Add Back Link: Add the page title to the back link.
+       # cat=contagged (list)/enable/99; type=boolean; label=Add Back Link: Add the page title to the back link.
        addBackLinkDescription = 1
-       # cat=contagged (list)//enable/10; type=boolean; label=Show index: Show the alphabetical index.
+       # cat=contagged (list)/enable/10; type=boolean; label=Show index: Show the alphabetical index.
        enableIndex = 1
-       # cat=contagged (list)//enable/20; type=boolean; label=Show search box
+       # cat=contagged (list)/enable/20; type=boolean; label=Show search box
        enableSearchBox = 1
-       # cat=contagged (list)//enable/30; type=boolean; label=Show page browser:
+       # cat=contagged (list)/enable/30; type=boolean; label=Show page browser:
        enablePageBrowser = 1
        # cat=contagged (list)//20; type=boolean; label=Only matched Index: Show only those index chars, for which a term matches.
        showOnlyMatchedIndexChars = 0
index 24ec9c5..81e0aac 100755 (executable)
@@ -69,30 +69,30 @@ plugin.tx_contagged {
                        }
                }
                
-               location {
-                       label = Location
-                       label.de = Ortsbezeichnung
-                       tag = strong
-               }
-
-               price {
-                       label = Price
-                       label.de = Preis
-                       termStdWrap.wrap = ***|***
-                       linkToListPage = 0
-                       stdWrap.wrap = |&nbsp;Euro
-                       dontListTerms = 1
-               }
-
-               regex {
-                       label = Regular Expression
-                       label.de = Regulärer Ausdruck
-                       linkToListPage = 1
-                       termIsRegEx = 1
-                       secureFields =
-                       dontListTerms = 0
-               }
-               
+#              location {
+#                      label = Location
+#                      label.de = Ortsbezeichnung
+#                      tag = strong
+#              }
+# 
+#              price {
+#                      label = Price
+#                      label.de = Preis
+#                      termStdWrap.wrap = ***|***
+#                      linkToListPage = 0
+#                      stdWrap.wrap = |&nbsp;Euro
+#                      dontListTerms = 1
+#              }
+# 
+#              regex {
+#                      label = Regular Expression
+#                      label.de = Regulärer Ausdruck
+#                      linkToListPage = 1
+#                      termIsRegEx = 1
+#                      secureFields =
+#                      dontListTerms = 0
+#              }
+#              
                person < plugin.tx_contagged.types.dfn_block
                person {
                        label = Person
@@ -100,53 +100,53 @@ plugin.tx_contagged {
                        dataSource = addresses
                        sortField = zip
                }
-               
-               reference {
-                       label = Reference
-                       label.de = Quelle
-                       dataSource = references
-                       sortField = term_main
-               }
-               
-               category < plugin.tx_contagged.types.dfn_block
-               category {
-                       label = Category
-                       label.de = Kategorie
-                       dataSource = categories
-               }
-               
-       }
-
-       dataSources {
-
-               references {
-                       sourceName = tx_sibibtex_entries
-                       hasSysLanguageUid = 0
-                       storagePids = 237
-                       fieldsToEdit = 
-                       mapping {
-                               uid.field = uid
-                               pid.field = pid
-                               year.field = year
-                               author.field = author
-                               author.stdWrap.crop = -4||1
-                               term_replace.value = 
-                               term_replace.stdWrap.dataWrap = {register:contagged_author}, {register:contagged_year}
-                               term_replace.stdWrap.outerWrap = [|]
-                               term_main.field = author
-                               term_type.value = reference
-                               desc_long.field = title
-                               # desc_long.field = address
-                               # desc_long.stdWrap.dataWrap = |<br />{register:contagged_zip} {register:contagged_city}
-                               exclude.value = 0
-                       }
-               }
-
-               
+#              
+#              reference {
+#                      label = Reference
+#                      label.de = Quelle
+#                      dataSource = references
+#                      sortField = term_main
+#              }
+#              
+#              category < plugin.tx_contagged.types.dfn_block
+#              category {
+#                      label = Category
+#                      label.de = Kategorie
+#                      dataSource = categories
+#              }
+#              
+#      }
+# 
+#      dataSources {
+# 
+#              references {
+#                      sourceName = tx_sibibtex_entries
+#                      hasSysLanguageUid = 0
+#                      storagePids = 237
+#                      fieldsToEdit = 
+#                      mapping {
+#                              uid.field = uid
+#                              pid.field = pid
+#                              year.field = year
+#                              author.field = author
+#                              author.stdWrap.crop = -4||1
+#                              term_replace.value = 
+#                              term_replace.stdWrap.dataWrap = {register:contagged_author}, {register:contagged_year}
+#                              term_replace.stdWrap.outerWrap = [|]
+#                              term_main.field = author
+#                              term_type.value = reference
+#                              desc_long.field = title
+#                              # desc_long.field = address
+#                              # desc_long.stdWrap.dataWrap = |<br />{register:contagged_zip} {register:contagged_city}
+#                              exclude.value = 0
+#                      }
+#              }
+# 
+#              
                addresses {
                        sourceName = tt_address
                        hasSysLanguageUid = 0
-                       storagePids = 
+                       storagePids = 91
                        fieldsToEdit = name,person,address
                        mapping {
                                uid.field = uid
@@ -165,66 +165,66 @@ plugin.tx_contagged {
                                exclude.value = 0
                        }
                }
-               
-               categories {
-                       sourceName = tx_categories
-                       hasSysLanguageUid = 1
-                       storagePids = 
-                       fieldsToEdit = title,synonyms,description
-                       mapping {
-                               uid.field = uid
-                               pid.field = pid
-                               term_main.field = title
-                               term_alt.field = synonyms
-                               term_type.value = category
-                               desc_long.field = description
-                               exclude.value = 0
-                       }
-               }
-               
-       }
-}
-
-plugin.tx_contagged {
-       _CSS_DEFAULT_STYLE (
-
-               acronym, abbr, dfn, span.tx-contagged-dfn_block, span.tx-contagged-dfn_inline {
-                       font-style: normal;
-                       border-bottom: 1px dotted #333333;
-                       cursor: help;
-                       position: relative;
-               }
-               
-               
-               /* position:relative is necessary for correct positioning of inline descriptions */
-               span.tx-contagged-dfn_block {
-                       position: relative;
-               }
-               /* z-index makes sure the block is the top most element */
-               span.tx-contagged-dfn_block span.tx-contagged-dfn_block-content {
-                       background: #EEEEEE;
-                       display: none;
-                       position: absolute;
-                       z-index: 9999;
-               }
-               span.tx-contagged-dfn_block:hover span.tx-contagged-dfn_block-content {
-                       display: inline;
-                       position: absolute;
-                       top: -2px;
-                       left: -11px;
-                       width: 300px;
-                       margin-top: -1px;
-                       border: 1px #CCCCCC solid;
-                       padding: 0px 10px 10px 10px;
-               }
-
-
-               span.tx-contagged-dfn_inline span.tx-contagged-dfn_block-content {
-                       color: #009900;
-                       display: none;
-               }
-               span.tx-contagged-dfn_inline:active span.tx-contagged-dfn_block-content {
-                       display:inline;
-               }
-       )
+#              
+#              categories {
+#                      sourceName = tx_categories
+#                      hasSysLanguageUid = 1
+#                      storagePids = 
+#                      fieldsToEdit = title,synonyms,description
+#                      mapping {
+#                              uid.field = uid
+#                              pid.field = pid
+#                              term_main.field = title
+#                              term_alt.field = synonyms
+#                              term_type.value = category
+#                              desc_long.field = description
+#                              exclude.value = 0
+#                      }
+#              }
+#              
+#      }
+}
+# 
+plugin.tx_contagged {
+#      _CSS_DEFAULT_STYLE (
+# 
+#              acronym, abbr, dfn, span.tx-contagged-dfn_block, span.tx-contagged-dfn_inline {
+#                      font-style: normal;
+#                      border-bottom: 1px dotted #333333;
+#                      cursor: help;
+#                      position: relative;
+#              }
+#              
+#              
+#              /* position:relative is necessary for correct positioning of inline descriptions */
+#              span.tx-contagged-dfn_block {
+#                      position: relative;
+#              }
+#              /* z-index makes sure the block is the top most element */
+#              span.tx-contagged-dfn_block span.tx-contagged-dfn_block-content {
+#                      background: #EEEEEE;
+#                      display: none;
+#                      position: absolute;
+#                      z-index: 9999;
+#              }
+#              span.tx-contagged-dfn_block:hover span.tx-contagged-dfn_block-content {
+#                      display: inline;
+#                      position: absolute;
+#                      top: -2px;
+#                      left: -11px;
+#                      width: 300px;
+#                      margin-top: -1px;
+#                      border: 1px #CCCCCC solid;
+#                      padding: 0px 10px 10px 10px;
+#              }
+# 
+# 
+#              span.tx-contagged-dfn_inline span.tx-contagged-dfn_block-content {
+#                      color: #009900;
+#                      display: none;
+#              }
+#              span.tx-contagged-dfn_inline:active span.tx-contagged-dfn_block-content {
+#                      display:inline;
+#              }
+#      )
 }
index d41bdb3..ff1f9e2 100644 (file)
@@ -80,7 +80,7 @@ plugin.tx_contagged {
                enable = {$contagged.enableSearchBox}
                fieldsToSearch = {$contagged.fieldsToSearch}
        }
-       
+               
        types {
 
                definition {
diff --git a/tca.php b/tca.php
index 766329e..5e10851 100644 (file)
--- a/tca.php
+++ b/tca.php
@@ -182,53 +182,6 @@ $TCA["tx_contagged_terms"] = array (
                                        ),
                                )
                        ),
-                       // 'image' => Array (
-                       //      'exclude' => 1,
-                       //      'l10n_mode' => $l10n_mode_image,
-                       //      'label' => 'LLL:EXT:lang/locallang_general.php:LGL.images',
-                       //      'config' => Array (
-                       //              'type' => 'group',
-                       //              'internal_type' => 'file',
-                       //              'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
-                       //              'max_size' => '10000',
-                       //              'uploadfolder' => 'uploads/pics',
-                       //              'show_thumbs' => '1',
-                       //              'size' => 3,
-                       //              'autoSizeMax' => 15,
-                       //              'maxitems' => '99',
-                       //              'minitems' => '0'
-                       //      )
-                       // ),
-                       // 'imagecaption' => Array (
-                       //      'exclude' => 1,
-                       //      'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagecaption',
-                       //      'l10n_mode' => $l10n_mode,
-                       //      'config' => Array (
-                       //              'type' => 'text',
-                       //              'cols' => '30',
-                       //              'rows' => '3'
-                       //      )
-                       // ),
-                       // 'imagealt' => Array (
-                       //      'exclude' => 1,
-                       //      'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagealt',
-                       //      'l10n_mode' => $l10n_mode,
-                       //      'config' => Array (
-                       //              'type' => 'text',
-                       //              'cols' => '20',
-                       //              'rows' => '3'
-                       //      )
-                       // ),
-                       // 'imagetitle' => Array (
-                       //      'exclude' => 1,
-                       //      'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagetitle',
-                       //      'l10n_mode' => $l10n_mode,
-                       //      'config' => Array (
-                       //              'type' => 'text',
-                       //              'cols' => '20',
-                       //              'rows' => '3'
-                       //      )
-                       // ),
                        'related' => Array (
                                'exclude' => 1,
                                'l10n_mode' => 'exclude',