Project

General

Profile

Actions

Bug #16590

closed

wrong titletext handling in link browser

Added by ELAMRI about 18 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2006-09-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Le champ de formulaire de type "Link" présente le défaut suivant :

Si on saisi dans le wizard l'url http://www.domaine.com et qu'on renseigne le title toto titi tata et le target Nouvelle fenêtre alors le code enregistré dans la base est le suivant :

www.domaine.com _target toto titi tata

La fonction typo3 à utiliser pour créer un lien à partir de cet enregistremen est "cObj->getTypoLink()". Dans l'exemple ci-dessus, la génération du lien se fait comme suit :

$lien = $this->cObj->getTypoLink ("mon lien","www.domaine.com _target toto titi tata");

voici la code récupéré dans la variable $lien :

<a href="http://www.domaine.com" title="titi" target="_blank" class="toto" >mon lien</a>

ce qui ne correspond pas au résultat souhaité. Il s'agit d'un bug dans Typo3.

Le problème provient d'une fonction Javascript "link_current()" utilisée pour générer le code du lien et de le transférer depuis le wizard vers le formulaire.

La correction est à apporter au niveau du fichier "typo3/class.browse_links.php" dans la fonction "init()" qui gènère les fonctions JS à la ligne 889 :

- Mettre en commentaire la ligne :
var setValue = cur_href+" "+cur_target+" "+cur_title;
- Ajouter à la suite les lignes suivantes qui ajoute la classe maClasse et met le title entre guillemets en l'ayant préalablement nettoyée :
var monTitre = cur_title;
var monTitreNettoye = monTitre.replace(/\"/g,"‘‘");
var setValue = cur_href+" "+cur_target+" maClasse \""+cur_title+"\"";

Avec cette modification, le code du lien obtenue devient :

www.domaine.com _target maClasse "toto titi tata"

qui correspond mieux à la syntaxe attendue par la fonction getTypoLink . Le lien généré est alors :

<a href="http://www.domaine.com&quot; title="toto titi tata" target="_blank" class="maClasse" >mon lien</a>

(issue imported from #M4275)


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #20142: class and title parameters of typolinks get brokenClosedStanislas Rolland2009-03-06

Actions
Actions #1

Updated by Michael Stucki about 18 years ago

Please report bugs in English, otherwise they will be closed...

Actions #2

Updated by Fronzes Philippe about 18 years ago

I confirm this bug.
Actually, the typolink function was updated to work with the browse_link script of the rtehtmlarea, with the inclusion of the style of the link, but the old browse_link script doesn't manage this style param, and then, the title is displayed in the class attribute of the link.

The patch provided works well, until the style parameter will be added to the old browse_link script.
However, I would change this line in the patch:
var setValue = cur_href+" "+cur_target+" maClasse \""+cur_title+"\"";
with
var setValue = cur_href+" "+cur_target+" - \""+cur_title+"\"";
to be consistent with the function typolink of class.tslib_content.php
line 5052: if ($linkClass=='-') $linkClass = ''; // The '-' character means 'no class'. Necessary in order to specify a title as fourth parameter without setting the target or class!

Actions #3

Updated by Francois Suter over 16 years ago

The bug description is entirely clear (especially since HTML was pasted and cleaned up by Mantis), but here is the gist of it.

When defining a link in the browse link dialog box, you can set a reference, a target and a title. As far as I understand, if the title contains spaces, it is badly interpreted.

It furthermore seems to get mixed up with the fact that a 4th parameter was added (to define a class attribute) and this is not handled consistently.

Hopes this helps...

Actions #4

Updated by Susanne Moog over 16 years ago

I have just tested it with current trunk:

Steps to reproduce
1.) Open the link browser (I tested using the one of the header of a content element)
2.) Insert information in every field (class, title, target)
3.) Insert spaces in your title
4.) save and go to the frontend
5.) in frontend all you will see as title is the first word you entered. anything after the first word is cut off.

Solution:
If title is entered with " " around it works as expected. so the link browser should insert quotation marks.

Actions #5

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF