[Svn] r2152 - in trunk/roundcubemail/skins/default: . images/icons templates

trac at roundcube.net trac at roundcube.net
Mon Dec 15 09:22:21 CET 2008


Author: alec
Date: 2008-12-15 02:22:20 -0600 (Mon, 15 Dec 2008)
New Revision: 2152

Added:
   trunk/roundcubemail/skins/default/images/icons/minus.gif
Modified:
   trunk/roundcubemail/skins/default/functions.js
   trunk/roundcubemail/skins/default/templates/compose.html
Log:
- allow cc, bcc, replyto fields hidding


Modified: trunk/roundcubemail/skins/default/functions.js
===================================================================
--- trunk/roundcubemail/skins/default/functions.js	2008-12-14 21:37:19 UTC (rev 2151)
+++ trunk/roundcubemail/skins/default/functions.js	2008-12-15 08:22:20 UTC (rev 2152)
@@ -32,26 +32,21 @@
  * Mail Composing
  */
 
-function rcmail_show_header_form(id, link)
+function rcmail_show_header_form(id)
 {
-  var row, parent, ns, ps, links;
+  var link, row, parent, ns, ps;
+  
+  link = document.getElementById(id + '-link');
+  parent = link.parentNode;
 
-  if (link)
-  {
-    var 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 @@
   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_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) {

Added: trunk/roundcubemail/skins/default/images/icons/minus.gif
===================================================================
(Binary files differ)


Property changes on: trunk/roundcubemail/skins/default/images/icons/minus.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/roundcubemail/skins/default/templates/compose.html
===================================================================
--- trunk/roundcubemail/skins/default/templates/compose.html	2008-12-14 21:37:19 UTC (rev 2151)
+++ trunk/roundcubemail/skins/default/templates/compose.html	2008-12-15 08:22:20 UTC (rev 2152)
@@ -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>

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list