* ADD Crosslinking beween terms
authorjocrau <jocrau@735d13b6-9817-0410-8766-e36946ffe9aa>
Fri, 7 Nov 2008 20:51:31 +0000 (20:51 +0000)
committerBastian Bringenberg <spam@bastian-bringenberg.de>
Thu, 4 Dec 2014 23:56:05 +0000 (00:56 +0100)
* ADD You can add images to your term definitions
* IMP some code clean-up

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/contagged/trunk@13913 735d13b6-9817-0410-8766-e36946ffe9aa

14 files changed:
ChangeLog
class.tx_contagged.php
ext_localconf.php
ext_tables.php
ext_tables.sql
locallang_db.xml
model/class.tx_contagged_model_mapper.php
model/class.tx_contagged_model_terms.php
pi1/class.tx_contagged_pi1.php
pi1/contagged.tmpl
pi1/locallang.xml
static/constants.txt
static/setup.txt
tca.php

index dc44e84..abfd0a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+v0.1.6 2008-11-06 Jochen Rau <j.rau@web.de>
+
+       * IMP some code clean-up
+       * ADD You can add images to your term definitions
+       
 v0.1.5 2008-09-24 Jochen Rau <j.rau@web.de>
 
        * IMP The parser is now invoked also for bullet lists and headers (if <h[1-6]> is not an excluded tag)
