Ignore:
Timestamp:
06/18/08 11:28:42 (16 years ago)
Author:
niltonneto
Message:

Versionamento 1.222
Ver changelog de alterações no Trac.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/rich_text_editor.js

    r279 r320  
    88function cRichTextEditor(){ 
    99        this.emwindow   = new Array; 
    10         this.editor; 
    11         this.table; 
    12         this.id; 
     10        this.editor = "body_1"; 
     11        this.table = ""; 
     12        this.id = "1"; 
    1313        this.buildEditor(); 
    1414        this.saveFlag = 0; 
     
    1616 
    1717cRichTextEditor.prototype.loadEditor = function(ID) { 
    18         this.id = ID; 
     18        var _this = this; 
     19        _this.id = ID; 
    1920        parentDiv = document.getElementById("body_position_"+this.id); 
    2021        this.editor = "body_"+this.id; 
     22 
     23        if(this.table.parentNode) 
     24                this.table.parentNode.removeChild(this.table); 
    2125         
    22         if(this.table.parentNode) 
    23                 this.table.parentNode.removeChild(this.table);   
    24  
    25         if(parentDiv.firstChild){ 
    26                 parentDiv.insertBefore(this.table,parentDiv.firstChild); 
     26        if( parentDiv.firstChild ) 
     27        { 
     28                if (!parentDiv.firstChild.hasChildNodes())  
     29                        parentDiv.insertBefore(this.table,parentDiv.firstChild); 
    2730        } 
    2831        else 
    2932                parentDiv.appendChild(this.table); 
    3033 
    31         if(!Element(this.editor)){ 
     34        if(!Element(this.editor)) 
     35        { 
     36                this.createElementEditor(this.editor); 
     37        } 
     38        else 
     39        { 
     40                Element("viewsource_rt_checkbox").checked=false; 
     41        } 
     42 
     43        document.getElementById('fontname').selectedIndex = 1; 
     44        document.getElementById('fontsize').selectedIndex = 1; 
     45} 
     46 
     47cRichTextEditor.prototype.createElementEditor = function(pObj) 
     48{ 
    3249                iframe = document.createElement("IFRAME"); 
    33                 iframe.id = this.editor; 
    34                 iframe.name = this.editor; 
     50                iframe.id = pObj; 
     51                iframe.name = pObj; 
    3552                iframe.width = "99%"; 
    3653                iframe.height = 300; 
     
    4663                parentDiv.appendChild(checkbox); 
    4764                parentDiv.appendChild(text); 
    48         } 
    49         else{ 
    50                 Element("viewsource_rt_checkbox").checked=false; 
    51         } 
    52  
    53         document.getElementById('fontname').selectedIndex = 1; 
    54         document.getElementById('fontsize').selectedIndex = 1; 
    5565} 
    5666 
     
    231241                        mainField.document.execCommand(command, false, option); 
    232242                //mainField.focus(); 
    233     } catch (e) { alert(e.description); } 
     243    } catch (e) {/* alert(e);*/ } 
    234244} 
    235245 
     
    258268cRichTextEditor.prototype.addInputFile = function() 
    259269{ 
     270        //Begin: Verify if the image extension is allowed. 
     271        var imgExtensions = new Array("jpeg", "jpg", "gif", "png", "bmp", "xbm", "tiff", "pcx"); 
     272        var inputFile = document.getElementById('inputFile_img');        
     273        if(!inputFile.value) return false; 
     274        var fileExtension = inputFile.value.split("."); 
     275        fileExtension = fileExtension[(fileExtension.length-1)]; 
     276        var deniedExtension = true; 
     277        for(var i=0; i<imgExtensions.length; i++) { 
     278                if(imgExtensions[i].toUpperCase() == fileExtension.toUpperCase()) { 
     279                        deniedExtension = false; 
     280                        break; 
     281                } 
     282        } 
     283        if(deniedExtension) { 
     284                alert(get_lang('File extension forbidden or invalid file') + '.'); 
     285                return false; 
     286        } 
     287        // End: Verify image extension. 
    260288        var id = this.editor.substr(5); // border_id 
    261289        divFiles = document.getElementById("divFiles_"+id); 
    262290        var countDivFiles = divFiles.childNodes.length + 1; 
    263291 
    264         var inputFile = document.getElementById('inputFile_img'); 
    265292        var divFiles = document.getElementById('divFiles_'+id); 
    266293        inputFile.id = 'inputFile_'+id +"_"+countDivFiles; 
     
    273300        form_upload.parentNode.removeChild(form_upload); 
    274301        win.close(); 
    275          
    276         if (! validateFileExtension(inputFile.value, inputFile.id , id)) 
    277         return false; 
    278302 
    279303        RichTextEditor.saveFlag = 0; // See if save function finished 
     304        var save_link = document.getElementById("save_message_options"); 
     305        //save_link.onclick = function () {}; 
    280306        save_msg(id); 
    281307        setTimeout("RichTextEditor.insertImgHtml("+id+")",1000); 
     
    286312                setTimeout("RichTextEditor.insertImgHtml("+id+")",500); 
    287313        else 
     314                if (RichTextEditor.saveFlag == 1) 
    288315                        this.editorCommand('Image', './inc/show_embedded_attach.php?msg_folder=INBOX/'+draftsfolder+'&msg_num='+newMessageTab.imapUid[id]+'&msg_part='+(newMessageTab.countFile[id]+1)); 
    289316                        // this.editorCommand('Image', '.inc/gotodownload.php?msg_folder="+msg_folder+"&msg_number="+msg_number+"&idx_file="+idx_file+"&msg_part="+msg_part+params')); 
Note: See TracChangeset for help on using the changeset viewer.