More compfort for inline vieweable attachments
authorWilfried Goesgens <dothebart@citadel.org>
Fri, 13 May 2011 09:41:02 +0000 (11:41 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 20:32:56 +0000 (20:32 +0000)
  - make it look similar to if it was just a view link which is downloaded binary and the browser shows it
  - this 'view' link now toggles the visibility of the inline rendered attachment
  - this makes viewing mails with text attachments more compact.

webcit/static/t/view_message/inline_attach.html
webcit/static/wclib.js

index 3243bced2780a26190084453c20f7c9be455cc8a..85ceffcee724b86af9afc6158258f166776fb7a7 100644 (file)
@@ -1,8 +1,9 @@
 <div class="display_inline_attachment">
 <img src="display_mime_icon?type=<?MAIL:MIME:CONTENTTYPE("U")>" border="0" align="middle" alt="">
-<?MAIL:MIME:FILENAME("X")>  (<?MAIL:MIME:CONTENTTYPE>, <?MAIL:MIME:LENGTH> bytes) 
-<a href="mimepart_download/<?MAIL:MIME:MSGNUM>/<?MAIL:MIME:PARTNUM>/<?MAIL:MIME:FILENAME("U")>"><?_("Download")></a><br>
-<div class="display_inline_attachment_body">
+<?MAIL:MIME:FILENAME("X")>  (<?MAIL:MIME:CONTENTTYPE>, <?MAIL:MIME:LENGTH> bytes)
+[<a href="javascript:ToggleVisibility('ATTCH_ID_<?MAIL:MIME:FILENAME("X")>')"><?_("View")></a>|
+<a href="mimepart_download/<?MAIL:MIME:MSGNUM>/<?MAIL:MIME:PARTNUM>/<?MAIL:MIME:FILENAME("U")>"><?_("Download")></a>]<br>
+<div class="display_inline_attachment_body" id="ATTCH_ID_<?MAIL:MIME:FILENAME("X")>" style="display:none">
 <?MAIL:MIME:DATA>
 </div>
 </div>
index 13a7834926b00838d21debbf5f9d86226f76761f..cf409d363c7a352599cdd6935f847f66c971902c 100644 (file)
@@ -47,6 +47,19 @@ function strcmp ( str1, str2 ) {
     return ( ( str1 == str2 ) ? 0 : ( ( str1 > str2 ) ? 1 : -1 ) );
 }
 
+
+
+function ToggleVisibility ($Which)
+{
+       if (document.getElementById)
+       {
+               if (document.getElementById($Which).style.display  == "none")
+                       document.getElementById($Which).style.display  = "inline";
+               else
+                       document.getElementById($Which).style.display  = "none";
+       }
+}
+
 function emptyElement(element) {
   childNodes = element.childNodes;
   for(var i=0; i<childNodes.length; i++) {