Changeset 2557 for sandbox/expressoMail1_2/corretor_ortografico
- Timestamp:
- 04/16/10 10:55:43 (14 years ago)
- Location:
- sandbox/expressoMail1_2/corretor_ortografico/spell_checker
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/expressoMail1_2/corretor_ortografico/spell_checker/js/spell_checker.js
r2554 r2557 412 412 function spellCheck_cb(new_data) 413 413 { 414 415 var ifr= currObj.objToCheck; 414 var ifr= currObj.objToCheck; 416 415 if(ifr.contentWindow) 417 416 ifr=ifr.contentWindow.document; … … 419 418 ifr=ifr.contentDocument; 420 419 421 422 420 with(currObj); 423 421 … … 426 424 new_data = new_data.substring(1); 427 425 428 429 430 if(currObj.spellingResultsDiv) 431 { 432 433 ifr.removeChild(currObj.spellingResultsDiv.id); 434 435 } 436 437 438 var ifr= currObj.objToCheck; 439 if(ifr.contentWindow) 440 ifr=ifr.contentWindow.document; 441 else 442 ifr=ifr.contentDocument; 443 ifr.body.innerHTML = ""; 444 var cssLink = ifr.createElement("link"); 445 cssLink.href = "spell_checker/css/spell_checker.css"; 446 cssLink .rel = "stylesheet"; 447 cssLink .type = "text/css"; 448 //Testes nathalie - substituido 426 if(currObj.spellingResultsDiv) 427 { 428 ifr.removeChild(currObj.spellingResultsDiv.id); 429 } 430 431 var ifr= currObj.objToCheck; 432 if(ifr.contentWindow) 433 ifr=ifr.contentWindow.document; 434 else 435 ifr=ifr.contentDocument; 436 ifr.body.innerHTML = ""; 437 var cssLink = ifr.createElement("link"); 438 cssLink.href = "spell_checker/css/spell_checker.css"; 439 cssLink .rel = "stylesheet"; 440 cssLink .type = "text/css"; 441 442 // this is not being used 449 443 currObj.spellingResultsDiv = ifr.createElement('span'); 450 444 currObj.spellingResultsDiv.className = 'edit_box'; … … 457 451 //currObj.objToCheck.style.display = "none"; 458 452 currObj.statusSpan.innerHTML = ""; 459 460 //ifr.body.appendChild(currObj.spellingResultsDiv); 461 //alert(new_data); 462 ifr.body.innerHTML = ""; 463 //alert(new_data); 464 //new_data = new_data.replace(/ </g ," <"); 465 //alert(new_data); 466 467 ifr.body.innerHTML = new_data; 468 //alert(ifr.body.innerHTML); 469 ifr.body.appendChild(cssLink); 453 454 //add the new_data to iframe and the css style 455 ifr.body.innerHTML = ""; 456 ifr.body.innerHTML = new_data; 457 ifr.body.appendChild(cssLink); 470 458 471 459 … … 623 611 query = query.replace(/\r?\n/gi, " "); // replace \n with " " - By Nathalie 624 612 625 cp.call(currObj.config['spellUrl'], 'spellCheck', spellCheck_cb, query, currObj.config['varName'], languageId); 613 var browser = trim(checkBrowser()); 614 615 cp.call(currObj.config['spellUrl'], 'spellCheck', spellCheck_cb, query, currObj.config['varName'], languageId, browser); 626 616 627 617 }; // end spellcheck -
sandbox/expressoMail1_2/corretor_ortografico/spell_checker/spell_checker.php
r2554 r2557 162 162 * 163 163 *************************************************************/ 164 function spellCheck($string, $varName, $language )164 function spellCheck($string, $varName, $language, $browser) 165 165 { 166 166 //global $pspell_link; //the global link to the pspell module … … 181 181 $numResults = count($words); //the number of elements in the array. 182 182 183 $misspelledCount = 0; 183 $misspelledCount = 0; 184 185 186 /* There is a problem with innerHTML of IE browsers - It removes the spaces. 187 * If there are two misspelled words side by side, it makes then together (no space 188 * between then). This will be checked using this variable. 189 * */ 190 $difference = 0; 184 191 185 192 //this loop looks through the words array and splits any lines of text that aren't html tags on space, preserving the spaces. … … 207 214 { 208 215 $onClick = "onclick=\"setCurrentObject(" . $varName . "); showSuggestions('" . addslashes($tmpWord) . "', '" . $varName . "_" . $misspelledCount . "_" . addslashes($tmpWord) . "'); return false;\""; 209 $words[$i][$j] = str_replace($tmpWord, " <span " . $onClick . " id=\"" . $varName . "_" . $misspelledCount . "_" . $tmpWord . "\" class=\"highlight\">" . stripslashes($tmpWord) . " </span> ", $words[$i][$j]); 216 217 $difference = $misspelledCount + 1; 218 if (($difference - $misspelledCount) == 1 and $browser == "ie") //if IE, adds a html space before Span tag 219 $words[$i][$j] = str_replace($tmpWord, "<span " . $onClick . " id=\"" . $varName . "_" . $misspelledCount . "_" . $tmpWord . "\" class=\"highlight\">" . stripslashes($tmpWord) . " </span> ", $words[$i][$j]); 220 else 221 $words[$i][$j] = str_replace($tmpWord, "<span " . $onClick . " id=\"" . $varName . "_" . $misspelledCount . "_" . $tmpWord . "\" class=\"highlight\">" . stripslashes($tmpWord) . " </span>", $words[$i][$j]); 222 210 223 $misspelledCount++; 211 } 224 225 } 212 226 213 227 $words[$i][$j] = str_replace("\n", "<br />", $words[$i][$j]); //replace any breaks with <br />'s, for html display
Note: See TracChangeset
for help on using the changeset viewer.