diff options
-rw-r--r-- | skins/default/functions.js | 68 | ||||
-rw-r--r-- | skins/default/images/icons/minus.gif | bin | 0 -> 82 bytes | |||
-rw-r--r-- | skins/default/templates/compose.html | 29 |
3 files changed, 64 insertions, 33 deletions
diff --git a/skins/default/functions.js b/skins/default/functions.js index e232ac771..53519d181 100644 --- a/skins/default/functions.js +++ b/skins/default/functions.js @@ -32,26 +32,21 @@ function rcube_show_advanced(visible) * Mail Composing */ -function rcmail_show_header_form(id, link) +function rcmail_show_header_form(id) { - var row, parent, ns, ps, links; - - if (link) - { - var parent = link.parentNode; + var link, row, parent, ns, ps; + + link = document.getElementById(id + '-link'); + parent = link.parentNode; - if ((ns = rcmail_next_sibling(link))) - parent.removeChild(ns); - else if ((ps = rcmail_prev_sibling(link))) - parent.removeChild(ps); + if ((ns = rcmail_next_sibling(link))) + ns.style.display = 'none'; + else if ((ps = rcmail_prev_sibling(link))) + ps.style.display = 'none'; - parent.removeChild(link); + link.style.display = 'none'; - if(!parent.getElementsByTagName('A').length) - document.getElementById('compose-links').style.display = 'none'; - } - - if (row = document.getElementById(id)) + if (row = document.getElementById('compose-' + id)) { var div = document.getElementById('compose-div'); var headers_div = document.getElementById('compose-headers-div'); @@ -62,6 +57,38 @@ function rcmail_show_header_form(id, link) return false; } +function rcmail_hide_header_form(id) +{ + var row, parent, ns, ps, link, links; + + link = document.getElementById(id + '-link'); + link.style.display = ''; + + parent = link.parentNode; + links = parent.getElementsByTagName('A'); + + for (var i=0; i<links.length; i++) + if (links[i].style.display != 'none') + for (var j=i+1; j<links.length; j++) + if (links[j].style.display != 'none') + if ((ns = rcmail_next_sibling(links[i]))) { + ns.style.display = ''; + break; + } + + document.getElementById('_' + id).value = ''; + + if (row = document.getElementById('compose-' + id)) + { + var div = document.getElementById('compose-div'); + var headers_div = document.getElementById('compose-headers-div'); + row.style.display = 'none'; + div.style.top = (parseInt(headers_div.offsetHeight)) + 'px'; + } + + return false; +} + function rcmail_next_sibling(elm) { var ns = elm.nextSibling; @@ -80,12 +107,13 @@ function rcmail_prev_sibling(elm) function rcmail_init_compose_form() { - var cc_field = document.getElementById('rcmcomposecc'); + var cc_field = document.getElementById('_cc'); if (cc_field && cc_field.value!='') - rcmail_show_header_form('compose-cc', document.getElementById('addcclink')); - var bcc_field = document.getElementById('rcmcomposebcc'); + rcmail_show_header_form('cc'); + + var bcc_field = document.getElementById('_bcc'); if (bcc_field && bcc_field.value!='') - rcmail_show_header_form('compose-bcc', document.getElementById('addbcclink')); + rcmail_show_header_form('bcc'); // prevent from form data loss when pressing ESC key in IE if (bw.ie) { diff --git a/skins/default/images/icons/minus.gif b/skins/default/images/icons/minus.gif Binary files differnew file mode 100644 index 000000000..4ec02c87a --- /dev/null +++ b/skins/default/images/icons/minus.gif diff --git a/skins/default/templates/compose.html b/skins/default/templates/compose.html index aa45ef027..712db6629 100644 --- a/skins/default/templates/compose.html +++ b/skins/default/templates/compose.html @@ -37,28 +37,31 @@ <table border="0" cellspacing="0" cellpadding="1" id="compose-headers" summary=""> <tbody> <tr> - <td class="title"><label for="rcmcomposefrom"><roundcube:label name="from" /></label></td> - <td><roundcube:object name="composeHeaders" part="from" form="form" id="rcmcomposefrom" tabindex="1" /></td> + <td class="title"><label for="_from"><roundcube:label name="from" /></label></td> + <td><roundcube:object name="composeHeaders" part="from" form="form" id="_from" tabindex="1" /></td> </tr><tr> - <td class="title top"><label for="rcmcomposeto"><roundcube:label name="to" /></label></td> - <td><roundcube:object name="composeHeaders" part="to" form="form" id="rcmcomposeto" cols="70" rows="2" tabindex="2" /></td> + <td class="title top"><label for="_to"><roundcube:label name="to" /></label></td> + <td><roundcube:object name="composeHeaders" part="to" form="form" id="_to" cols="70" rows="2" tabindex="2" /></td> </tr><tr id="compose-cc"> - <td class="title top"><label for="rcmcomposecc"><roundcube:label name="cc" /></label></td> - <td><roundcube:object name="composeHeaders" part="cc" form="form" id="rcmcomposecc" cols="70" rows="2" tabindex="3" /></td> + <td class="title top"><a href="#cc" onclick="return rcmail_hide_header_form('cc');" /><img src="/images/icons/minus.gif" alt="" title="<roundcube:label name="delete" />" /></a> + <label for="_cc"><roundcube:label name="cc" /></label></td> + <td><roundcube:object name="composeHeaders" part="cc" form="form" id="_cc" cols="70" rows="2" tabindex="3" /></td> </tr><tr id="compose-bcc"> - <td class="title top"><label for="rcmcomposebcc"><roundcube:label name="bcc" /></label></td> - <td><roundcube:object name="composeHeaders" part="bcc" form="form" id="rcmcomposebcc" cols="70" rows="2" tabindex="4" /></td> + <td class="title top"><a href="#bcc" onclick="return rcmail_hide_header_form('bcc');" /><img src="/images/icons/minus.gif" alt="" title="<roundcube:label name="delete" />" /></a> + <label for="_bcc"><roundcube:label name="bcc" /></label></td> + <td><roundcube:object name="composeHeaders" part="bcc" form="form" id="_bcc" cols="70" rows="2" tabindex="4" /></td> </tr><tr id="compose-replyto"> - <td class="title top"><label for="rcmcomposereplyto"><roundcube:label name="replyto" /></label></td> - <td><roundcube:object name="composeHeaders" part="replyto" form="form" id="rcmcomposereplyto" size="70" tabindex="5" /></td> + <td class="title top"><a href="#replyto" onclick="return rcmail_hide_header_form('replyto');" /><img src="/images/icons/minus.gif" alt="" title="<roundcube:label name="delete" />" /></a> + <label for="_replyto"><roundcube:label name="replyto" /></label></td> + <td><roundcube:object name="composeHeaders" part="replyto" form="form" id="_replyto" size="70" tabindex="5" /></td> </tr><tr id="compose-links"> <td></td> <td class="formlinks"> - <a href="#cc" onclick="return rcmail_show_header_form('compose-cc', this);" id="addcclink"><roundcube:label name="addcc" /></a> + <a href="#cc" onclick="return rcmail_show_header_form('cc')" id="cc-link"><roundcube:label name="addcc" /></a> <span class="separator">|</span> - <a href="#bcc" onclick="return rcmail_show_header_form('compose-bcc', this);" id="addbcclink"><roundcube:label name="addbcc" /></a> + <a href="#bcc" onclick="return rcmail_show_header_form('bcc')" id="bcc-link"><roundcube:label name="addbcc" /></a> <span class="separator">|</span> - <a href="#reply-to" onclick="return rcmail_show_header_form('compose-replyto', this);" id="addreplytolink"><roundcube:label name="addreplyto" /></a> + <a href="#reply-to" onclick="return rcmail_show_header_form('replyto')" id="replyto-link"><roundcube:label name="addreplyto" /></a> </td> </tr><tr> <td class="title"><label for="compose-subject"><roundcube:label name="subject" /></label></td> |