[+BUGFIX] Parsed fields in a single view are no longer htmlspecialchared by lib.parse...
authorjocrau <jocrau@735d13b6-9817-0410-8766-e36946ffe9aa>
Thu, 22 Apr 2010 20:12:21 +0000 (20:12 +0000)
committerBastian Bringenberg <spam@bastian-bringenberg.de>
Thu, 4 Dec 2014 23:56:08 +0000 (00:56 +0100)
[+BUGFIX] Index chars are now linked correctly in a single view.
[+FEATURE] Added new option autoExcludeTerms. Set this to avoid parsed terms linking to themselves in a single view (defaults to 1).
[~TASK] Changed default templates. An index is now shown on a single view page, too.

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

ChangeLog
class.tx_contagged.php
pi1/class.tx_contagged_pi1.php
pi1/contagged.tmpl
static/constants.txt
static/setup.txt

index 13f9810..64d4088 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+v1.6.3 2010-04-23 Jochen Rau <jochen.rau@typoplanet.de>
+
+       [+BUGFIX] Parsed fields in a single view are no longer htmlspecialchared by lib.parseFunc_RTE.
+       [+BUGFIX] Index chars are now linked correctly in a single view.
+       [+FEATURE] Added new option autoExcludeTerms. Set this to avoid parsed terms linking to themselves in a single view (defaults to 1).
+       [~TASK] Changed default templates. An index is now shown on a single view page, too.
+       
 v1.6.2 2010-03-09 Jochen Rau <jochen.rau@typoplanet.de>
 
        [+BUGFIX] Re-enabled support for non non-UTF-8 sites in main RegEx.
