* Copyright notice
*
* (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
-* (c) 2005-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+* (c) 2005-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* $Id$
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+ * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
*/
require_once (PATH_typo3.'class.browse_links.php');
// Rich Text Editor specific configuration:
$addPassOnParams='';
+ $classSelected = array();
if ((string)$this->mode=='rte') {
$RTEtsConfigParts = explode(':',$this->RTEtsConfigParams);
$addPassOnParams .= '&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);
while(list(,$class)=each($classesAnchorArray)) {
if (!in_array($class, $classesAnchor['all']) || (in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType]))) {
$selected = '';
- if ($this->setClass == $class) $selected = 'selected="selected"';
- if (!$this->setClass && $this->classesAnchorDefault[$anchorType] == $class) {
+ if ($this->setClass == $class || (!$this->setClass && $this->classesAnchorDefault[$anchorType] == $class)) {
$selected = 'selected="selected"';
+ $classSelected[$anchorType] = true;
}
$classLabel = (is_array($RTEsetup['properties']['classes.']) && is_array($RTEsetup['properties']['classes.'][$class.'.']) && $RTEsetup['properties']['classes.'][$class.'.']['name']) ? $this->getPageConfigLabel($RTEsetup['properties']['classes.'][$class.'.']['name'], 0) : $class;
$classStyle = (is_array($RTEsetup['properties']['classes.']) && is_array($RTEsetup['properties']['classes.'][$class.'.']) && $RTEsetup['properties']['classes.'][$class.'.']['value']) ? $RTEsetup['properties']['classes.'][$class.'.']['value'] : '';
}
// Initializing the target value (RTE)
- $this->setTarget = $this->curUrlArray['target'];
+ // Unset the target if it is set to a value different than default and if no class is selected and the target field is not displayed
+ // In other words, do not forward the target if we changed tab and the target field is not displayed
+ $this->setTarget = (isset($this->curUrlArray['target'])
+ && !(
+ ($this->curUrlArray['target'] != $this->thisConfig['defaultLinkTarget'])
+ && !$classSelected[$this->act]
+ && is_array($this->buttonConfig['targetSelector.']) && $this->buttonConfig['targetSelector.']['disabled'] && is_array($this->buttonConfig['popupSelector.']) && $this->buttonConfig['popupSelector.']['disabled'])
+ ) ? $this->curUrlArray['target'] : '';
if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
$this->setTarget=$this->thisConfig['defaultLinkTarget'];
}
var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
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);
plugin.createLink(theLink,cur_target,cur_class,cur_title);
return false;
}
var theLink = \''.$this->siteURL.'\'+folder;
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);
plugin.createLink(theLink,cur_target,cur_class,cur_title);
return false;
}
function link_spec(theLink) { //
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);
plugin.createLink(theLink,cur_target,cur_class,cur_title);
return false;
}
function link_current() { //
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);
}
$ltarget = '';
if ($this->act != 'mail') {
- if (!($targetSelectorConfig['disabled'] && $popupSelectorConfig['disabled'])) {
- $ltarget .= '
- <tr>
- <td>'.$LANG->getLL('target',1).':</td>
- <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget?$this->setTarget:(($this->setClass || !$this->classesAnchorDefault[$this->act])?'':$this->classesAnchorDefaultTarget[$this->act])).'"'.$this->doc->formWidth(10).' /></td>';
- $ltarget .= '
- <td colspan="2">';
- if (!$targetSelectorConfig['disabled']) {
- $ltarget .= '
- <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
- <option></option>
- <option value="_top">'.$LANG->getLL('top',1).'</option>
- <option value="_blank">'.$LANG->getLL('newWindow',1).'</option>
- </select>';
- }
+ $ltarget .= '
+ <tr id="ltargetrow"'. (($targetSelectorConfig['disabled'] && $popupSelectorConfig['disabled']) ? ' style="display: none;"' : '') . '>
+ <td>'.$LANG->getLL('target',1).':</td>
+ <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget?$this->setTarget:(($this->setClass || !$this->classesAnchorDefault[$this->act])?'':$this->classesAnchorDefaultTarget[$this->act])).'"'.$this->doc->formWidth(10).' /></td>';
+ $ltarget .= '
+ <td colspan="2">';
+ if (!$targetSelectorConfig['disabled']) {
$ltarget .= '
- </td>';
+ <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
+ <option></option>
+ <option value="_top">'.$LANG->getLL('top',1).'</option>
+ <option value="_blank">'.$LANG->getLL('newWindow',1).'</option>
+ </select>';
}
-
$ltarget .= '
- </tr>';
+ </td>
+ </tr>';
if (!$popupSelectorConfig['disabled']) {
$selectJS = 'if (document.ltargetform.popup_width.options[document.ltargetform.popup_width.selectedIndex].value>0 && document.ltargetform.popup_height.options[document.ltargetform.popup_height.selectedIndex].value>0) {
for (var i = HTMLArea.classesAnchorSetup.length; --i >= 0;) {
var anchorClass = HTMLArea.classesAnchorSetup[i];
if (anchorClass[\'name\'] == document.ltargetform.anchor_class.value) {
- if (anchorClass[\'titleText\'] && document.ltargetform.anchor_title) document.ltargetform.anchor_title.value = anchorClass[\'titleText\'];
+ if (anchorClass[\'titleText\'] && document.ltargetform.anchor_title) {
+ document.ltargetform.anchor_title.value = anchorClass[\'titleText\'];
+ setTitle(anchorClass[\'titleText\']);
+ }
if (anchorClass[\'target\']) {
if (document.ltargetform.ltarget) {
document.ltargetform.ltarget.value = anchorClass[\'target\'];
}
setTarget(anchorClass[\'target\']);
+ } else if (document.ltargetform.ltarget && document.getElementById(\'ltargetrow\').style.display == \'none\') {
+ // Reset target to default if field is not displayed and class has no configured target
+ document.ltargetform.ltarget.value = \''. ($this->thisConfig['defaultLinkTarget']?$this->thisConfig['defaultLinkTarget']:'') .'\';
+ setTarget(document.ltargetform.ltarget.value);
}
break;
}