From 46cdbf074e59a33fafc8a71406dbb9984a48bc95 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 10 Nov 2011 06:16:32 -0500
Subject: [PATCH] - Fix inconsistent behaviour of Compose button in Drafts folder, add Edit button for drafts
---
skins/default/common.css | 12 ++++--
CHANGELOG | 1
skins/default/ie6hacks.css | 5 ++
program/include/rcube_imap.php | 2
skins/default/mail.css | 7 +--
program/localization/en_US/labels.inc | 1
program/steps/mail/show.inc | 52 ++++++++++++++++++++++++--
program/localization/pl_PL/labels.inc | 1
skins/default/templates/message.html | 3 -
skins/default/templates/messagepreview.html | 2
program/js/app.js | 12 +----
11 files changed, 72 insertions(+), 26 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 3f7468b..7e99dca 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix inconsistent behaviour of Compose button in Drafts folder, add Edit button for drafts
- Fix problem with parsing HTML message body with non-unicode characters (#1487813)
- Add option to define matching method for addressbook search (#1486564, #1487907)
- Make email recipients separator configurable
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 7508acd..8c1fab8 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -478,7 +478,7 @@
*/
function get_mailbox_name()
{
- return $this->conn->connected() ? $this->mailbox : '';
+ return $this->mailbox;
}
diff --git a/program/js/app.js b/program/js/app.js
index 53143b1..c0da943 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -207,7 +207,7 @@
'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', 'download',
'print', 'load-attachment', 'load-headers', 'forward-attachment'];
- if (this.env.action=='show' || this.env.action=='preview') {
+ if (this.env.action == 'show' || this.env.action == 'preview') {
this.enable_command(this.env.message_commands, this.env.uid);
this.enable_command('reply-list', this.env.list_post);
@@ -460,7 +460,7 @@
}
// check input before leaving compose step
- if (this.task=='mail' && this.env.action=='compose' && $.inArray(command, this.env.compose_commands)<0) {
+ if (this.task == 'mail' && this.env.action == 'compose' && $.inArray(command, this.env.compose_commands)<0) {
if (this.cmp_hash != this.compose_field_hash() && !confirm(this.get_label('notsentwarning')))
return false;
}
@@ -815,13 +815,7 @@
if (this.task == 'mail') {
url += '&_mbox='+urlencode(this.env.mailbox);
-
- if (this.env.mailbox == this.env.drafts_mailbox) {
- var uid;
- if (uid = this.get_single_uid())
- url += '&_draft_uid='+uid;
- }
- else if (props)
+ if (props)
url += '&_to='+urlencode(props);
}
// modify url if we're in addressbook
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 5cf5acf..77b31b6 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -225,6 +225,7 @@
$labels['nosubject'] = '(no subject)';
$labels['showimages'] = 'Display images';
$labels['alwaysshow'] = 'Always show images from $sender';
+$labels['isdraft'] = 'This is a draft message.';
$labels['htmltoggle'] = 'HTML';
$labels['plaintoggle'] = 'Plain text';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index 717c7c3..d45a7a0 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -432,5 +432,6 @@
$labels['addtodict'] = 'Dodaj do słownika';
$labels['dateformat'] = 'Format daty';
$labels['timeformat'] = 'Format czasu';
+$labels['isdraft'] = 'To jest kopia robocza wiadomości.';
?>
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 97cac58..8976e86 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -150,12 +150,13 @@
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')) . ' ';
$msg .= html::a(array('href' => "#loadimages", 'onclick' => JS_OBJECT_NAME.".command('load-images')"), Q(rcube_label('showimages')));
@@ -168,6 +169,48 @@
$RCMAIL->output->add_gui_object('remoteobjectsmsg', $attrib['id']);
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')) . ' ';
+ $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)
@@ -189,7 +232,8 @@
$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'))
diff --git a/skins/default/common.css b/skins/default/common.css
index 192de06..6bf8e90 100644
--- a/skins/default/common.css
+++ b/skins/default/common.css
@@ -230,7 +230,7 @@
}
#message div.notice,
-#remote-objects-message
+#message-objects div.notice
{
background: url(images/display/icons.png) 6px 3px no-repeat;
background-color: #F7FDCB;
@@ -238,21 +238,25 @@
}
#message div.error,
-#message div.warning
+#message div.warning,
+#message-objects div.warning,
+#message-objects div.error
{
background: url(images/display/icons.png) 6px -97px no-repeat;
background-color: #EF9398;
border: 1px solid #DC5757;
}
-#message div.confirmation
+#message div.confirmation,
+#message-objects div.confirmation
{
background: url(images/display/icons.png) 6px -47px no-repeat;
background-color: #A6EF7B;
border: 1px solid #76C83F;
}
-#message div.loading
+#message div.loading,
+#message-objects div.loading
{
background: url(images/display/loading.gif) 6px 3px no-repeat;
background-color: #EBEBEB;
diff --git a/skins/default/ie6hacks.css b/skins/default/ie6hacks.css
index 5da6e7a..dc7f24a 100644
--- a/skins/default/ie6hacks.css
+++ b/skins/default/ie6hacks.css
@@ -20,7 +20,10 @@
#message div.error,
#message div.warning,
#message div.confirmation,
-#remote-objects-message
+#message-objects div.notice,
+#message-objects div.error,
+#message-objects div.warning,
+#message-objects div.confirmation
{
background-image: url(images/display/icons.gif);
}
diff --git a/skins/default/mail.css b/skins/default/mail.css
index 9bc46d0..3ea4fec 100644
--- a/skins/default/mail.css
+++ b/skins/default/mail.css
@@ -1197,21 +1197,20 @@
margin: 8px;
}
-#remote-objects-message
+#message-objects div
{
- display: none;
margin: 8px;
min-height: 20px;
padding: 10px 10px 6px 46px;
}
-#remote-objects-message a
+#message-objects div a
{
color: #666666;
padding-left: 10px;
}
-#remote-objects-message a:hover
+#message-objects div a:hover
{
color: #333333;
}
diff --git a/skins/default/templates/message.html b/skins/default/templates/message.html
index 8e2bb2c..714540b 100644
--- a/skins/default/templates/message.html
+++ b/skins/default/templates/message.html
@@ -36,8 +36,7 @@
<roundcube:object name="messageHeaders" class="headers-table" cellspacing="0" cellpadding="2" addicon="/images/icons/silhouette.png" summary="Message headers" />
<roundcube:object name="messageFullHeaders" id="full-headers" />
<roundcube:object name="messageAttachments" id="attachment-list" />
-
-<roundcube:object name="blockedObjects" id="remote-objects-message" />
+<roundcube:object name="messageObjects" id="message-objects" />
<roundcube:object name="messageBody" id="messagebody" />
</div>
<div class="boxfooter">
diff --git a/skins/default/templates/messagepreview.html b/skins/default/templates/messagepreview.html
index bfd7d7d..a606311 100644
--- a/skins/default/templates/messagepreview.html
+++ b/skins/default/templates/messagepreview.html
@@ -13,7 +13,7 @@
<roundcube:object name="messageAttachments" id="attachment-list" />
</div>
-<roundcube:object name="blockedObjects" id="remote-objects-message" />
+<roundcube:object name="messageObjects" id="message-objects" />
<roundcube:object name="messageBody" id="messagebody" />
</body>
--
Gitblit v1.9.1