index 57eeb64..89e7e21 100644 (file)
@@ -58,8 +58,11 @@ class tx_contagged extends tslib_pibase {
         * @param       array           $conf: The configuration array
         * @return      string          The parsed and tagged content that is displayed on the website
         */
-       public function parse($content, $conf = NULL) {
-               $this->conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.'];
+       public function parse($content, $conf) {
+               if (!is_array($conf)) {
+                       $conf = array();
+               }
+               $this->conf = t3lib_div::array_merge_recursive_overrule($GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.'], $conf);
                $this->pi_setPiVarDefaults();
                if (!is_object($this->cObj)) {
                        $this->cObj = t3lib_div::makeInstance('tslib_cObj');
@@ -83,11 +86,14 @@ class tx_contagged extends tslib_pibase {
                $model = t3lib_div::makeInstance('tx_contagged_model_terms', $this);
                $this->termsArray = $model->findAllTerms();
 
+               $excludeTerms = explode(',', $this->conf['excludeTerms']);
                $sortedTerms = array();
                foreach ($this->termsArray as $termKey => $termArray) {
+                       if ($this->conf['autoExcludeTerms'] == 1 && in_array($termArray['term_main'], $excludeTerms)) continue;
                        $sortedTerms[] = array('term' => $termArray['term_main'], 'key' => $termKey);
                        if (is_array($termArray['term_alt'])) {
                                foreach ($termArray['term_alt'] as $term) {
+                                       if ($this->conf['autoExcludeTerms'] == 1 && in_array($term, $excludeTerms)) continue;
                                        $sortedTerms[] = array('term' => $term, 'key' => $termKey);
                                }
                        }
index 276b87a..4fdab30 100644 (file)
@@ -156,6 +156,8 @@ class tx_contagged_pi1 extends tslib_pibase {
        }
 
        function renderListBySword($sword) {
+               $markerArray = array();
+               $wrappedSubpartArray = array();
                $swordMatched = FALSE;
                $subparts = $this->getSubparts('LIST');
                $termsArray = $this->model->findAllTermsToListOnPage();
@@ -195,11 +197,13 @@ class tx_contagged_pi1 extends tslib_pibase {
        }
 
        function renderSingleItemByKey($dataSource, $uid) {
+               $markerArray = array();
+               $wrappedSubpartArray = array();
                $termArray = $this->model->findTermByUid($dataSource, $uid);
                $subparts = $this->getSubparts('SINGLE');
                $this->renderLinks($markerArray,$wrappedSubpartArray);
-               $terms =  array($termArray);
-               $this->renderIndex($markerArray, $terms);
+               $termsArray = $this->model->findAllTermsToListOnPage();
+               $this->renderIndex($markerArray, $termsArray);
                $this->renderSingleItem($termArray,$markerArray,$wrappedSubpartArray);
                $subpartArray['###LIST###'] = $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
                $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);
@@ -249,10 +253,13 @@ class tx_contagged_pi1 extends tslib_pibase {
        function renderSingleItem ($termArray,&$markerArray,&$wrappedSubpartArray) {
                $typeConfigArray = $this->conf['types.'][$termArray['term_type'] . '.'];
 
+               $termArray['desc_long'] = $this->cObj->parseFunc($termArray['desc_long'], array(), '< lib.parseFunc_RTE');
                if (!empty($this->conf['fieldsToParse'])) {
                        $fieldsToParse = t3lib_div::trimExplode(',', $this->conf['fieldsToParse']);
+                       $excludeTerms = $termArray['term_alt'];
+                       $excludeTerms[] = $termArray['term_main'];
                        foreach ($fieldsToParse as $fieldName) {
-                               $termArray[$fieldName] = $this->parser->parse($termArray[$fieldName]);
+                               $termArray[$fieldName] = $this->parser->parse($termArray[$fieldName], array('excludeTerms' => implode(',', $excludeTerms)));
                        }
                }
                
@@ -267,7 +274,7 @@ class tx_contagged_pi1 extends tslib_pibase {
                $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']?$this->cObj->parseFunc($termArray['desc_long'], array(), '< lib.parseFunc_RTE'):$this->pi_getLL('na');
+               $markerArray['###DESC_LONG###'] = $termArray['desc_long']?$termArray['desc_long']:$this->pi_getLL('na');
                $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');
index 5bbadd8..b7ae5ac 100644 (file)
@@ -90,7 +90,7 @@
        <!-- ###TEMPLATE_SINGLE### begin
                This is the template to display a single term
        -->
-       <div class="tx-contagged-navlink"><!--###LINK_TO_LIST###-->###TO_LIST###<!--###LINK_TO_LIST###--></div>
+       ###INDEX###
        <div class="tx-contagged-navlink"><!--###LINK_BACK_TO###-->###BACK_TO###<!--###LINK_BACK_TO###--></div>
        <dl class="tx-contagged-single">
                <!-- ###ITEM### begin-->                
                <dd>###TERM_LANG_LABEL######TERM_LANG###</dd>
                <!-- ###ITEM### end-->
        </dl>
-       <div class="tx-contagged-navlink"><!--###LINK_TO_LIST###-->###TO_LIST###<!--###LINK_TO_LIST###--></div>
        <div class="tx-contagged-navlink"><!--###LINK_BACK_TO###-->###BACK_TO###<!--###LINK_BACK_TO###--></div>
        <!-- ###TEMPLATE_SINGLE### end -->
 
index e63a720..fe7d3f1 100644 (file)
@@ -53,6 +53,8 @@ contagged {
        sortField = term
        # cat=contagged (list)//38; type=string; label=Fields to be parsed: Fields to be parsed by contagged again before they are outputted in the list view.
        fieldsToParse = 
+       # cat=contagged (list)//39; type=boolean; label=Auto-exclude Terms: Set this to avoid parsed terms linking to themselves in a single view.
+       autoExcludeTerms = 1
        # cat=contagged (list)//40; 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,image,imagecaption,imagealt,imagetitle,related,link,exclude
        # cat=contagged (list)//50; type=boolean; label=Add Back Link: Add a back link to the refering page. Be aware of caching if you activate this!
index 8d46106..4477bf8 100644 (file)
@@ -37,6 +37,7 @@ plugin.tx_contagged {
        sortField = {$contagged.sortField}
        fieldsToMap = {$contagged.fieldsToMap}
        fieldsToParse = {$contagged.fieldsToParse}
+       autoExcludeTerms = {$contagged.autoExcludeTerms}
        addBackLink = {$contagged.addBackLink}
        addBackLinkDescription = {$contagged.addBackLinkDescription}