index a75169c..4e7bf2d 100644 (file)
@@ -48,7 +48,7 @@ class tx_contagged extends tslib_pibase {
         */
        function main($content,$conf) {
                $this->conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.'];
-               
+
                // exit if the content should be skipped
                if ($this->isContentToSkip()) return $content;
 
@@ -74,7 +74,7 @@ class tx_contagged extends tslib_pibase {
                // get the model (an associated array of terms)
                $modelClassName = t3lib_div::makeInstanceClassName('tx_contagged_model_terms');
                $model = new $modelClassName($this);
-               $this->termsArray = $model->getTermsArray();
+               $this->termsArray = $model->findAllTerms();
 
                // get a comma separated list of all tags which should be omitted
                $tagsToOmitt = $this->getTagsToOmitt();
@@ -86,10 +86,7 @@ class tx_contagged extends tslib_pibase {
                        if (!($intKey%2)) {
                                $positionsArray = array();
                                // iterate through all terms
-                               foreach ($this->termsArray as $termKey=>$termArray) {
-                                       // get the maximum amount of replaced terms
-                                       $maxOccur = $this->typesArray[$termArray['term_type'] . '.']['maxOccur'] ? (int)$typeConfigArray['maxOccur'] : 9999;
-                                       
+                               foreach ($this->termsArray as $termKey=>$termArray) {                                   
                                        $typeConfigArray = $this->typesArray[$termArray['term_type'] . '.'];
                                        
                                        $terms = array();
@@ -100,7 +97,7 @@ class tx_contagged extends tslib_pibase {
                                        // sort the array descending by length of the value, so the longest term will match
                                        usort($terms,array($this,'sortArrayByLengthDescending'));
                                        foreach ( $terms as $term ) {
-                                               $this->getPositions($splittedContent[$intKey],&$positionsArray,$typeConfigArray,$term,$termArray,$termKey,$regEx,$tagsToOmitt,$maxOccur);
+                                               $this->getPositions($splittedContent[$intKey],$positionsArray,$typeConfigArray,$term,$termKey);
                                        }
                                }
                                ksort($positionsArray);
@@ -141,7 +138,7 @@ class tx_contagged extends tslib_pibase {
                return $regEx;
        }
 
-       function getPositions($content,&$positionsArray,$typeConfigArray,$term,$termArray,$termKey,$regEx,$tagsToOmitt,$maxOccur) {
+       function getPositions($content,&$positionsArray,$typeConfigArray,$term,$termKey) {
                $regEx = $this->getRegEx($term,$termKey,$typeConfigArray);
                preg_match_all($regEx,$content,$matchesArray,PREG_OFFSET_CAPTURE);
                $matchesArray = $matchesArray[0]; // only take the full pattern matches of the regEx
index ccd1010..ea3a241 100644 (file)
@@ -7,5 +7,11 @@ t3lib_extMgm::addUserTSConfig('
 
 t3lib_extMgm::addPItoST43($_EXTKEY,'pi1/class.tx_contagged_pi1.php','_pi1','list_type',1);
 
+// $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['contagged'] = array();
+// $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['contagged']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/contagged/class.tx_rtehtmlarea_contagged.php:&tx_rtehtmlarea_contagged';
+// $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['contagged']['addIconsToSkin'] = 1;
+// $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['contagged']['disableInFE'] = 1;
+
+// $TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['isOutputting']['tx_contagged'] = 'EXT:contagged/class.tx_contagged.php:&tx_contagged->main';
 // $TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all']['tx_contagged'] = 'EXT:contagged/class.tx_contagged.php:&tx_contagged->main';
 ?>
\ No newline at end of file
index 7023148..73f7f47 100644 (file)
@@ -39,7 +39,7 @@ $TCA["tx_contagged_terms"] = array (
                'iconfile'          => t3lib_extMgm::extRelPath($_EXTKEY).'icon_tx_contagged_terms.gif',
        ),
        "feInterface" => array (
-               "fe_admin_fieldList" => "sys_language_uid, l18n_parent, l18n_diffsource, hidden, starttime, endtime, fe_group, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long, link, exclude",
+               "fe_admin_fieldList" => "sys_language_uid, l18n_parent, l18n_diffsource, hidden, starttime, endtime, fe_group, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long, image, imagecaption, imagealt, imagetitle, related, link, exclude",
        )
 );
 
index 727b82a..8fad735 100644 (file)
@@ -32,6 +32,11 @@ CREATE TABLE tx_contagged_terms (
        term_replace tinytext NOT NULL,
        desc_short tinytext NOT NULL,
        desc_long text NOT NULL,
+       image text NOT NULL,
+       imagecaption text NOT NULL,
+       imagealt text NOT NULL,
+       imagetitle text NOT NULL,
+       related int(11) DEFAULT '0' NOT NULL,
        link tinytext NOT NULL,
        exclude tinyint(3) DEFAULT '0' NOT NULL,
        
@@ -40,6 +45,22 @@ 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,
+
+  KEY uid_local (uid_local),
+  KEY uid_foreign (uid_foreign)
+);
+
+
 #
 # Table structure for table 'pages'
 #
index 4a534ef..e231ebd 100644 (file)
                        <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.imagealt">ALT-Text</label>
+                       <label index="tx_contagged_terms.imagetitle">TITLE-Text</label>
+                       <label index="tx_contagged_terms.related">See also</label>
                        <label index="tx_contagged_terms.link">Link</label>
                        <label index="tx_contagged_terms.exclude">Exclude from front-end lists</label>
                        <label index="pages.tx_contagged_dont_parse">Don't parse text</label>
                        <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.imagealt">ALT-Text</label>
+                       <label index="tx_contagged_terms.imagetitle">TITLE-Text</label>
+                       <label index="tx_contagged_terms.related">Siehe auch</label>
                        <label index="tx_contagged_terms.link">Verweis</label>
                        <label index="tx_contagged_terms.exclude">Von Frontend-Listen ausschließen</label>
                        <label index="pages.tx_contagged_dont_parse">Text nicht parsen</label>
index f5cfb23..3b21bee 100644 (file)
@@ -41,11 +41,11 @@ class tx_contagged_model_mapper {
        }
 
        /**
-        * Build an array of the entries in the table "tx_contagged_terms"
+        * Build an array of the entries in the specified table
         *
         * @param       [type]          $result: ...
         * @param       [type]          $dataSource: ...
-        * @return      An              array with the data of the table "tx_contagged_terms"
+        * @return      An              array with the data of the table
         */
        function getDataArray($result,$dataSource) {
                $dataArray = array();
@@ -75,6 +75,7 @@ class tx_contagged_model_mapper {
                        $term = $row[$termReplace] ? $row[$termReplace] : $row[$termMain];
                        $mappedDataArray = array();
                        $mappedDataArray['term'] = $term;
+                       $mappedDataArray['sourceName'] = $sourceName;
                        foreach ( $fieldsToMapArray as $field) {
                                $value = $dataSourceConfigArray['mapping.'][$field.'.'];
                                if ( $value['value'] ) {
@@ -103,13 +104,6 @@ class tx_contagged_model_mapper {
                                $mappedDataArray['listPages'] = t3lib_div::trimExplode(',',$this->conf['listPages'],1);
                        }
 
-                       // TODO Remove; only for backwards compatibility
-                       // if ($typeConfigArray['listPage']) {
-                       //      $mappedDataArray['listPages'] = t3lib_div::trimExplode(',',$typeConfigArray['listPage'],1);
-                       // } else {
-                       //      $mappedDataArray['listPages'] = t3lib_div::trimExplode(',',$this->conf['listPage'],1);
-                       // }
-
                        $secureFields = $typeConfigArray['termIsRegEx']>0 ? $this->conf['types.'][$row['term_type'].'.']['secureFields'] : $this->conf['secureFields'];
                        foreach ($mappedDataArray as $field => $fieldContent) {
                                if ($fieldContent) {
@@ -133,7 +127,7 @@ class tx_contagged_model_mapper {
 
                return $dataArray;
        }
-
+       
        /**
         * get the storage pids; cascade: type > dataSource > globalConfig
         *
index a169992..56f697b 100644 (file)
@@ -35,6 +35,7 @@ class tx_contagged_model_terms {
        var $cObj;
        var $controller;
        var $tablesArray; // array of all tables in the database
+       var $terms;
 
        function tx_contagged_model_terms($controller) {
                $this->controller = $controller;
@@ -52,16 +53,9 @@ class tx_contagged_model_terms {
                                $this->tablesArray[] = current($table);
                        }
                }
-       }
-
-       /**
-        * [Describe function...]
-        *
-        * @return      [type]          ...
-        */
-       function getTermsArray() {
+               
                $typesArray = $this->conf['types.'];
-               $termsArray = array();
+               $this->terms = array();
                $dataSourceArray = array();
                foreach ($typesArray as $type=>$typeConfigArray) {
                        $storagePidsArray = $this->mapper->getStoragePidsArray($typeConfigArray);
@@ -80,12 +74,30 @@ class tx_contagged_model_terms {
                }
                // get an array of all data rows in the configured tables
                foreach ($dataSourceArray as $dataSource=>$storagePidsArray ) {
-                       $termsArray = array_merge($termsArray,$this->getTerms($dataSource,$storagePidsArray));
+                       $this->terms = array_merge($this->terms,$this->fetchAllTermsFromSource($dataSource,$storagePidsArray));
                }
 
-               uasort($termsArray,array($this,'sortByTermAscending'));
+               uasort($this->terms,array($this,'sortByTermAscending'));
+       }
 
-               return $termsArray;
+       /**
+        * [Describe function...]
+        *
+        * @return      [type]          ...
+        */
+       function findAllTerms() {
+               return $this->terms;
+       }
+       
+       function findTermByUid($sourceName, $uid) {
+               $fetchedTerms = array();
+               foreach ($this->terms as $key => $term) {
+                       if ($term['sourceName'] == $sourceName && $term['uid'] == $uid) {
+                               return array($key => $term);
+                       }
+               }
+               
+               return NULL;
        }
 
        /**
@@ -126,7 +138,7 @@ class tx_contagged_model_terms {
         * @param       [type]          $storagePids: ...
         * @return      An              array with the terms an their configuration
         */
-       function getTerms($dataSource,$storagePidsArray=NULL) {
+       function fetchAllTermsFromSource($dataSource,$storagePidsArray=NULL) {
                $dataArray = array();
                $terms = array();
                $storagePidsList = implode(',',$storagePidsArray);
@@ -151,12 +163,36 @@ class tx_contagged_model_terms {
                        // map the fields
                        $dataArray = $this->mapper->getDataArray($result,$dataSource);
                }
+               $this->fetchRelatedTerms($dataArray);
                
                // TODO piVars as a data source
 
                return $dataArray;
        }
        
+       function fetchRelatedTerms(&$dataArray) {
+               foreach ($dataArray as $key => $termArray) {
+                       $result = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                               'uid_foreign, tablenames', // SELECT ...
+                               'tx_contagged_related_mm', // FROM ...
+                               'uid_local=' . $termArray['uid'] // WHERE ..
+                               );
+
+                       if (!empty($result)) {
+                               $termArray['related'] = array();
+                               foreach ($result as $row) {
+                                       $termArray['related'][] = array('sourceName' => $row['tablenames'], 'uid' => $row['uid_foreign']);
+                               }
+                       } else {
+                               $termArray['related'] = NULL;
+                       }
+                       $newDataArray[] = $termArray;
+               }
+               $dataArray = $newDataArray;
+       }
+       
+       
+       
        function getSortField($termArray) {
                if ($this->conf['types.'][$termArray['term_type'].'.']['sortField']) {
                        $sortField = $this->conf['types.'][$termArray['term_type'].'.']['sortField'];
index 3804ab4..a06a9cf 100644 (file)
@@ -44,7 +44,7 @@ class tx_contagged_pi1 extends tslib_pibase {
        var $typolinkConf;
        var $backPid; // pid of the last visited page (from piVars)
        var $indexChar; // char of the given index the user has clicked on (from piVars)
-       var $termKey; // local key for each term (not related to the uid in the database)
+       
 
        /**
         * main method of the contagged list plugin
@@ -63,12 +63,12 @@ class tx_contagged_pi1 extends tslib_pibase {
                $this->typolinkConf['parameter.']['current'] = 1;
                $this->typolinkConf['additionalParams'] = $this->cObj->stdWrap($typolinkConf['additionalParams'], $typolinkConf['additionalParams.']);
                unset($this->typolinkConf['additionalParams.']);
-               $this->backPid = (int)$this->piVars['backPid'] ? (int)$this->piVars['backPid'] : NULL;
+               $this->backPid = $this->piVars['backPid'] ? intval($this->piVars['backPid']) : NULL;
                $this->indexChar = $this->piVars['index'] ? urldecode($this->piVars['index']) : NULL;
                if ( !is_null($this->piVars['key']) ) {
-                       $this->termKey = (int)$this->piVars['key'];
+                       $termKey = (int)$this->piVars['key'];
                }
-               $this->sword = $this->piVars['sword'] ? urldecode($this->piVars['sword']) : NULL;
+               $sword = $this->piVars['sword'] ? urldecode($this->piVars['sword']) : NULL;
 
                // get an array of all type configurations
                $this->typesArray = $this->conf['types.'];
@@ -77,30 +77,27 @@ 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->getTermsArray();
-
-               if ( is_null($this->termKey) && is_null($this->sword) ) {
-                       $renderFunction = 'renderList';
-               } elseif ( is_null($this->termKey) && !is_null($this->sword) ) {
-                       $renderFunction = 'renderListBySword';
-               } elseif ( !is_null($this->termKey) ) {
-                       $renderFunction = 'renderSingleItemByKey';
+               $this->termsArray = $this->model->findAllTerms();
+
+               if ( is_null($termKey) && is_null($sword) ) {
+                       $content .= $this->renderList();
+               } elseif ( is_null($termKey) && !is_null($sword) ) {
+                       $content .= $this->renderListBySword($sword);
+               } elseif ( !is_null($termKey) ) {
+                       $content .= $this->renderSingleItemByKey($termKey);
                }
 
                // TODO hook "newRenderFunctionName"
 
-               if(method_exists($this, $renderFunction)) {
-                       $content .= $this->$renderFunction();
-                       $content = $this->removeUnfilledMarker($content);
-               }
+               $content = $this->removeUnfilledMarker($content);
                
                return $this->pi_wrapInBaseClass($content);
        }
 
        /**
-        * [Describe function...]
+        * Renders the list of terms
         *
-        * @return      [type]          ...
+        * @return      $string The list as HTML
         */
        function renderList() {
                $subparts = $this->getSubparts('LIST');
@@ -119,12 +116,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                return $content;
        }
 
-       /**
-        * [Describe function...]
-        *
-        * @return      [type]          ...
-        */
-       function renderListBySword() {
+       function renderListBySword($sword) {
                $subparts = $this->getSubparts('LIST');
                $this->renderLinks($markerArray,$wrappedSubpartArray);
                $this->renderIndex($markerArray);
@@ -134,7 +126,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                                        $fieldsToSearch = t3lib_div::trimExplode(',',$this->conf['fieldsToSearch'] );
                                        foreach ($fieldsToSearch as $field) {                                           
                                                // TODO make arrays searchable
-                                               $swordMatched = preg_match('/'.preg_quote($this->sword,'/').'/Uui',$termArray[$field]) ? TRUE : FALSE;
+                                               $swordMatched = preg_match('/'.preg_quote($sword,'/').'/Uui',$termArray[$field]) ? TRUE : FALSE;
                                        }
                                        if ( $swordMatched ) {
                                                $this->renderSingleItem($termKey,$markerArray,$wrappedSubpartArray);
@@ -152,16 +144,11 @@ class tx_contagged_pi1 extends tslib_pibase {
                return $content;
        }
 
-       /**
-        * [Describe function...]
-        *
-        * @return      [type]          ...
-        */
-       function renderSingleItemByKey() {
+       function renderSingleItemByKey($termKey) {
                $subparts = $this->getSubparts('SINGLE');
                $this->renderLinks($markerArray,$wrappedSubpartArray);
                $this->renderIndex($markerArray);
-               $this->renderSingleItem($this->termKey,$markerArray,$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);
 
@@ -177,13 +164,6 @@ class tx_contagged_pi1 extends tslib_pibase {
                return $subparts;
        }
 
-       /**
-        * [Describe function...]
-        *
-        * @param       [type]          $$markerArray: ...
-        * @param       [type]          $wrappedSubpartArray: ...
-        * @return      [type]          ...
-        */
        function renderLinks(&$markerArray,&$wrappedSubpartArray) {
                // make "back to..." link
                if ($this->backPid) {
@@ -234,9 +214,9 @@ class tx_contagged_pi1 extends tslib_pibase {
                $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['###TERM_LANG###'] = $this->pi_getLL('lang.'.$termArray['term_lang'])?$this->pi_getLL('lang.'.$termArray['term_lang']):$this->pi_getLL('na');
-               // TODO Support for tx_categories
-               $markerArray['###TERM_CATEGORY###'] = $termArray['term_category']?$termArray['term_category']:$this->pi_getLL('na');
 
                $labelWrap['noTrimWrap'] = $typeConfigArray['labelWrap1']?$typeConfigArray['labelWrap1']:$this->conf['labelWrap1'];
                $markerArray['###TERM_TYPE_LABEL###'] = $markerArray['###TERM_TYPE###']?$this->local_cObj->stdWrap($this->pi_getLL('term_type'),$labelWrap):'';
@@ -246,6 +226,8 @@ class tx_contagged_pi1 extends tslib_pibase {
                $markerArray['###TERM_REPLACE_LABEL###'] = $markerArray['###TERM_REPLACE###']?$this->local_cObj->stdWrap($this->pi_getLL('term_replace'),$labelWrap):'';
                $markerArray['###DESC_SHORT_LABEL###'] = $markerArray['###DESC_SHORT###']?$this->local_cObj->stdWrap($this->pi_getLL('desc_short'),$labelWrap):'';
                $markerArray['###DESC_LONG_LABEL###'] = $markerArray['###DESC_LONG###']?$this->local_cObj->stdWrap($this->pi_getLL('desc_long'),$labelWrap):'';
+               $markerArray['###RELATED_LABEL###'] = $markerArray['###RELATED###']?$this->local_cObj->stdWrap($this->pi_getLL('related'),$labelWrap):'';
+               $markerArray['###IMAGES_LABEL###'] = $markerArray['###IMAGES###']?$this->local_cObj->stdWrap($this->pi_getLL('images'),$labelWrap):'';
                $markerArray['###TERM_LANG_LABEL###'] = $markerArray['###TERM_LANG###']?$this->local_cObj->stdWrap($this->pi_getLL('term_lang'),$labelWrap):'';
 
                // make "more..." link
@@ -256,13 +238,40 @@ class tx_contagged_pi1 extends tslib_pibase {
                $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
                $wrappedSubpartArray['###LINK_DETAILS###'] = $this->local_cObj->typolinkWrap($typolinkConf);
        }
+       
+       function getRelated($term) {
+               $relatedCode = '';
+               if (is_array($term['related'])) {
+                       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>';
+                       }
+               }
+               // 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.']);
+               }
+               return $this->local_cObj->wrap(trim($imagesCode), $this->conf['images.']['wrapIfAny']);
+       }
 
-       /**
-        * [Describe function...]
-        *
-        * @param       [type]          $$markerArray: ...
-        * @return      [type]          ...
-        */
        function renderIndex (&$markerArray) {
                $subparts = array();
                $subparts['template_index'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_INDEX###');
@@ -295,11 +304,6 @@ class tx_contagged_pi1 extends tslib_pibase {
                $markerArray['###INDEX###'] = $this->cObj->substituteMarkerArrayCached($subparts['template_index'], $markerArray, $subpartArray);
        }
 
-       /**
-        * [Describe function...]
-        *
-        * @return      [type]          ...
-        */
        function getIndexArray() {
                // Get localized index chars.
                foreach (t3lib_div::trimExplode(',', $this->pi_getLL('indexChars')) as $key => $value) {
@@ -333,7 +337,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                                        preg_match('/^./' . $this->conf['modifier'],$termArray[$sortField],$match);
                                        $newIndexChar = $match[0];
                                        $indexArray[$newIndexChar] = NULL;
-                                       $typolinkConf['additionalParams'] = '&' . $this->prefixId . '[index]=' . urlencode($newIndexChar);
+                                       $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[index]=' . urlencode($newIndexChar);
                                        $indexArray[$newIndexChar] = $this->local_cObj->typolink($newIndexChar, $typolinkConf);
                                        $this->termsArray[$termKey]['indexChar'] = $newIndexChar;
                                }
index d7d2f4f..0fe921c 100644 (file)
@@ -24,6 +24,8 @@
                ###TERM_REPLACE_LABEL######TERM_REPLACE###
                ###DESC_SHORT_LABEL######DESC_SHORT###
                ###DESC_LONG_LABEL######DESC_LONG###
+               ###IMAGES_LABEL######IMAGES###
+               ###RELATED_LABEL######RELATED###
                ###TERM_LANG_LABEL######TERM_LANG###
        </pre>
 
@@ -78,6 +80,8 @@
                <dd>###TERM_REPLACE_LABEL######TERM_REPLACE###</dd>
                <dd>###DESC_SHORT_LABEL######DESC_SHORT###</dd>
                <dd>###DESC_LONG_LABEL######DESC_LONG###</dd>
+               <dd>###IMAGES_LABEL######IMAGES###</dd>
+               <dd>###RELATED_LABEL######RELATED###</dd>
                <dd>###TERM_LANG_LABEL######TERM_LANG###</dd>
                <!-- ###ITEM### end-->
        </dl>
index 04177a1..2b1b578 100644 (file)
@@ -23,6 +23,8 @@
                        <label index="term_lang">Term Language</label>
                        <label index="desc_short">Short Description</label>
                        <label index="desc_long">Long Description</label>
+                       <label index="images">Images</label>
+                       <label index="related">See also</label>
                        <label index="lang.en">en.</label>
                        <label index="lang.fr">fr.</label>
                        <label index="lang.de">ger.</label>
@@ -48,6 +50,8 @@
                        <label index="term_lang">Sprache</label>
                        <label index="desc_short">Kurzbeschreibung</label>
                        <label index="desc_long">Ausführliche Beschreibung</label>
+                       <label index="images">Bilder</label>
+                       <label index="related">Siehe auch</label>
                        <label index="lang.en">engl.</label>
                        <label index="lang.fr">franz.</label>
                        <label index="lang.de">dt.</label>
index ddd6eb8..2a1dc9a 100644 (file)
@@ -50,6 +50,12 @@ contagged {
        # cat=plugin.contagged//75; type=boolean; label=[Update page keywords]: Should the matched terms be used as keywords for the page they are on. If there is a replaced term it will be used as keyword. If no the main term will be the keyword. The list of matched terms will be stored in a separate database field (not in the field 'keywords'), so your own keywords are preserved.
        updateKeywords = 1
        
+       # cat=plugin.contagged//76; type=int; label=[Image max width]: Maximum width of an image in single view.
+       singleMaxW = 200
+       
+       # cat=plugin.contagged//77; type=int; label=[Image max height]: Maximum height of an image in single view.
+       singleMaxH = 200
+       
        # cat=plugin.contagged//80; type=wrap; label=[Label Wrap 1]
        labelWrap1 = |<strong>|:</strong> |
        
@@ -66,7 +72,7 @@ contagged {
        sortField = term
 
        # cat=plugin.contagged//93; type=string; label=[Fields to Map]: Fields to be mapped.
-       fieldsToMap = uid,pid,term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,link,exclude
+       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=plugin.contagged//94; type=string; label=[Secured Fields]: .
        secureFields = 
index 2b7e115..f75c6e0 100644 (file)
@@ -36,7 +36,29 @@ plugin.tx_contagged {
        showOnlyMatchedIndexChars = {$contagged.showOnlyMatchedIndexChars}
        autoAddIndexChars = {$contagged.autoAddIndexChars}
        addBackLinkDescription = {$contagged.addBackLinkDescription}
-
+       
+       images {
+               wrapIfAny = <div class="tx-contagged-pi1-images">|</div>
+               caption.stdWrap.wrap = <div class="tx-contagged-pi1-imagecaption"> | </div>
+           caption.stdWrap.trim=1
+               single.image {
+                       file.maxW = {$contagged.singleMaxW}
+                       file.maxH = {$contagged.singleMaxH}
+                       wrap = 
+                       imageLinkWrap = 1
+                       imageLinkWrap {
+                               enable = 1
+                               bodyTag = <body bgColor="#ffffff">
+                               wrap = <a href="javascript:close();"> | </a>
+                               width = 500m
+                               height = 500
+                               JSwindow = 1
+                               JSwindow.newWindow = 1
+                               JSwindow.expand = 17,20
+                       }
+               }
+       }
+       
        types {
 
                definition {
@@ -76,6 +98,11 @@ plugin.tx_contagged {
                                term_lang.field = term_lang
                                desc_short.field = desc_short
                                desc_long.field = desc_long
+                               image.field = image
+                               imagecaption.field = imagecaption
+                               imagealt.field = imagealt
+                               imagetitle.field = imagetitle
+                               related.field = related
                                link.field = link
                                exclude.field = exclude
                        }
diff --git a/tca.php b/tca.php
index 9cf5d55..1adf004 100644 (file)
--- a/tca.php
+++ b/tca.php
@@ -5,7 +5,7 @@ if (!defined ('TYPO3_MODE'))    die ('Access denied.');
 $TCA["tx_contagged_terms"] = array (
        "ctrl" => $TCA["tx_contagged_terms"]["ctrl"],
        "interface" => array (
-               "showRecordFieldList" => "sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,endtime,fe_group term_main, term_alt, term_type, term_lang, replacement, desc_short, desc_long, link, exclude"
+               "showRecordFieldList" => "sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,endtime,fe_group term_main, term_alt, term_type, term_lang, replacement, desc_short, desc_long, image, imagecaption, imagealt, imagetitle, related, link, exclude"
        ),
        "feInterface" => $TCA["tx_contagged_terms"]["feInterface"],
        "columns" => array (
@@ -182,6 +182,68 @@ $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.imagealt',
+                               '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' => '30',
+                                       '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' => '30',
+                                       'rows' => '3'
+                               )
+                       ),
+                       'related' => Array (
+                               'exclude' => 1,
+                               'l10n_mode' => 'exclude',
+                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.related',
+                               'config' => Array (
+                                       'type' => 'group',
+                                       'internal_type' => 'db',
+                                       'allowed' => '*',
+                                       'MM' => 'tx_contagged_related_mm',
+                                       'size' => 3,
+                                       'autoSizeMax' => 20,
+                                       'maxitems' => 9999,
+                                       'minitems' => 0,
+                               )
+                       ),
                        "link" => Array (
                                "exclude" => 1,
                                "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.link",
@@ -212,7 +274,7 @@ $TCA["tx_contagged_terms"] = array (
                        ),
                ),
                "types" => array (
-                       "0" => array("showitem" => "sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, hidden;;1, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long;;;richtext[*]:rte_transform[mode=ts_css|imgpath=uploads/tx_contagged/rte/], link, exclude")
+                       "0" => array("showitem" => "sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, hidden;;1, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long;;;richtext[*]:rte_transform[mode=ts_css|imgpath=uploads/tx_contagged/rte/], image, imagecaption, imagealt, imagetitle, related, link, exclude")
                ),
                "palettes" => array (
                        "1" => array("showitem" => "starttime, endtime, fe_group")