- Fix inconsistent behaviour of Compose button in Drafts folder, add Edit button for drafts

This commit is contained in:
alecpl
2011-11-10 11:16:32 +00:00
parent d61756663c
commit 46cdbf074e
11 changed files with 72 additions and 26 deletions

View File

@@ -478,7 +478,7 @@ class rcube_imap
*/
function get_mailbox_name()
{
return $this->conn->connected() ? $this->mailbox : '';
return $this->mailbox;
}

View File

@@ -207,7 +207,7 @@ function rcube_webmail()
'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 @@ function rcube_webmail()
}
// 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 @@ function rcube_webmail()
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

View File

@@ -225,6 +225,7 @@ $labels['highest'] = 'Highest';
$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';

View File

@@ -432,5 +432,6 @@ $labels['spellcheckignorecaps'] = 'Ignoruj słowa pisane wielkimi literami';
$labels['addtodict'] = 'Dodaj do słownika';
$labels['dateformat'] = 'Format daty';
$labels['timeformat'] = 'Format czasu';
$labels['isdraft'] = 'To jest kopia robocza wiadomości.';
?>

View File

@@ -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'))