From 49dfb0047a53758a3e12699cf6e0b4da55aefd3e Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sat, 23 May 2009 10:17:07 -0400
Subject: [PATCH] - Added message menu (some image needed), removed Print and Source buttons - Added possibility to save message as .eml file (#1485861)

---
 program/js/app.js |   47 +++++++++++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index ec94b5a..8b357e7 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -150,9 +150,6 @@
     // enable general commands
     this.enable_command('logout', 'mail', 'addressbook', 'settings', true);
     
-    if (this.env.permaurl)
-      this.enable_command('permaurl', true);
-    
     switch (this.task)
       {
       case 'mail':
@@ -188,7 +185,9 @@
         
         if (this.env.action=='show' || this.env.action=='preview')
           {
-          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'mark', 'viewsource', 'print', 'load-attachment', 'load-headers', true);
+          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete',
+	    'open', 'mark', 'viewsource', 'download', 'print', 'load-attachment', 'load-headers', true);
+
           if (this.env.next_uid)
             {
             this.enable_command('nextmessage', true);
@@ -198,6 +197,13 @@
             {
             this.enable_command('previousmessage', true);
             this.enable_command('firstmessage', true);
+            }
+        
+	  if (this.env.blockedobjects)
+            {
+            if (this.gui_objects.remoteobjectsmsg)
+              this.gui_objects.remoteobjectsmsg.style.display = 'block';
+            this.enable_command('load-images', 'always-load', true);
             }
           }
 
@@ -209,13 +215,6 @@
           {
           this.enable_command('compose', 'add-contact', false);
           parent.rcmail.show_contentframe(true);
-          }
-
-        if ((this.env.action=='show' || this.env.action=='preview') && this.env.blockedobjects)
-          {
-          if (this.gui_objects.remoteobjectsmsg)
-            this.gui_objects.remoteobjectsmsg.style.display = 'block';
-          this.enable_command('load-images', 'always-load', true);
           }
 
         if (this.env.action=='compose')
@@ -560,12 +559,14 @@
         this.switch_task(command);
         break;
 
-      case 'permaurl':
-        if (obj && obj.href && obj.target)
-          return true;
-        else if (this.env.permaurl)
-          parent.location.href = this.env.permaurl;
-          break;
+      case 'open':
+	var uid;
+        if (uid = this.get_single_uid())
+	  {
+	  obj.href = '?_task='+this.env.task+'&_action=show&_mbox='+urlencode(this.env.mailbox)+'&_uid='+uid;
+	  return true;
+          }
+	break;
 
       // misc list commands
       case 'list':
@@ -992,10 +993,16 @@
         var uid;
         if (uid = this.get_single_uid())
           {
-          ref.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox));
+          ref.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox));
           if (this.sourcewin)
             window.setTimeout(function(){ ref.sourcewin.focus(); }, 20);
           }
+        break;
+
+      case 'download':
+        var uid;
+        if (uid = this.get_single_uid())
+          this.goto_url('viewsource', '&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+'&_save=1');
         break;
 
       case 'add-contact':
@@ -1357,12 +1364,12 @@
     if (this.env.mailbox == this.env.drafts_mailbox)
       {
       this.enable_command('reply', 'reply-all', 'forward', false);
-      this.enable_command('show', 'print', selected);
+      this.enable_command('show', 'print', 'open', 'download', 'viewsource', selected);
       this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false));
       }
     else
       {
-      this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected);
+      this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', 'open', 'download', 'viewsource', selected);
       this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false));
       }
 

--
Gitblit v1.9.1