Ignore:
Timestamp:
04/16/10 10:55:43 (14 years ago)
Author:
nathalie.silva
Message:

Ticket #891 - alterada a função spell_checker no php - Nathalie

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/expressoMail1_2/corretor_ortografico/spell_checker/spell_checker.php

    r2554 r2557  
    162162 * 
    163163 *************************************************************/ 
    164 function spellCheck($string, $varName, $language) 
     164function spellCheck($string, $varName, $language, $browser) 
    165165{ 
    166166        //global $pspell_link; //the global link to the pspell module 
     
    181181        $numResults = count($words); //the number of elements in the array. 
    182182 
    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;  
    184191    
    185192        //this loop looks through the words array and splits any lines of text that aren't html tags on space, preserving the spaces. 
     
    207214                                {                                         
    208215                                        $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>&nbsp;", $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 
    210223                                        $misspelledCount++; 
    211                                 }  
     224                                         
     225                                }                                 
    212226                                 
    213227                                $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.