Add message menu with viewsource and edit actions in message/rfc822 preview

pull/5241/head
Aleksander Machniak 9 years ago
parent d125f864ea
commit e8b6e726f6

@ -342,7 +342,8 @@ function rcube_webmail()
else if (this.env.action == 'get') { else if (this.env.action == 'get') {
this.enable_command('download', 'print', true); this.enable_command('download', 'print', true);
if (this.env.is_message) { if (this.env.is_message) {
this.enable_command('reply', 'reply-all', 'forward', 'forward-inline', 'forward-attachment', true); this.enable_command('reply', 'reply-all', 'edit', 'viewsource',
'forward', 'forward-inline', 'forward-attachment', true);
if (this.env.list_post) if (this.env.list_post)
this.enable_command('reply-list', true); this.enable_command('reply-list', true);
} }

@ -22,7 +22,7 @@
if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)) { if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)) {
if ($pos = strpos($uid, '.')) { if ($pos = strpos($uid, '.')) {
$message = new rcube_message($uid); $message = new rcube_message($uid);
$source = $message->get_part_content(substr($uid, $pos + 1)); $source = $message->get_part_body(substr($uid, $pos + 1));
$source = substr($source, 0, strpos($source, "\r\n\r\n")); $source = substr($source, 0, strpos($source, "\r\n\r\n"));
} }
else { else {

@ -5,7 +5,7 @@
| program/steps/mail/viewsource.inc | | program/steps/mail/viewsource.inc |
| | | |
| This file is part of the Roundcube Webmail client | | This file is part of the Roundcube Webmail client |
| Copyright (C) 2005-2013, The Roundcube Dev Team | | Copyright (C) 2005-2016, The Roundcube Dev Team |
| | | |
| Licensed under the GNU General Public License version 3 or | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -27,7 +27,15 @@ ob_end_clean();
// similar code as in program/steps/mail/get.inc // similar code as in program/steps/mail/get.inc
if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET)) { if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET)) {
if ($pos = strpos($uid, '.')) {
$message = new rcube_message($uid);
$headers = $message->headers;
$part_id = substr($uid, $pos + 1);
}
else {
$headers = $RCMAIL->storage->get_message_headers($uid); $headers = $RCMAIL->storage->get_message_headers($uid);
}
$charset = $headers->charset ?: $RCMAIL->config->get('default_charset'); $charset = $headers->charset ?: $RCMAIL->config->get('default_charset');
header("Content-Type: text/plain; charset={$charset}"); header("Content-Type: text/plain; charset={$charset}");
@ -46,8 +54,13 @@ if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET)) {
header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-Disposition: attachment; filename=\"$filename\"");
} }
if (isset($message)) {
$message->get_part_body($part_id, empty($_GET['_save']), 0, -1);
}
else {
$RCMAIL->storage->print_raw_body($uid, empty($_GET['_save'])); $RCMAIL->storage->print_raw_body($uid, empty($_GET['_save']));
} }
}
else { else {
rcube::raise_error(array( rcube::raise_error(array(
'code' => 500, 'code' => 500,

@ -28,6 +28,7 @@
<roundcube:button command="forward" type="link" class="buttonPas forward" classAct="button forward" classSel="button forwardSel" title="forwardmessage" content=" " /> <roundcube:button command="forward" type="link" class="buttonPas forward" classAct="button forward" classSel="button forwardSel" title="forwardmessage" content=" " />
<span id="forwardmenulink" onclick="rcmail_ui.show_popup('forwardmenu');return false"></span> <span id="forwardmenulink" onclick="rcmail_ui.show_popup('forwardmenu');return false"></span>
</span> </span>
<roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="moreactions" onclick="rcmail_ui.show_popup('messagemenu');return false" content=" " />
<roundcube:endif /> <roundcube:endif />
</div> </div>
@ -59,6 +60,14 @@
<roundcube:container name="replyallmenu" id="replyallmenumenu" /> <roundcube:container name="replyallmenu" id="replyallmenumenu" />
</ul> </ul>
</div> </div>
<div id="messagemenu" class="popupmenu">
<ul class="toolbarmenu" id="messagemenumenu">
<roundcube:button type="link-menuitem" class="editlink" command="edit" prop="new" label="editasnew" classAct="editlink active" />
<roundcube:button type="link-menuitem" class="sourcelink" command="viewsource" label="viewsource" classAct="sourcelink active" />
<roundcube:container name="messagemenu" id="messagemenumenu" />
</ul>
</div>
<roundcube:endif /> <roundcube:endif />
<script type="text/javascript"> <script type="text/javascript">

@ -28,6 +28,7 @@
<roundcube:button command="forward" type="link" class="button forward disabled" classAct="button forward" classSel="button forward pressed" label="forward" title="forwardmessage" /> <roundcube:button command="forward" type="link" class="button forward disabled" classAct="button forward" classSel="button forward pressed" label="forward" title="forwardmessage" />
<a href="#forward" class="dropbuttontip" id="forwardmenulink" onclick="UI.toggle_popup('forwardmenu',event);return false" aria-haspopup="true" aria-expanded="false" aria-owns="forwardmenu-menu" tabindex="0">Forwarding options</a> <a href="#forward" class="dropbuttontip" id="forwardmenulink" onclick="UI.toggle_popup('forwardmenu',event);return false" aria-haspopup="true" aria-expanded="false" aria-owns="forwardmenu-menu" tabindex="0">Forwarding options</a>
</span> </span>
<roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button more" label="more" title="moreactions" onclick="UI.toggle_popup('messagemenu',event);return false" aria-haspopup="true" aria-expanded="false" aria-owns="messagemenu-menu" />
<roundcube:endif /> <roundcube:endif />
</div> </div>
@ -68,6 +69,15 @@
<roundcube:container name="replyallmenu" id="replyallmenu-menu" /> <roundcube:container name="replyallmenu" id="replyallmenu-menu" />
</ul> </ul>
</div> </div>
<div id="messagemenu" class="popupmenu" aria-hidden="true">
<h3 id="aria-label-messagemenu" class="voice"><roundcube:label name="arialabelmoremessageactions" /></h3>
<ul id="messagemenu-menu" class="toolbarmenu iconized" role="menu" aria-labelledby="aria-label-messagemenu">
<roundcube:button type="link-menuitem" command="edit" prop="new" label="editasnew" class="icon" classAct="icon active" innerclass="icon edit" />
<roundcube:button type="link-menuitem" command="viewsource" label="viewsource" class="icon" classAct="icon active" innerclass="icon viewsource" />
<roundcube:container name="messagemenu" id="messagemenu-menu" />
</ul>
</div>
<roundcube:endif /> <roundcube:endif />
<roundcube:include file="/includes/footer.html" /> <roundcube:include file="/includes/footer.html" />

Loading…
Cancel
Save