This manual is deprecated. Please visit https://groupoffice.readthedocs.io for the latest documentation. |
Difference between revisions of "Using the e-mail composer in your module"
From Group-Office Groupware and CRM Documentation
(New page: In a lot of cases you might want to open the e-mail composer and preset it with values. For example the billing module opens the composer to send an invoice. You can do this by adding the ...) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
<pre> | <pre> | ||
{ | { | ||
− | iconCls: ' | + | iconCls: 'btn-compose', |
text: GO.lang.strEmail, | text: GO.lang.strEmail, | ||
− | |||
handler: function(){ | handler: function(){ | ||
if(!GO.email) | if(!GO.email) | ||
{ | { | ||
− | Ext.Msg.alert(GO.lang['strError'], | + | Ext.Msg.alert(GO.lang['strError'], "No e-mail module"); |
}else | }else | ||
{ | { | ||
GO.email.showComposer({ | GO.email.showComposer({ | ||
− | loadUrl: GO | + | loadUrl: GO.url("module/controller/email"), |
loadParams:{task:'sendmail',someparam: this.someparam}, | loadParams:{task:'sendmail',someparam: this.someparam}, | ||
template_id: 0 | template_id: 0 | ||
Line 29: | Line 28: | ||
<pre> | <pre> | ||
− | $ | + | protected function actionEmail($params){ |
− | + | ||
− | $ | + | $message = new GO_Email_Model_ComposerMessage(); |
− | + | $message->subject="Example message"; | |
− | $response['data | + | |
− | $response[' | + | $response['data'] = $message->toOutputArray(true,true); |
− | + | $response['success']=true; | |
− | + | return $response; | |
− | $ | + | } |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</pre> | </pre> |
Latest revision as of 15:26, 6 July 2012
In a lot of cases you might want to open the e-mail composer and preset it with values. For example the billing module opens the composer to send an invoice. You can do this by adding the following button:
{ iconCls: 'btn-compose', text: GO.lang.strEmail, handler: function(){ if(!GO.email) { Ext.Msg.alert(GO.lang['strError'], "No e-mail module"); }else { GO.email.showComposer({ loadUrl: GO.url("module/controller/email"), loadParams:{task:'sendmail',someparam: this.someparam}, template_id: 0 }); } }, scope:this }
The loadUrl and loadParams configuration options will call your module's json.php so it can provide the composer with form data. passing template_id=0 will skip template selection for the pro version.
On the PHP side in json.php you should return some JSON data like this:
protected function actionEmail($params){ $message = new GO_Email_Model_ComposerMessage(); $message->subject="Example message"; $response['data'] = $message->toOutputArray(true,true); $response['success']=true; return $response; }