Changeset 3793 in subversion
- Timestamp:
- Jun 30, 2010 4:40:39 AM (3 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 4 edited
-
program/js/app.js (modified) (5 diffs)
-
program/js/editor.js (modified) (3 diffs)
-
skins/default/functions.js (modified) (6 diffs)
-
skins/default/templates/compose.html (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/js/app.js
r3792 r3793 226 226 } 227 227 else if (this.env.action == 'compose') { 228 this.enable_command('send-attachment', 'remove-attachment', 'send', true);228 this.enable_command('send-attachment', 'remove-attachment', 'send', 'toggle-editor', true); 229 229 230 230 if (this.env.spellcheck) { … … 322 322 else if (this.env.action=='edit-identity' || this.env.action=='add-identity') { 323 323 this.enable_command('add', this.env.identities_level < 2); 324 this.enable_command('save', 'delete', 'edit', true);324 this.enable_command('save', 'delete', 'edit', 'toggle-editor', true); 325 325 } 326 326 else if (this.env.action=='folders') … … 979 979 default: 980 980 var func = command.replace('-', '_'); 981 alert(func);982 981 if (this[func] && typeof this[func] == 'function') 983 982 this[func](props); … … 2809 2808 }; 2810 2809 2810 this.toggle_editor = function(props) 2811 { 2812 if (props.mode == 'html') { 2813 this.display_spellcheck_controls(false); 2814 this.plain2html($('#'+props.id).val(), props.id); 2815 tinyMCE.execCommand('mceAddControl', false, props.id); 2816 } 2817 else { 2818 var thisMCE = tinyMCE.get(props.id), 2819 existingHtml = thisMCE.getContent(); 2820 2821 if (existingHtml) { 2822 if (!confirm(this.get_label('editorwarning'))) { 2823 return false; 2824 } 2825 this.html2plain(existingHtml, props.id); 2826 } 2827 tinyMCE.execCommand('mceRemoveControl', false, props.id); 2828 this.display_spellcheck_controls(true); 2829 } 2830 2831 return true; 2832 }; 2833 2811 2834 this.stop_spellchecking = function() 2812 2835 { … … 5117 5140 rcube_webmail.prototype.removeEventListener = rcube_event_engine.prototype.removeEventListener; 5118 5141 rcube_webmail.prototype.triggerEvent = rcube_event_engine.prototype.triggerEvent; 5142 -
trunk/roundcubemail/program/js/editor.js
r3789 r3793 96 96 function rcmail_toggle_editor(select, textAreaId, flagElement) 97 97 { 98 var composeElement = document.getElementById(textAreaId);99 98 var flag, ishtml; 100 99 … … 104 103 ishtml = select.value == 'html'; 105 104 105 var res = rcmail.command('toggle-editor', {id:textAreaId, mode:ishtml?'html':'plain'}); 106 106 107 if (ishtml) { 107 rcmail.display_spellcheck_controls(false);108 109 rcmail.plain2html(composeElement.value, textAreaId);110 tinyMCE.execCommand('mceAddControl', false, textAreaId);111 108 // #1486593 112 109 setTimeout("rcmail_editor_tabindex();", 500); … … 115 112 } 116 113 else { 117 var thisMCE = tinyMCE.get(textAreaId); 118 var existingHtml = thisMCE.getContent(); 119 120 if (existingHtml) { 121 if (!confirm(rcmail.get_label('editorwarning'))) { 122 if (select.tagName == 'SELECT') 123 select.value = 'html'; 124 return false; 125 } 126 127 rcmail.html2plain(existingHtml, textAreaId); 128 } 129 130 tinyMCE.execCommand('mceRemoveControl', false, textAreaId); 131 rcmail.display_spellcheck_controls(true); 114 if (!res && select.tagName == 'SELECT') 115 select.value = 'html'; 132 116 if (flagElement && (flag = rcube_find_object(flagElement))) 133 117 flag.value = '0'; -
trunk/roundcubemail/skins/default/functions.js
r3789 r3793 23 23 24 24 /** 25 * Mail Composing 26 */ 27 28 function rcmail_show_header_form(id) 29 { 30 var row, s, 31 link = document.getElementById(id + '-link'); 32 33 if ((s = rcmail_next_sibling(link))) 34 s.style.display = 'none'; 35 else if ((s = rcmail_prev_sibling(link))) 36 s.style.display = 'none'; 37 38 link.style.display = 'none'; 39 40 if ((row = document.getElementById('compose-' + id))) { 41 var div = document.getElementById('compose-div'), 42 headers_div = document.getElementById('compose-headers-div'); 43 row.style.display = (document.all && !window.opera) ? 'block' : 'table-row'; 44 div.style.top = (parseInt(headers_div.offsetHeight, 10) + 1) + 'px'; 45 rcmail_resize_compose_body(); 46 } 47 48 return false; 49 } 50 51 function rcmail_hide_header_form(id) 52 { 53 var row, ns, 54 link = document.getElementById(id + '-link'), 55 parent = link.parentNode, 56 links = parent.getElementsByTagName('a'); 57 58 link.style.display = ''; 59 60 for (var i=0; i<links.length; i++) 61 if (links[i].style.display != 'none') 62 for (var j=i+1; j<links.length; j++) 63 if (links[j].style.display != 'none') 64 if ((ns = rcmail_next_sibling(links[i]))) { 65 ns.style.display = ''; 66 break; 67 } 68 69 document.getElementById('_' + id).value = ''; 70 71 if ((row = document.getElementById('compose-' + id))) { 72 var div = document.getElementById('compose-div'), 73 headers_div = document.getElementById('compose-headers-div'); 74 row.style.display = 'none'; 75 div.style.top = (parseInt(headers_div.offsetHeight, 10) + 1) + 'px'; 76 rcmail_resize_compose_body(); 77 } 78 79 return false; 80 } 81 82 function rcmail_next_sibling(elm) 83 { 84 var ns = elm.nextSibling; 85 while (ns && ns.nodeType == 3) 86 ns = ns.nextSibling; 87 return ns; 88 } 89 90 function rcmail_prev_sibling(elm) 91 { 92 var ps = elm.previousSibling; 93 while (ps && ps.nodeType == 3) 94 ps = ps.previousSibling; 95 return ps; 96 } 97 98 function rcmail_init_compose_form() 99 { 100 var cc_field = document.getElementById('_cc'), 101 bcc_field = document.getElementById('_bcc'), 102 div = document.getElementById('compose-div'), 103 headers_div = document.getElementById('compose-headers-div'); 104 105 if (cc_field && cc_field.value != '') 106 rcmail_show_header_form('cc'); 107 108 if (bcc_field && bcc_field.value != '') 109 rcmail_show_header_form('bcc'); 110 111 // prevent from form data loss when pressing ESC key in IE 112 if (bw.ie) { 113 var form = rcube_find_object('form'); 114 form.onkeydown = function (e) { 115 if (rcube_event.get_keycode(e) == 27) 116 rcube_event.cancel(e); 117 }; 118 } 119 120 $(window).resize(function() { 121 rcmail_resize_compose_body(); 122 }); 123 124 $('#compose-container').resize(function() { 125 rcmail_resize_compose_body(); 126 }); 127 128 div.style.top = (parseInt(headers_div.offsetHeight, 10) + 1) + 'px'; 129 $(window).resize(); 130 } 131 132 function rcmail_resize_compose_body(elem) 133 { 134 var ed, div = $('#compose-div'), w = div.width(), h = div.height(); 135 w = w-4; 136 h = h-25; 137 138 $('#compose-body').width(w-(bw.ie || bw.opera || bw.safari ? 2 : 0)+'px').height(h+'px'); 139 140 if (window.tinyMCE && tinyMCE.get('compose-body')) { 141 $('#compose-body_tbl').width((w+4)+'px').height(''); 142 $('#compose-body_ifr').width((w+2)+'px').height((h-54)+'px'); 143 } 144 } 145 146 /** 147 * Mailbox view 25 * Mail UI 148 26 */ 149 27 … … 161 39 uploadform:'attachment-form' 162 40 }; 163 41 164 42 var obj; 165 43 for (var k in this.popupmenus) { … … 182 60 obj.css({ left:pos.left, top:(pos.top + (above ? -obj.height() : ref.offsetHeight)) }); 183 61 } 184 62 185 63 obj[show?'show':'hide'](); 186 64 }, … … 239 117 this.searchmenu[show?'show':'hide'](); 240 118 }, 241 119 242 120 set_searchmod: function(elem) 243 121 { 244 122 if (!rcmail.env.search_mods) 245 123 rcmail.env.search_mods = {}; 246 124 247 125 if (!rcmail.env.search_mods[rcmail.env.mailbox]) 248 126 rcmail.env.search_mods[rcmail.env.mailbox] = rcube_clone_object(rcmail.env.search_mods['*']); 249 127 250 128 if (!elem.checked) 251 129 delete(rcmail.env.search_mods[rcmail.env.mailbox][elem.value]); … … 418 296 rcmail.http_post('save-pref', '_name=preview_pane&_value=0'); 419 297 } 298 }, 299 300 /* Message composing */ 301 init_compose_form: function() 302 { 303 var cc_field = document.getElementById('_cc'), 304 bcc_field = document.getElementById('_bcc'), 305 div = document.getElementById('compose-div'), 306 headers_div = document.getElementById('compose-headers-div'); 307 308 if (cc_field && cc_field.value != '') 309 rcmail_show_header_form('cc'); 310 311 if (bcc_field && bcc_field.value != '') 312 rcmail_show_header_form('bcc'); 313 314 // prevent from form data loss when pressing ESC key in IE 315 if (bw.ie) { 316 var form = rcube_find_object('form'); 317 form.onkeydown = function (e) { 318 if (rcube_event.get_keycode(e) == 27) 319 rcube_event.cancel(e); 320 }; 321 } 322 323 $(window).resize(function() { 324 rcmail_ui.resize_compose_body(); 325 }); 326 327 $('#compose-container').resize(function() { 328 rcmail_ui.resize_compose_body(); 329 }); 330 331 div.style.top = (parseInt(headers_div.offsetHeight, 10) + 1) + 'px'; 332 $(window).resize(); 333 }, 334 335 resize_compose_body: function() 336 { 337 var ed, div = $('#compose-div'), w = div.width(), h = div.height(); 338 w = w-4; 339 h = h-25; 340 341 $('#compose-body').width(w-(bw.ie || bw.opera || bw.safari ? 2 : 0)+'px').height(h+'px'); 342 343 if (window.tinyMCE && tinyMCE.get('compose-body')) { 344 $('#compose-body_tbl').width((w+4)+'px').height(''); 345 $('#compose-body_ifr').width((w+2)+'px').height((h-54)+'px'); 346 } 347 }, 348 349 show_header_form: function(id) 350 { 351 var row, s, 352 link = document.getElementById(id + '-link'); 353 354 if ((s = this.next_sibling(link))) 355 s.style.display = 'none'; 356 else if ((s = this.prev_sibling(link))) 357 s.style.display = 'none'; 358 359 link.style.display = 'none'; 360 361 if ((row = document.getElementById('compose-' + id))) { 362 var div = document.getElementById('compose-div'), 363 headers_div = document.getElementById('compose-headers-div'); 364 row.style.display = (document.all && !window.opera) ? 'block' : 'table-row'; 365 div.style.top = (parseInt(headers_div.offsetHeight, 10) + 1) + 'px'; 366 this.resize_compose_body(); 367 } 368 369 return false; 370 }, 371 372 hide_header_form: function(id) 373 { 374 var row, ns, 375 link = document.getElementById(id + '-link'), 376 parent = link.parentNode, 377 links = parent.getElementsByTagName('a'); 378 379 link.style.display = ''; 380 381 for (var i=0; i<links.length; i++) 382 if (links[i].style.display != 'none') 383 for (var j=i+1; j<links.length; j++) 384 if (links[j].style.display != 'none') 385 if ((ns = this.next_sibling(links[i]))) { 386 ns.style.display = ''; 387 break; 388 } 389 390 document.getElementById('_' + id).value = ''; 391 392 if ((row = document.getElementById('compose-' + id))) { 393 var div = document.getElementById('compose-div'), 394 headers_div = document.getElementById('compose-headers-div'); 395 row.style.display = 'none'; 396 div.style.top = (parseInt(headers_div.offsetHeight, 10) + 1) + 'px'; 397 this.resize_compose_body(); 398 } 399 400 return false; 401 }, 402 403 next_sibling: function(elm) 404 { 405 var ns = elm.nextSibling; 406 while (ns && ns.nodeType == 3) 407 ns = ns.nextSibling; 408 return ns; 409 }, 410 411 prev_sibling: function(elm) 412 { 413 var ps = elm.previousSibling; 414 while (ps && ps.nodeType == 3) 415 ps = ps.previousSibling; 416 return ps; 420 417 } 421 418 422 419 }; 420 423 421 424 422 var rcmail_ui; … … 437 435 rcmail.addEventListener('menu-save', 'save_listmenu', rcmail_ui); 438 436 rcmail.addEventListener('aftersend-attachment', 'show_uploadform', rcmail_ui); 437 rcmail.addEventListener('aftertoggle-editor', 'resize_compose_body', rcmail_ui); 439 438 rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); 439 440 if (rcmail.env.action == 'compose') 441 rcmail_ui.init_compose_form(); 440 442 } 441 443 } -
trunk/roundcubemail/skins/default/templates/compose.html
r3789 r3793 14 14 </style> 15 15 </head> 16 <body onload="rc mail_init_compose_form(); rcube_init_mail_ui()">16 <body onload="rcube_init_mail_ui()"> 17 17 18 18 <roundcube:include file="/includes/taskbar.html" /> … … 56 56 </td> 57 57 <td id="formlinks"> 58 <a href="#cc" onclick="return rcmail_ show_header_form('cc')" id="cc-link"><roundcube:label name="addcc" /></a>58 <a href="#cc" onclick="return rcmail_ui.show_header_form('cc')" id="cc-link"><roundcube:label name="addcc" /></a> 59 59 <span class="separator">|</span> 60 <a href="#bcc" onclick="return rcmail_ show_header_form('bcc')" id="bcc-link"><roundcube:label name="addbcc" /></a>60 <a href="#bcc" onclick="return rcmail_ui.show_header_form('bcc')" id="bcc-link"><roundcube:label name="addbcc" /></a> 61 61 <span class="separator">|</span> 62 <a href="#reply-to" onclick="return rcmail_ show_header_form('replyto')" id="replyto-link"><roundcube:label name="addreplyto" /></a>62 <a href="#reply-to" onclick="return rcmail_ui.show_header_form('replyto')" id="replyto-link"><roundcube:label name="addreplyto" /></a> 63 63 </td> 64 64 </tr><tr> … … 69 69 </tr><tr id="compose-cc"> 70 70 <td class="title top"> 71 <a href="#cc" onclick="return rcmail_ hide_header_form('cc');"><img src="/images/icons/minus.gif" alt="" title="<roundcube:label name='delete' />" /></a>71 <a href="#cc" onclick="return rcmail_ui.hide_header_form('cc');"><img src="/images/icons/minus.gif" alt="" title="<roundcube:label name='delete' />" /></a> 72 72 <label for="_cc"><roundcube:label name="cc" /></label> 73 73 </td> … … 77 77 </tr><tr id="compose-bcc"> 78 78 <td class="title top"> 79 <a href="#bcc" onclick="return rcmail_ hide_header_form('bcc');"><img src="/images/icons/minus.gif" alt="" title="<roundcube:label name='delete' />" /></a>79 <a href="#bcc" onclick="return rcmail_ui.hide_header_form('bcc');"><img src="/images/icons/minus.gif" alt="" title="<roundcube:label name='delete' />" /></a> 80 80 <label for="_bcc"><roundcube:label name="bcc" /></label> 81 81 </td> … … 85 85 </tr><tr id="compose-replyto"> 86 86 <td class="title top"> 87 <a href="#replyto" onclick="return rcmail_ hide_header_form('replyto');"><img src="/images/icons/minus.gif" alt="" title="<roundcube:label name='delete' />" /></a>87 <a href="#replyto" onclick="return rcmail_ui.hide_header_form('replyto');"><img src="/images/icons/minus.gif" alt="" title="<roundcube:label name='delete' />" /></a> 88 88 <label for="_replyto"><roundcube:label name="replyto" /></label> 89 89 </td>
Note: See TracChangeset
for help on using the changeset viewer.
