Project

General

Profile

Bug #19317 ยป rtehtmlarea_bugfix_9331_v2.patch

Administrator Admin, 2008-09-17 00:48

View differences:

typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php (copie de travail)
/***************************************************************
* Copyright notice
*
* (c) 2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
* (c) 2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
......
/**
* Acronym extension for htmlArea RTE
*
* @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
* @author Stanislas Rolland <typo3(arobas)sjbr.ca>
*
* TYPO3 SVN ID: $Id$
*
......
$whereClause .= t3lib_BEfunc::deleteClause($table);
$res = $TYPO3_DB->exec_SELECTquery('type,term,acronym', $table, $whereClause);
while($acronymRow = $TYPO3_DB->sql_fetch_assoc($res)) {
if( $acronymRow['type'] == 1) $JSAcronymArray .= (($this->acronymIndex++)?',':'') . '"' . $acronymRow['acronym'] . '":"' . $acronymRow['term'] . '"' . $linebreak;
if ($acronymRow['type'] == 2) $JSAbbreviationArray .= (($this->AbbreviationIndex++)?',':'') . '"' . $acronymRow['acronym'] . '":"' . $acronymRow['term'] . '"' . $linebreak;
if( $acronymRow['type'] == 1) $JSAcronymArray .= (($this->acronymIndex++)?',':'') . '"' . $acronymRow['term'] . '":"' . $acronymRow['acronym'] . '"' . $linebreak;
if ($acronymRow['type'] == 2) $JSAbbreviationArray .= (($this->AbbreviationIndex++)?',':'') . '"' . $acronymRow['term'] . '":"' . $acronymRow['acronym'] . '"' . $linebreak;
}
$JSAcronymArray .= '};' . $linebreak;
$JSAbbreviationArray .= '};' . $linebreak;
typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php (copie de travail)
document.getElementById("abbrType").innerHTML = "' . $LANG->getLL('Abbreviation') . '";
}
document.getElementById("title").value = param["title"];
fillSelect(param["text"]);
fillSelect(param);
dialog.resize();
}
......
document.getElementById("title").focus();
};
function fillSelect(text) {
function fillSelect(param) {
var termSelector = document.getElementById("termSelector");
var acronymSelector = document.getElementById("acronymSelector");
while(termSelector.options.length>1) termSelector.options[termSelector.length-1] = null;
while(acronymSelector.options.length>1) acronymSelector.options[acronymSelector.length-1] = null;
if(abbrType == "acronym") var abbrObj = acronyms;
else var abbrObj = abbreviations;
if(abbrObj != "") {
for(var i in abbrObj) {
same = (i==text);
termSelector.options[termSelector.options.length] = new Option(abbrObj[i], abbrObj[i], false, same);
acronymSelector.options[acronymSelector.options.length] = new Option(i, i, false, same);
if(same) document.content.title.value = abbrObj[i];
while (termSelector.options.length > 1) {
termSelector.options[termSelector.length-1] = null;
}
while (acronymSelector.options.length > 1) {
acronymSelector.options[acronymSelector.length-1] = null;
}
if (abbrType == "acronym") {
var abbrObj = acronyms;
} else {
var abbrObj = abbreviations;
}
if(acronymSelector.options.length == 1) {
if (abbrObj != "") {
var sameTerm = false;
var sameAbbreviation = false;
var selectedOption = false;
for (var i in abbrObj) {
if (abbrObj.hasOwnProperty(i)) {
if (param["title"]) {
sameTerm = (param["title"] == i);
} else {
sameTerm = (param["text"] == i);
}
sameAbbreviation = (param["text"] == abbrObj[i]);
if (!selectedOption && (sameTerm || sameAbbreviation)) {
selectedOption = i;
}
if (!param["text"] || sameTerm || sameAbbreviation) {
termSelector.options[termSelector.options.length] = new Option(i, i, false, (selectedOption == i));
acronymSelector.options[acronymSelector.options.length] = new Option(abbrObj[i], abbrObj[i], false, (selectedOption == i));
}
if (selectedOption == i) {
document.content.title.value = i;
}
}
}
}
if (acronymSelector.options.length == 1) {
document.getElementById("selector").style.display = "none";
} else {
document.getElementById("selector").style.display = "block";
    (1-1/1)