Fixed issue #2714: In RTE htmlArea, unable to do an internal link with several parameters
authorStanislas Rolland <typo3@sjbr.ca>
Tue, 19 Aug 2008 02:43:08 +0000 (02:43 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 19 Aug 2008 02:43:08 +0000 (02:43 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4003 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_parsehtml_proc.php
typo3/class.browse_links.php
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php
typo3/sysext/rtehtmlarea/mod3/locallang.xml

index 8ef1d1c..0f71aea 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * Follow-up for feature #4686: htmlArea RTE Spell Checker: add u modifier to preg_* operations
        * Follow-up for bug #8232: Creating and editing of fields, forms, etc. in FCE's is impossible if there is a section inside
+       * Fixed issue #2714: In RTE htmlArea, unable to do an internal link with several parameters
 
 2008-08-18  Dmitry Dulepov  <dmitry@typo3.org>
 
index b2020eb..193e45b 100755 (executable)
@@ -648,7 +648,7 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                }
                                if (!count($attribArray_copy))  {       // Only if href, target and class are the only attributes, we can alter the link!
                                                // Creating the TYPO3 pseudo-tag "<LINK>" for the link (includes href/url, target and class attributes):
-                                       $bTag='<link '.$info['url'].($attribArray['target']?' '.$attribArray['target']:(($attribArray['class'] || $attribArray['title'])?' -':'')).($attribArray['class']?' '.$attribArray['class']:($attribArray['title']?' -':'')).($attribArray['title']?' "'.$attribArray['title'].'"':'').'>';
+                                       $bTag='<link '.$info['url'].($info['query']?',0,'.$info['query']:'').($attribArray['target']?' '.$attribArray['target']:(($attribArray['class'] || $attribArray['title'])?' -':'')).($attribArray['class']?' '.$attribArray['class']:($attribArray['title']?' -':'')).($attribArray['title']?' "'.$attribArray['title'].'"':'').'>';
                                        $eTag='</link>';
                                        $blockSplit[$k] = $bTag.$this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])).$eTag;
                                } else {        // ... otherwise store the link as a-tag.
@@ -730,7 +730,8 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                                }
                                                $page = t3lib_BEfunc::getRecord('pages', $idPart);
                                                if (is_array($page))    {       // Page must exist...
-                                                       $href = $siteUrl.'?id='.$link_param;
+                                                       $pairParts = t3lib_div::trimExplode(',',$link_param);
+                                                       $href = $siteUrl.'?id='.$pairParts[0].($pairParts[2]?$pairParts[2]:'');
                                                } else if(strtolower(substr($link_param, 0, 7)) == 'record:') {
                                                                // linkHandler - allowing links to start with "record:"
                                                        $href = $link_param;
@@ -1540,12 +1541,14 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                        $info['type']='anchor';
                                } elseif (!trim($uP['path']) || !strcmp($uP['path'],'index.php'))       {
                                        $pp = explode('id=',$uP['query']);
-                                       $id = trim($pp[1]);
+                                       $parameters = explode('&', $pp[1]);
+                                       $id = array_shift($parameters);
                                        if ($id)        {
                                                $info['pageid']=$id;
                                                $info['cElement']=$uP['fragment'];
                                                $info['url']=$id.($info['cElement']?'#'.$info['cElement']:'');
                                                $info['type']='page';
+                                               $info['query'] = $parameters[0]?'&'.implode('&', $parameters):'';
                                        }
                                } else {
                                        $info['url']=$info['relUrl'];
index 745ce3b..36d0838 100755 (executable)
@@ -709,8 +709,8 @@ class browse_links {
         *
         * Values:
         * 0: form field name reference, eg. "data[tt_content][123][image]"
-        * 1: old/unused?
-        * 2: old/unused?
+        * 1: htlmArea RTE parameters: editorNo:contentTypo3Language:contentTypo3Charset
+        * 2: RTE config parameters: RTEtsConfigParams
         * 3: allowed types. Eg. "tt_content" or "gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai"
         * 4: IRRE uniqueness: target level object-id to perform actions/checks on, eg. "data[79][tt_address][1][<field>][<foreign_table>]"
         * 5: IRRE uniqueness: name of function in opener window that checks if element is already used, eg. "inline.checkUniqueElement"
@@ -2591,7 +2591,8 @@ class browse_links {
                                        $uP=parse_url($rel);
                                        if (!trim($uP['path'])) {
                                                $pp = explode('id=',$uP['query']);
-                                               $id = $pp[1];
+                                               $parameters = explode('&', $pp[1]);
+                                               $id = array_shift($parameters);
                                                if ($id)        {
                                                                // Checking if the id-parameter is an alias.
                                                        if (!t3lib_div::testInt($id))   {
@@ -2605,6 +2606,7 @@ class browse_links {
                                                        $info['pageid']=$id;
                                                        $info['cElement']=$uP['fragment'];
                                                        $info['act']='page';
+                                                       $info['query'] = $parameters[0]?'&'.implode('&', $parameters):'';
                                                }
                                        }
                                }
index 9ee5773..66ef81d 100644 (file)
@@ -2,6 +2,7 @@
 
        * Follow-up for feature #4686: htmlArea RTE Spell Checker: add u modifier to preg_* operations
        * Follow-up for bug #8232: Creating and editing of fields, forms, etc. in FCE's is impossible if there is a section inside
+       * Fixed issue #2714: In RTE htmlArea, unable to do an internal link with several parameters
 
 2008-08-16  Stanislas Rolland  <typo3@sjbr.ca>
 
index 1ffce25..0f5af34 100644 (file)
@@ -323,7 +323,7 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                        var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";
                        var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
 
-                       var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
+                       var cur_href="'.($this->curUrlArray['href'] ? ($this->curUrlInfo['query'] ? substr($this->curUrlArray['href'], 0, -strlen($this->curUrlInfo['query'])) :$this->curUrlArray['href']):'').'";
                        var cur_target="'.($this->setTarget?$this->setTarget:'').'";
                        var cur_class="'.($this->setClass?$this->setClass:'').'";
                        var cur_title="'.($this->setTitle?$this->setTitle:'').'";
@@ -349,7 +349,8 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                        // Functions used, if the link selector is in RTE mode:
                $JScode.='
                        function link_typo3Page(id,anchor)      {
-                               var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
+                               var parameters = document.ltargetform.query_parameters ? (document.ltargetform.query_parameters.value.charAt(0) == "&"?"":"&") + document.ltargetform.query_parameters.value : "";
+                               var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"")+parameters;
                                if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
                                if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
                                if (document.ltargetform.ltarget) setTarget(document.ltargetform.ltarget.value);
@@ -372,11 +373,12 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                                return false;
                        }
                        function link_current() {       //
+                               var parameters = document.ltargetform.query_parameters ? (document.ltargetform.query_parameters.value.charAt(0) == "&"?"":"&") + document.ltargetform.query_parameters.value : "";
                                if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
                                if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
                                if (document.ltargetform.ltarget) setTarget(document.ltargetform.ltarget.value);
                                if (cur_href!="http://" && cur_href!="mailto:") {
-                                       plugin.createLink(cur_href,cur_target,cur_class,cur_title);
+                                       plugin.createLink(cur_href + parameters,cur_target,cur_class,cur_title);
                                }
                                return false;
                        }
@@ -501,7 +503,8 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                if ($this->curUrlArray['all'])  {
                        $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
                }
-               $this->curUrlInfo=$this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
+               $this->curUrlArray['href'] = utf8_decode($this->curUrlArray['href']);
+               $this->curUrlInfo = $this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
                
                        // Determine nature of current url:
                $this->act = t3lib_div::_GP('act');
@@ -832,13 +835,14 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 
        function addAttributesForm() {
                $ltargetForm = '';
-                       // Add page id, target, class selector box and title field:
+                       // Add page id, target, class selector box, title and parameters fields:
                $lpageId = $this->addPageIdSelector();
+               $queryParameters = $this->addQueryParametersSelector();
                $ltarget = $this->addTargetSelector();
                $lclass = $this->addClassSelector();
                $ltitle = $this->addTitleSelector();
-               if ($lpageId || $ltarget || $lclass || $ltitle) {
-                       $ltargetForm = $this->wrapInForm($lpageId.$ltarget.$lclass.$ltitle);
+               if ($lpageId || $queryParameters || $ltarget || $lclass || $ltitle) {
+                       $ltargetForm = $this->wrapInForm($lpageId.$queryParameters.$ltarget.$lclass.$ltitle);
                }
                return $ltargetForm;
        }
@@ -880,6 +884,18 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                                                </tr>':'';
        }
        
+       function addQueryParametersSelector() {
+               global $LANG;
+               
+               return ($this->act == 'page' && $this->buttonConfig && is_array($this->buttonConfig['queryParametersSelector.']) && $this->buttonConfig['queryParametersSelector.']['enabled'])?'
+                                               <tr>
+                                                       <td>'.$LANG->getLL('query_parameters',1).':</td>
+                                                       <td colspan="3">
+                                                               <input type="text" name="query_parameters" value="' . ($this->curUrlInfo['query']?$this->curUrlInfo['query']:'') . '" ' . $this->doc->formWidth(30) . ' />
+                                                       </td>
+                                               </tr>':'';
+       }
+       
        function addTargetSelector() {
                global $LANG;
 
index f93cf7b..16fad6e 100644 (file)
@@ -39,6 +39,7 @@
                        <label index="currentLink">Current Link</label>
                        <label index="invalidChar">ERROR: Invalid character found in file path (%s). Cannot add the file!</label>
                        <label index="page_id">Page Id</label>
+                       <label index="query_parameters">Query parameters</label>
                </languageKey>
        </data>
        <orig_hash type="array">