Added feature #14658: Feature: internal links with parameters outside the RTE (headli...
authorSteffen Kamper <info@sk-typo3.de>
Sat, 9 Oct 2010 11:12:28 +0000 (11:12 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Sat, 9 Oct 2010 11:12:28 +0000 (11:12 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9017 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/class.browse_links.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/lang/locallang_browse_links.xml
typo3/sysext/t3skin/stylesheets/structure/element_rte.css

index 382705c..3e0d019 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-10-10  Steffen Kamper  <steffen@typo3.org>
 
+       * Added feature #14658: Feature: internal links with parameters outside the RTE (headlines, images ...)
        * Fixed bug #15828: Enhance the ExtDirect debugging feature (Thanks to Stefan Galinski)
        * Fixed bug #15865 clickmenu breaks if no record set. (Thanks to Bjoern Pedersen)
        * Fixed bug #15230: Bug/Feature: Core only is able to load one specific IE6 CSS file (Thanks to Steffen Ritter)
index 986cb31..d8c12f0 100644 (file)
@@ -820,6 +820,7 @@ class browse_links {
                                'target' => $currentLinkParts[1],
                                'class'  => $currentLinkParts[2],
                                'title'  => $currentLinkParts[3],
+                               'params'  => $currentLinkParts[4]
                        );
                        $this->curUrlArray = (is_array(t3lib_div::_GP('curUrl'))) ?
                                array_merge($initialCurUrlArray, t3lib_div::_GP('curUrl')) :
@@ -882,6 +883,9 @@ class browse_links {
 
                        // Initializing the title value (RTE)
                $this->setTitle = ($this->curUrlArray['title'] != '-') ? $this->curUrlArray['title'] : '';
+               
+                       // Initializing the params value
+               $this->setParams = ($this->curUrlArray['params'] != '-') ? $this->curUrlArray['params'] : '';
 
                        // BEGIN accumulation of header JavaScript:
                $JScode = '
@@ -894,8 +898,9 @@ class browse_links {
 
                        var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
                        var cur_target="'.($this->setTarget?$this->setTarget:'').'";
-                       var cur_class = "'.($this->setClass ? $this->setClass : '-').'";
+                       var cur_class = "' . ($this->setClass ? $this->setClass : '') . '";
                        var cur_title="'.($this->setTitle?$this->setTitle:'').'";
+                       var cur_params="' . ($this->setParams ? $this->setParams : '') . '";
 
                        function browse_links_setTarget(target) {       //
                                cur_target=target;
@@ -913,6 +918,10 @@ class browse_links {
                                cur_href=value;
                                add_href="&curUrl[href]="+value;
                        }
+                       function browse_links_setParams(params) {       //
+                               cur_params=params;
+                               add_params="&curUrl[params]="+escape(params);
+                       }
                ';
 
                if ($this->mode == 'wizard')    {       // Functions used, if the link selector is in wizard mode (= TCEforms fields)
@@ -975,21 +984,27 @@ class browse_links {
                                function updateValueInMainForm(input)   {       //
                                        var field = checkReference();
                                        if (field)      {
-                                               if (cur_target == "" && (cur_title != "" || cur_class != "-")) {
+                                               if (cur_target == "" && (cur_class != "" || cur_title != "" || cur_params != "")) {
                                                        cur_target = "-";
                                                }
-                                               if (cur_title == "" && cur_class == "-") {
-                                                       cur_class = "";
+                                               if (cur_class == "" && (cur_title != "" || cur_params != "")) {
+                                                       cur_class = "-";
                                                }
                                                cur_class = cur_class.replace(/[\'\"]/g, "");
                                                if (cur_class.indexOf(" ") != -1) {
                                                        cur_class = "\"" + cur_class + "\"";
                                                }
+                                               if (cur_title == "" && cur_params != "") {
+                                                       cur_title = "-";
+                                               }
                                                cur_title = cur_title.replace(/(^\")|(\"$)/g, "");
                                                if (cur_title.indexOf(" ") != -1) {
                                                        cur_title = "\"" + cur_title + "\"";
                                                }
-                                               input = input + " " + cur_target + " " + cur_class + " " + cur_title;
+                                               if (cur_params) {
+                                                       cur_params = cur_params.replace(/\bid\=.*?(\&|$)/, "");
+                                               }
+                                               input = input + " " + cur_target + " " + cur_class + " " + cur_title + " " + cur_params;
                                                field.value = input;
                                                '.$update.'
                                        }
@@ -1465,6 +1480,17 @@ class browse_links {
                }
 
                $content .= '
+                       <!--
+                               Selecting params for link:
+                       -->
+                               <form action="" name="lparamsform" id="lparamsform">
+                                       <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkParams">
+                                               <tr>
+                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('params', 1) . '</td>
+                                                       <td><input type="text" name="lparams" class="typo3-link-input" onchange="browse_links_setParams(this.value);" value="' . htmlspecialchars($this->setParams) . '" /></td>
+                                               </tr>
+                                       </table>
+                               </form>
 
                        <!--
                                Selecting class for link:
@@ -1473,7 +1499,7 @@ class browse_links {
                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass">
                                                <tr>
                                                        <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('class', 1) . '</td>
-                                                       <td><input type="text" name="lclass" onchange="browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass) . '"' . $this->doc->formWidth(10) . ' /></td>
+                                                       <td><input type="text" name="lclass" class="typo3-link-input" onchange="browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass) . '" /></td>
                                                </tr>
                                        </table>
                                </form>
@@ -1485,7 +1511,7 @@ class browse_links {
                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle">
                                                <tr>
                                                        <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('title', 1) . '</td>
-                                                       <td><input type="text" name="ltitle" onchange="browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle) . '"' . $this->doc->formWidth(10) . ' /></td>
+                                                       <td><input type="text" name="ltitle" class="typo3-link-input" onchange="browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle) . '" /></td>
                                                </tr>
                                        </table>
                                </form>
@@ -1524,6 +1550,7 @@ class browse_links {
                                        browse_links_setTarget(document.ltargetform.ltarget.value);
                                        browse_links_setClass(document.lclassform.lclass.value);
                                        browse_links_setTitle(document.ltitleform.ltitle.value);
+                                       browse_links_setParams(document.lparamsform.lparams.value);
                                        document.ltargetform.popup_width.selectedIndex=0;
                                        document.ltargetform.popup_height.selectedIndex=0;
                                }
index 6e952ce..45490f4 100644 (file)
@@ -6402,9 +6402,16 @@ class tslib_cObj {
                        if ($linkClass == '-')
                                $linkClass = ''; // The '-' character means 'no class'. Necessary in order to specify a title as fourth parameter without setting the target or class!
                        $forceTarget = trim($link_paramA[1]); // Target value
+                       if ($forceTarget == '-') {
+                               $forceTarget = '';      // The '-' character means 'no target'. Necessary in order to specify a class as third parameter without setting the target!
+                       }
                        $forceTitle = trim($link_paramA[3]); // Title value
-                       if ($forceTarget == '-')
-                               $forceTarget = ''; // The '-' character means 'no target'. Necessary in order to specify a class as third parameter without setting the target!
+                       if ($forceTitle == '-') {
+                               $forceTitle = '';       // The '-' character means 'no title'. Necessary in order to specify further parameters without setting the title!
+                       }
+                       $forceParams = trim($link_paramA[4]);   // params value
+                       $conf['additionalParams'] .= $forceParams[0] == '&' ? $forceParams : '&' . $forceParams;
+
                                // Check, if the target is coded as a JS open window link:
                        $JSwindowParts = array();
                        $JSwindowParams = '';
index ac208c0..1354a72 100755 (executable)
@@ -21,6 +21,7 @@
                        <label index="target">Target</label>
                        <label index="class">CSS-Class</label>
                        <label index="title">Title</label>
+                       <label index="params">Additional link parameters</label>
                        <label index="target_popUpWindow">Open in window</label>
                        <label index="target_popUpWindow_width">Width</label>
                        <label index="target_popUpWindow_height">Height</label>
index 3082acc..0e8c888 100644 (file)
@@ -69,4 +69,8 @@ table#typo3-msgBox {
 
 table#typo3-msgBox tr td {
        padding: 10px 50px 10px 50px;
+}
+
+input.typo3-link-input {
+       width: 250px;
 }
\ No newline at end of file