summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-11-10 11:16:32 +0000
committeralecpl <alec@alec.pl>2011-11-10 11:16:32 +0000
commit46cdbf074e59a33fafc8a71406dbb9984a48bc95 (patch)
tree5ef0eb54016626d85b2138f8c4a72173eb7ac344 /program/steps
parentd61756663c599121fb1042ffb8b4817d84bde10e (diff)
- Fix inconsistent behaviour of Compose button in Drafts folder, add Edit button for drafts
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/show.inc52
1 files changed, 48 insertions, 4 deletions
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 97cac5822..8976e863a 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -150,12 +150,13 @@ function rcmail_message_attachments($attrib)
return $out;
}
-function rcmail_remote_objects_msg($attrib)
+function rcmail_remote_objects_msg()
{
global $MESSAGE, $RCMAIL;
- if (!$attrib['id'])
- $attrib['id'] = 'rcmremoteobjmsg';
+ $attrib['id'] = 'remote-objects-message';
+ $attrib['class'] = 'notice';
+ $attrib['style'] = 'display: none';
$msg = Q(rcube_label('blockedimages')) . '&nbsp;';
$msg .= html::a(array('href' => "#loadimages", 'onclick' => JS_OBJECT_NAME.".command('load-images')"), Q(rcube_label('showimages')));
@@ -170,6 +171,48 @@ function rcmail_remote_objects_msg($attrib)
return html::div($attrib, $msg);
}
+function rcmail_message_buttons()
+{
+ global $MESSAGE, $RCMAIL, $CONFIG;
+
+ $mbox = $RCMAIL->imap->get_mailbox_name();
+ $delim = $RCMAIL->imap->get_hierarchy_delimiter();
+ $dbox = $CONFIG['drafts_mbox'];
+
+ // the message is not a draft
+ if ($mbox != $dbox && strpos($mbox, $dbox.$delim) !== 0) {
+ return '';
+ }
+
+ $attrib['id'] = 'message-buttons';
+ $attrib['class'] = 'notice';
+
+ $msg = Q(rcube_label('isdraft')) . '&nbsp;';
+ $msg .= html::a(array('href' => "#edit", 'onclick' => JS_OBJECT_NAME.".command('edit')"), Q(rcube_label('edit')));
+
+ return html::div($attrib, $msg);
+}
+
+function rcmail_message_objects($attrib)
+{
+ global $RCMAIL, $MESSAGE;
+
+ if (!$attrib['id'])
+ $attrib['id'] = 'message-objects';
+
+ $content = array(
+ rcmail_message_buttons(),
+ rcmail_remote_objects_msg(),
+ );
+
+ $plugin = $RCMAIL->plugins->exec_hook('message_objects',
+ array('content' => $content, 'message' => $MESSAGE));
+
+ $content = implode("\n", $plugin['content']);
+
+ return html::div($attrib, $content);
+}
+
function rcmail_contact_exists($email)
{
global $RCMAIL;
@@ -189,7 +232,8 @@ function rcmail_contact_exists($email)
$OUTPUT->add_handlers(array(
'messageattachments' => 'rcmail_message_attachments',
'mailboxname' => 'rcmail_mailbox_name_display',
- 'blockedobjects' => 'rcmail_remote_objects_msg'));
+ 'messageobjects' => 'rcmail_message_objects',
+));
if ($RCMAIL->action=='print' && $OUTPUT->template_exists('messageprint'))