Ignore:
Timestamp:
03/02/12 03:48:47 (12 years ago)
Author:
cristiano
Message:

Ticket #2497 - Nova estrategia para o salvamento automatico de rascunhos

File:
1 edited

Legend:

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

    r5496 r5604  
    145145} 
    146146 
    147 cRichTextEditor.prototype.createImage = function(){ 
    148                  
    149         var form = document.getElementById("attachment_window"); 
    150          
    151         if (form == null){ 
    152                 form = document.createElement("DIV"); 
    153                 form.id  = "attachment_window"; 
    154                 form.style.visibility = "hidden"; 
    155                 form.style.position = "absolute"; 
    156                 form.style.background = "#eeeeee"; 
    157                 form.style.left = "0px"; 
    158                 form.style.top  = "0px";  
    159                 form.style.width = "0px"; 
    160                 form.style.height = "0px"; 
    161                 document.body.appendChild(form); 
    162         } 
    163                 var form_upload = Element('form_upload'); 
    164                 if (form_upload == null) 
    165                         form_upload = document.createElement("DIV"); 
    166                 form_upload.id = "form_upload"; 
    167                 form_upload.style.position = "absolute"; 
    168                 form_upload.style.top = "5px"; 
    169                 form_upload.style.left = "5px"; 
    170                 form_upload.name = get_lang("Upload File"); 
    171                 form_upload.style.width = "450px"; 
    172                 form_upload.style.height = "75px"; 
    173                 form_upload.innerHTML = get_lang('Select the desired image file')+':<br>'+ 
    174                 '<input name="image_at" maxlength="255" size="40" id="inputFile_img" type="file"><br>' + 
    175                 '<input title="' + get_lang('Include') + '"  value="' + get_lang('Include') + '"' +  
    176                 'type="button" onclick="RichTextEditor.addInputFile();">&nbsp;' + 
    177                 '<input title="' + get_lang('Close') + '"  value="' + get_lang('Close') + '"' + 
    178                 ' type="button" onclick="win.close()">'; 
    179                 form.appendChild(form_upload); 
    180                  
    181                 this.showWindow(form); 
    182 } 
    183 cRichTextEditor.prototype.showWindow = function (div){ 
    184  
    185                 if(! div) { 
    186                         return; 
    187                 } 
    188                  
    189                 if(! this.emwindow[div.id]) { 
    190                         div.style.width  =  div.firstChild.style.width; 
    191                         div.style.height = div.firstChild.style.height; 
    192                         div.style.zIndex = "10000";                      
    193                         var title = div.firstChild.name; 
    194                         var wHeight = div.offsetHeight + "px"; 
    195                         var wWidth =  div.offsetWidth   + "px"; 
    196                         div.style.width = div.offsetWidth - 5; 
    197  
    198                         win = new dJSWin({ 
    199                                 id: 'win_'+div.id, 
    200                                 content_id: div.id, 
    201                                 width: wWidth, 
    202                                 height: wHeight, 
    203                                 title_color: '#3978d6', 
    204                                 bg_color: '#eee', 
    205                                 title: title, 
    206                                 title_text_color: 'white', 
    207                                 button_x_img: '../phpgwapi/images/winclose.gif', 
    208                                 border: true}); 
    209                          
    210                         this.emwindow[div.id] = win; 
    211                         win.draw(); 
    212                 } 
    213                 else 
    214                         win = this.emwindow[div.id]; 
    215                 win.open();      
    216 } 
    217 cRichTextEditor.prototype.addInputFile = function() 
    218 { 
    219         //Begin: Verify if the image extension is allowed. 
    220         var imgExtensions = new Array("jpeg", "jpg", "gif", "png", "bmp", "xbm", "tiff", "pcx"); 
    221         var inputFile = document.getElementById('inputFile_img');        
    222         if(!inputFile.value) return false; 
    223         var fileExtension = inputFile.value.split("."); 
    224         fileExtension = fileExtension[(fileExtension.length-1)]; 
    225         var deniedExtension = true; 
    226         for(var i=0; i<imgExtensions.length; i++) { 
    227                 if(imgExtensions[i].toUpperCase() == fileExtension.toUpperCase()) { 
    228                         deniedExtension = false; 
    229                         break; 
    230                 } 
    231         } 
    232         if(deniedExtension) { 
    233                 alert(get_lang('File extension forbidden or invalid file') + '.'); 
    234                 return false; 
    235         } 
    236         // End: Verify image extension. 
    237         var id =  currentTab; 
    238         divFiles = document.getElementById("divFiles_"+id); 
    239         var countDivFiles = divFiles.childNodes.length + 1; 
    240  
    241         var divFiles = document.getElementById('divFiles_'+id); 
    242         inputFile.id = 'inputFile_'+id +"_"+countDivFiles; 
    243         inputFile.name = 'file_'+countDivFiles; 
    244         divFile = document.createElement('DIV'); 
    245         divFile.appendChild(inputFile); 
    246         divFiles.appendChild(divFile); 
    247  
    248         var form_upload = document.getElementById('form_upload'); 
    249         form_upload.parentNode.removeChild(form_upload); 
    250         win.close(); 
    251  
    252         RichTextEditor.saveFlag = 0; // See if save function finished 
    253         var save_link = document.getElementById("save_message_options_"+id); 
    254         save_link.onclick = function () {}; 
    255         this.newImageId = new Date().getTime(); 
    256         CKEDITOR.instances['body_'+id].insertHtml('<img id="'+this.newImageId+'" src=""/>'); 
    257         save_msg(id,true); 
    258 } 
     147 
    259148 
    260149cRichTextEditor.prototype.execPosInstance = function(inst) { 
Note: See TracChangeset for help on using the changeset viewer.