Implement predefined addresses for compose dialog

This commit is contained in:
Hadi Nategh 2020-07-02 10:42:42 +02:00
parent 5958feb1c3
commit ae101a28c4
3 changed files with 75 additions and 0 deletions

View File

@ -689,6 +689,12 @@ class mail_ui
'group' => $group,
'hideOnMobile' => true
),
'predefined-addresses' => array(
'caption' => 'Set predefined addresses for compose...',
'onExecute' => 'javaScript:app.mail.set_predefined_addresses',
'icon' => 'edit',
'group' => $group,
),
'sieve' => array(
'caption' => 'Mail filter',
'onExecute' => 'javaScript:app.mail.edit_sieve',

View File

@ -240,6 +240,11 @@ app.classes.mail = AppJS.extend(
var plainText = this.et2.getWidgetById('mail_plaintext');
var textAreaWidget = this.et2.getWidgetById('mail_htmltext');
this.mail_isMainWindow = false;
var pca = egw.preference(this.et2.getWidgetById('mailaccount').getValue().split(":")[0]+'_predefined_compose_addresses', 'mail');
for (var p in pca)
{
this.et2.getWidgetById(p).set_value(pca[p]);
}
this.compose_fieldExpander_init();
this.check_sharing_filemode();
@ -6231,5 +6236,41 @@ app.classes.mail = AppJS.extend(
}
}
}
},
/**
* Set predefined addresses for compose dialog
*
* @param {type} action
* @param {type} _senders
* @returns {undefined}
*/
set_predefined_addresses: function(action,_senders)
{
var buttons = [
{text: this.egw.lang("Save"), id: "save", "class": "ui-priority-primary", "default": true},
{text: this.egw.lang("Cancel"), id:"cancel"}
];
var pref_id = _senders[0].id.split('::')[0]+'_predefined_compose_addresses';
var prefs = egw.preference(pref_id, 'mail');
et2_createWidget("dialog",
{
callback: function(_button_id, _value) {
switch (_button_id)
{
case "save":
egw.set_preference('mail', pref_id, _value);
return;
case "cancel":
}
},
title: this.egw.lang("Predefined addresses for compose"),
buttons: buttons,
value:{content:prefs},
minWidth: 410,
template: egw.webserverUrl+'/mail/templates/default/predefinedAddressesDialog.xet?',
resizable: false,
}, et2_dialog._create_parent('mail'));
}
});

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
<!-- $Id$ -->
<overlay>
<template id="mail.predefinedAddressesDialog" template="" lang="" group="0" version="17.1">
<hbox class="et2_prompt">
<grid width="390">
<columns>
<column width="60"/>
<column width="260"/>
</columns>
<rows>
<row>
<description value="Configured email addresses will be set automatically on compose dialog for respected field when composing a new email."/>
</row>
<row>
<description label= "%s:" value="Cc"/>
<taglist-email id="cc" allowFreeEntries="true" include_lists="true"/>
</row>
<row>
<description label= "%s:" value="Bcc"/>
<taglist-email id="bcc" allowFreeEntries="true" include_lists="true"/>
</row>
</rows>
</grid>
</hbox>
</template>
</overlay>