Changeset 320 for trunk/expressoMail1_2/js/rich_text_editor.js
- Timestamp:
- 06/18/08 11:28:42 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/rich_text_editor.js
r279 r320 8 8 function cRichTextEditor(){ 9 9 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"; 13 13 this.buildEditor(); 14 14 this.saveFlag = 0; … … 16 16 17 17 cRichTextEditor.prototype.loadEditor = function(ID) { 18 this.id = ID; 18 var _this = this; 19 _this.id = ID; 19 20 parentDiv = document.getElementById("body_position_"+this.id); 20 21 this.editor = "body_"+this.id; 22 23 if(this.table.parentNode) 24 this.table.parentNode.removeChild(this.table); 21 25 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); 27 30 } 28 31 else 29 32 parentDiv.appendChild(this.table); 30 33 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 47 cRichTextEditor.prototype.createElementEditor = function(pObj) 48 { 32 49 iframe = document.createElement("IFRAME"); 33 iframe.id = this.editor;34 iframe.name = this.editor;50 iframe.id = pObj; 51 iframe.name = pObj; 35 52 iframe.width = "99%"; 36 53 iframe.height = 300; … … 46 63 parentDiv.appendChild(checkbox); 47 64 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;55 65 } 56 66 … … 231 241 mainField.document.execCommand(command, false, option); 232 242 //mainField.focus(); 233 } catch (e) { alert(e.description);}243 } catch (e) {/* alert(e);*/ } 234 244 } 235 245 … … 258 268 cRichTextEditor.prototype.addInputFile = function() 259 269 { 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. 260 288 var id = this.editor.substr(5); // border_id 261 289 divFiles = document.getElementById("divFiles_"+id); 262 290 var countDivFiles = divFiles.childNodes.length + 1; 263 291 264 var inputFile = document.getElementById('inputFile_img');265 292 var divFiles = document.getElementById('divFiles_'+id); 266 293 inputFile.id = 'inputFile_'+id +"_"+countDivFiles; … … 273 300 form_upload.parentNode.removeChild(form_upload); 274 301 win.close(); 275 276 if (! validateFileExtension(inputFile.value, inputFile.id , id))277 return false;278 302 279 303 RichTextEditor.saveFlag = 0; // See if save function finished 304 var save_link = document.getElementById("save_message_options"); 305 //save_link.onclick = function () {}; 280 306 save_msg(id); 281 307 setTimeout("RichTextEditor.insertImgHtml("+id+")",1000); … … 286 312 setTimeout("RichTextEditor.insertImgHtml("+id+")",500); 287 313 else 314 if (RichTextEditor.saveFlag == 1) 288 315 this.editorCommand('Image', './inc/show_embedded_attach.php?msg_folder=INBOX/'+draftsfolder+'&msg_num='+newMessageTab.imapUid[id]+'&msg_part='+(newMessageTab.countFile[id]+1)); 289 316 // 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.