summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-05-23 14:17:07 +0000
committeralecpl <alec@alec.pl>2009-05-23 14:17:07 +0000
commit49dfb0047a53758a3e12699cf6e0b4da55aefd3e (patch)
tree48bb85d6fb196aa4cee9e7f382a776a5efd8f176 /program
parent569654a8c350de5b34cb65ae561bf95418b15f1c (diff)
- Added message menu (some image needed), removed Print and Source buttons
- Added possibility to save message as .eml file (#1485861)
Diffstat (limited to 'program')
-rwxr-xr-xprogram/include/rcube_template.php3
-rw-r--r--program/js/app.js47
-rw-r--r--program/localization/en_GB/labels.inc1
-rw-r--r--program/localization/en_US/labels.inc1
-rw-r--r--program/localization/pl_PL/labels.inc1
-rw-r--r--program/steps/mail/show.inc1
-rw-r--r--program/steps/mail/viewsource.inc15
7 files changed, 45 insertions, 24 deletions
diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php
index 21363f256..b597c55b7 100755
--- a/program/include/rcube_template.php
+++ b/program/include/rcube_template.php
@@ -796,9 +796,6 @@ class rcube_template extends rcube_html_page
else if (in_array($attrib['command'], $a_static_commands)) {
$attrib['href'] = rcmail_url($attrib['command']);
}
- else if ($attrib['command'] == 'permaurl' && !empty($this->env['permaurl'])) {
- $attrib['href'] = $this->env['permaurl'];
- }
}
// overwrite attributes
diff --git a/program/js/app.js b/program/js/app.js
index ec94b5aff..8b357e70a 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -150,9 +150,6 @@ function rcube_webmail()
// 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 @@ function rcube_webmail()
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);
@@ -199,6 +198,13 @@ function rcube_webmail()
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);
+ }
}
if (this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox)
@@ -211,13 +217,6 @@ function rcube_webmail()
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')
{
this.enable_command('add-attachment', 'send-attachment', 'remove-attachment', 'send', true);
@@ -560,12 +559,14 @@ function rcube_webmail()
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,12 +993,18 @@ function rcube_webmail()
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':
this.add_contact(props);
break;
@@ -1357,12 +1364,12 @@ function rcube_webmail()
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));
}
diff --git a/program/localization/en_GB/labels.inc b/program/localization/en_GB/labels.inc
index 0e86a3c71..96629a7e4 100644
--- a/program/localization/en_GB/labels.inc
+++ b/program/localization/en_GB/labels.inc
@@ -134,6 +134,7 @@ $labels['resetsearch'] = 'Reset search';
$labels['searchmod'] = 'Search modifiers';
$labels['msgtext'] = 'Entire message';
$labels['openinextwin'] = 'Open in new window';
+$labels['emlsave'] = 'Save (.eml)';
$labels['compose'] = 'Compose a message';
$labels['savemessage'] = 'Save this draft';
$labels['sendmessage'] = 'Send now';
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 89ab3c63e..19c09e50a 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -165,6 +165,7 @@ $labels['searchmod'] = 'Search modifiers';
$labels['msgtext'] = 'Entire message';
$labels['openinextwin'] = 'Open in new window';
+$labels['emlsave'] = 'Save (.eml)';
// message compose
$labels['compose'] = 'Compose a message';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index c68d19e69..f0efabae2 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -145,6 +145,7 @@ $labels['resetsearch'] = 'Wyczyść filtr';
$labels['searchmod'] = 'Parametry wyszukiwania';
$labels['msgtext'] = 'Cała wiadomość';
$labels['openinextwin'] = 'Otwórz w nowym oknie';
+$labels['emlsave'] = 'Zapisz (.eml)';
$labels['compose'] = 'Utwórz wiadomość';
$labels['savemessage'] = 'Zapisz kopię roboczą';
$labels['sendmessage'] = 'Wyślij teraz';
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 9beb42521..06c9f53e5 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -65,7 +65,6 @@ if ($_GET['_uid']) {
// set environement
$OUTPUT->set_env('safemode', $MESSAGE->is_safe);
$OUTPUT->set_env('sender', $MESSAGE->sender['string']);
- $OUTPUT->set_env('permaurl', rcmail_url('show', array('_uid' => $MESSAGE->uid, '_mbox' => $mbox_name)));
$OUTPUT->set_env('mailbox', $mbox_name);
if ($CONFIG['trash_mbox'])
$OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']);
diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc
index 6971e0c8a..87908303d 100644
--- a/program/steps/mail/viewsource.inc
+++ b/program/steps/mail/viewsource.inc
@@ -26,6 +26,21 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET))
$headers = $IMAP->get_headers($uid);
$charset = $headers->charset ? $headers->charset : $IMAP->default_charset;
header("Content-Type: text/plain; charset={$charset}");
+
+ if (!empty($_GET['_save'])) {
+ $filename = ($headers->subject ? $headers->subject : 'roundcube') . '.eml';
+ $browser = new rcube_browser;
+
+ if ($browser->ie && $browser->ver < 7)
+ $filename = rawurlencode(abbreviate_string($filename, 55));
+ else if ($browser->ie)
+ $filename = rawurlencode($filename);
+ else
+ $filename = addcslashes($filename, '"');
+
+ header("Content-Disposition: attachment; filename=\"$filename\"");
+ }
+
$IMAP->print_raw_body($uid);
}
else