Ignore:
Timestamp:
04/06/10 13:38:20 (14 years ago)
Author:
nathalie.silva
Message:

Ticket #891 - Arrumado o problema de abrir em mais de uma aba. Adicionado o Ignorar pra cada palavra - Nathalie

Location:
sandbox/expressoMail1_2/corretor_ortografico/spell_checker
Files:
3 edited

Legend:

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

    r2375 r2430  
    2626.corrected_word 
    2727{ 
     28        color: #005500; 
     29} 
     30 
     31 
     32.ignore { 
     33        cursor: pointer; 
     34        text-decoration: underline; 
     35        font-family: Verdana, Arial, Helvetica, sans-serif; 
     36        font-size: 11px; 
    2837        color: #005500; 
    2938} 
  • sandbox/expressoMail1_2/corretor_ortografico/spell_checker/js/spell_checker.js

    r2407 r2430  
    4040var currObj; //the current spell checker being used 
    4141var spellingSuggestionsDiv; 
    42 var old_onclick 
     42var old_onclick; 
     43var positionEditor; 
     44var areaEditor; 
     45var abaEditor;  
    4346cp = new cpaint(); 
    4447cp.set_transfer_mode('post'); 
    4548cp.set_response_type('text'); 
    46 function beginSpellCheck(){ 
    47  
     49function beginSpellCheck(position, area, aba){ 
     50 
     51     
    4852    //var cp = new cpaint(); 
    49    // alert("Seta globals"); 
     53    // alert("Seta globals"); 
    5054    //cp = new cpaint(); 
    5155    //cp.set_transfer_mode('post'); 
     
    5660    //var spellingSuggestionsDiv = null;  // Auto-generated suggestions div 
    5761 
     62    spellingSuggestionsDiv = null; 
     63    positionEditor = position; 
     64    areaEditor = area; 
     65    abaEditor = aba;  
    5866     
    59     spellingSuggestionsDiv = null; 
    6067 
    6168    //alert("Seta globals"); 
     
    118125function setupSpellCheckers() 
    119126{ 
    120         var ifr = document.getElementsByTagName('iframe')[0]; 
    121         var numSpellCheckers = 0; 
    122         //var tempSpellCheckers = Array(); 
    123                  
    124         if(ifr.contentWindow) 
    125            ifr=ifr.contentWindow.document; 
    126         else 
    127            ifr=ifr.contentDocument; 
    128         var texto = ifr.body.innerHTML; 
    129  
    130        //  alert("valor textarea"); 
    131        //  alert(texto); 
    132         // //tempSpellCheckers[numSpellCheckers] = textareas; 
    133          var tempWidth = "300"; 
    134          var tempHeight = "300"; 
    135           
    136         // alert("Antes AjaxSpell"); 
    137          eval('spellCheckers' + numSpellCheckers + '= new ajaxSpell("spellCheckers' + numSpellCheckers + '", tempWidth, tempHeight, "spell_checker/spell_checker.php", "body_position_1", "Nome", "body_1", "Titulo", texto);'); 
    138  
    139          
    140          //new  ajaxSpell('spellTexto', tempWidth, tempHeight, 'spell_checker.php' ,'body_position_1', 'Nome','body_1', 'Titulo', texto); 
    141           
    142          //ajaxSpell("", "", "", "" ,"", "","", "", ""); 
    143  
    144         //} 
    145  
    146         /*for(var i=0; i < textareas.length; i++) 
    147         { 
    148                 alert("ok iframe"); 
    149                 if(textareas[i].getAttribute("title") == "spellcheck" || textareas[i].getAttribute("title") == "spellcheck_icons") 
    150                 { 
    151                         tempSpellCheckers[numSpellCheckers] = textareas[i]; 
    152                          
    153                         //create a new spellchecker for this textarea 
    154                         var tempWidth = tempSpellCheckers[numSpellCheckers].offsetWidth + 'px'; 
    155                         var tempHeight = tempSpellCheckers[numSpellCheckers].offsetHeight + 'px'; 
    156                         eval('spellCheckers' + numSpellCheckers + '= new ajaxSpell("spellCheckers' + numSpellCheckers + '", tempWidth, tempHeight, tempSpellCheckers[' + numSpellCheckers + '].getAttribute("accesskey"), "spellCheckDiv' + numSpellCheckers + '", tempSpellCheckers[' + numSpellCheckers + '].getAttribute("name"), tempSpellCheckers[' + numSpellCheckers + '].id, tempSpellCheckers[' + numSpellCheckers + '].title, tempSpellCheckers[' + numSpellCheckers + '].value);'); 
    157                         numSpellCheckers++; 
    158                 } 
    159         }*/ 
     127    var ifr = document.getElementsByTagName('iframe')[0]; 
     128    var numSpellCheckers = abaEditor; 
     129 
     130    if(ifr.contentWindow) 
     131    ifr=ifr.contentWindow.document; 
     132    else 
     133    ifr=ifr.contentDocument; 
     134    var texto = ifr.body.innerHTML; 
     135 
     136    var tempWidth = "99%"; 
     137    var tempHeight = "300"; 
     138 
     139    eval('spellCheckers' + numSpellCheckers + '= new ajaxSpell("spellCheckers' + numSpellCheckers + '", tempWidth, tempHeight, "spell_checker/spell_checker.php", positionEditor, "Nome", areaEditor, "Titulo", texto);'); 
    160140         
    161141}; // end setInit 
     
    181161function ajaxSpell(varName, width, height, spellUrl, divId, name, id, title, value) 
    182162{ 
    183         //alert("ajaxSpell"); 
    184  
     163         
    185164        currObj = this; 
    186165 
     
    195174        currObj.config['title']      = title;               //the title (specifies whether to use icons or not); 
    196175        currObj.config['value']      = value;               //the value of the text box when the page was loaded 
    197  
    198         currObj.config['value']      = currObj.config['value'].replace(/<br *\/?>/gi, "\n"); 
     176        currObj.config['aba']      = abaEditor; 
     177 
     178        //currObj.config['value']      = currObj.config['value'].replace(/<br *\/?>/gi, "\n"); // Comment from the original by Nathalie 
    199179         
    200180        currObj.config['useIcons'] = false; 
     
    243223        oldElement.value = currObj.config['value']; 
    244224        document.getElementById(currObj.config['divId']).appendChild(oldElement); 
     225 
    245226         
    246227        currObj.objToCheck              = document.getElementById(currObj.config['id']);      //the actual object we're spell checking 
     
    258239        ajaxSpell.prototype.resetSpellChecker    = resetSpellChecker; 
    259240        ajaxSpell.prototype.resetAction          = resetAction; 
     241 
     242       
     243         
    260244}; // end ajaxSpell 
    261245 
     
    271255function setCurrentObject(obj) 
    272256{ 
    273         currObj = obj; 
     257        currObj  = obj; 
     258         
    274259         
    275260}; // end setCurrentObject 
     
    295280        var isThereAMisspelling = new_data.charAt(0); 
    296281        new_data = new_data.substring(1); 
    297                  
     282 
    298283        if(currObj.spellingResultsDiv) 
    299284        { 
     285             
    300286                currObj.spellingResultsDiv.parentNode.removeChild(spellingResultsDiv); 
    301287        } 
    302          
    303         currObj.spellingResultsDiv = document.createElement('DIV'); 
     288 
     289        currObj.spellingResultsDiv = document.createElement('DIV'); 
    304290        currObj.spellingResultsDiv.className = 'edit_box'; 
    305         currObj.spellingResultsDiv.style.width = currObj.objToCheck.style.width; 
    306         currObj.spellingResultsDiv.style.height = currObj.objToCheck.style.height; 
     291        currObj.spellingResultsDiv.id = 'edit_box'; //Added the id property - By Nathalie 
     292        currObj.spellingResultsDiv.style.width =  "99%";//the width of the textarea 
     293        currObj.spellingResultsDiv.style.height = 300;  //   = height; //currObj.objToCheck.style.height; 
    307294        currObj.spellingResultsDiv.innerHTML = new_data; 
    308          
    309         currObj.objToCheck.style.display = "none"; 
     295 
     296        currObj.objToCheck.style.display = "none"; 
    310297        currObj.objToCheck.parentNode.insertBefore(currObj.spellingResultsDiv,currObj.objToCheck); 
    311         currObj.statusSpan.innerHTML = ""; 
    312          
     298        currObj.statusSpan.innerHTML = "";     
     299         
     300      
    313301        if(currObj.config['useIcons']) 
    314302        { 
     
    346334        with(currObj); 
    347335        var query; 
    348          
     336 
    349337        if(currObj.spellingResultsDiv) 
    350338        { 
     
    382370         
    383371        query = texto; 
    384         //query = currObj.objToCheck.value; 
    385          
    386         query = query.replace(/\r?\n/gi, "<br />"); 
     372        //query = currObj.objToCheck.value;         
     373         
     374        //query = query.replace(/\r?\n/gi, "<br />"); //  Commented from the original by Nathalie 
     375        query = query.replace(/\r?\n/gi, " ");  // replace \n with " " - By Nathalie 
     376        
    387377         
    388378        cp.call(currObj.config['spellUrl'], 'spellCheck', spellCheck_cb, query, currObj.config['varName']); 
     
    436426function addWord_cb(returnedData) 
    437427{ 
    438         //alert(returnedData); 
    439428        with(currObj); 
    440429        currObj.statusSpan.innerHTML = ""; 
     
    459448function checkClickLocation(e) 
    460449{ 
    461  
    462    // alert("checkClickLocation"); 
     450    
    463451    if(spellingSuggestionsDiv) 
    464452        { 
     
    523511function checkBrowser() 
    524512{ 
     513       
    525514        var theAgent = navigator.userAgent.toLowerCase(); 
    526515        if(theAgent.indexOf("msie") != -1) 
     
    581570function showSuggestions_cb(new_data) 
    582571{ 
    583         with(currObj); 
     572         
     573        with(currObj); 
    584574        spellingSuggestionsDiv.innerHTML = new_data; 
    585575        spellingSuggestionsDiv.style.display = 'block'; 
     
    605595function showSuggestions(word, id) 
    606596{ 
    607         with(currObj); 
     597 
     598        with(currObj); 
    608599        if(currObj.config['useIcons']) 
    609600        { 
     
    663654function replaceWord(id, newWord) 
    664655{ 
     656      
    665657        document.getElementById(id).innerHTML = trim(newWord); 
    666658        if(spellingSuggestionsDiv) 
     
    688680function switchText() 
    689681{ 
    690         with(currObj); 
    691         var parentElement = currObj.spellingResultsDiv; 
     682 
     683        with(currObj); 
     684 
     685        //By Nathalie - The Element means that this div belongs to the current tab 
     686        var parentElement = Element(currObj.spellingResultsDiv.id);  
    692687 
    693688        // Obtain all span tags which have highlight className or corrected_word className 
     
    735730function switchText_cb(new_string) 
    736731{ 
    737         with(currObj); 
    738          
     732 
     733        with(currObj); 
     734 
    739735        new_string = new_string.replace(/ %u2026/gi, "&nbsp;"); // Replace the code %u2026 with &nbsp; 
    740736              
     
    745741 
    746742 
    747         currObj.objToCheck.style.display = "none"; 
     743         currObj.objToCheck.style.display = "none"; 
    748744         var ifr= currObj.objToCheck; 
    749745         if(ifr.contentWindow) 
     
    755751         ifr.body.innerHTML = new_string; 
    756752        currObj.objToCheck.disabled = false; 
     753         
    757754        if(currObj.spellingResultsDiv) 
    758755        { 
     
    776773function resumeEditing() 
    777774{ 
     775         
     776        with(currObj); 
     777        if(currObj.config['useIcons']) 
     778        { 
     779                currObj.actionSpan.innerHTML = "<a class=\"resume_editing\"><img src=\"images/page_white_edit.png\" width=\"16\" height=\"16\" title=\"Continuar Editando\" alt=\"Continuar Editando\" border=\"0\" /></a>"; 
     780        } 
     781        else 
     782        { 
     783                currObj.actionSpan.innerHTML = "<a class=\"resume_editing\">Continuar Editando</a>"; 
     784        } 
     785        if(currObj.config['useIcons']) 
     786        { 
     787                currObj.statusSpan.innerHTML = "<img src=\"images/working.gif\" width=\"16\" height=\"16\" title=\"Carregando...\" alt=\"Carregando...\" border=\"0\" />"; 
     788        } 
     789        else 
     790        { 
     791                currObj.statusSpan.innerHTML = "Carregando..."; 
     792        } 
     793        
     794         
     795        if(spellingSuggestionsDiv) 
     796        { 
     797                 
     798                spellingSuggestionsDiv.id.parentNode.removeChild(spellingSuggestionsDiv);  
     799                spellingSuggestionsDiv = null; 
     800        } 
     801         
     802        currObj.switchText(); 
     803}; // end resumeEditing 
     804 
     805 
     806/************************************************************* 
     807 * resetAction 
     808 * 
     809 * The resetAction function just resets the status message to 
     810 * the default action of "Check Spelling". 
     811 *************************************************************/ 
     812function resetAction() 
     813{ 
     814        
    778815        with(currObj); 
    779816        if(currObj.config['useIcons']) 
    780817        { 
    781                 currObj.actionSpan.innerHTML = "<a class=\"resume_editing\"><img src=\"images/page_white_edit.png\" width=\"16\" height=\"16\" title=\"Continuar Editando\" alt=\"Continuar Editando\" border=\"0\" /></a>"; 
    782         } 
    783         else 
    784         { 
    785                 currObj.actionSpan.innerHTML = "<a class=\"resume_editing\">Continuar Editando</a>"; 
    786         } 
    787         if(currObj.config['useIcons']) 
    788         { 
    789                 currObj.statusSpan.innerHTML = "<img src=\"images/working.gif\" width=\"16\" height=\"16\" title=\"Carregando...\" alt=\"Carregando...\" border=\"0\" />"; 
    790         } 
    791         else 
    792         { 
    793                 currObj.statusSpan.innerHTML = "Carregando..."; 
    794         } 
    795         
    796          
    797         if(spellingSuggestionsDiv) 
    798         { 
    799                  
    800                 spellingSuggestionsDiv.parentNode.removeChild(spellingSuggestionsDiv); 
    801                 spellingSuggestionsDiv = null; 
    802         } 
    803          
    804         currObj.switchText(); 
    805 }; // end resumeEditing 
    806  
    807  
    808 /************************************************************* 
    809  * resetAction 
    810  * 
    811  * The resetAction function just resets the status message to 
    812  * the default action of "Check Spelling". 
    813  *************************************************************/ 
    814 function resetAction() 
    815 { 
    816         with(currObj); 
    817         if(currObj.config['useIcons']) 
    818         { 
    819818                currObj.actionSpan.innerHTML = "<a class=\"check_spelling\" onclick=\"setCurrentObject(" + currObj.config['varName'] + "); " + currObj.config['varName'] + ".spellCheck();\"><img src=\"images/spellcheck.png\" width=\"16\" height=\"16\" title=\"Verificar Ortografia\" alt=\"Verificar Ortografia\" border=\"0\" /></a>"; 
    820819        } 
     
    836835function resetSpellChecker() 
    837836{ 
     837    
    838838        with(currObj); 
    839839        currObj.resetAction(); 
     
    870870function findPosXById(object) 
    871871{ 
    872         var curleft = 0; 
     872         
     873        var curleft = 0; 
    873874        var obj = document.getElementById(object); 
    874875        if(obj.offsetParent) 
     
    900901function findPosYById(object) 
    901902{ 
     903     
    902904        var curtop = 0;var curtop = 0; 
    903905        var obj = document.getElementById(object); 
     
    928930function trim(s) 
    929931{ 
     932         
    930933        while(s.substring(0,1) == ' ') 
    931934        { 
  • sandbox/expressoMail1_2/corretor_ortografico/spell_checker/spell_checker.php

    r2405 r2430  
    126126                        $retVal .= "<div class=\"addtoDictionary\" onclick=\"addWord('" . addslashes_custom($id) . "'); return false;\">Add To Dictionary</div>"; 
    127127                } 
     128 
     129                //Ignore the suggestion - Added by Nathalie 
     130                $retVal .= "<div class=\"ignore\" onclick=\"replaceWord('" .  addslashes_custom($id)  . "', '" .   addslashes($word)   . "'); return false;\"> Ignorar </div>"; 
     131 
     132 
    128133        } 
    129134        else 
    130135        { 
    131                 $retVal .= "No Suggestions"; 
     136                $retVal .= "Sem sugestão"; 
    132137        } 
    133138         
Note: See TracChangeset for help on using the changeset viewer.