mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Added a checkbox for 'save as infolog' when merging multiple contacts into an email document.
This commit is contained in:
parent
be68b38982
commit
845a1ec3e7
@ -815,6 +815,46 @@ app.classes.addressbook = AppJS.extend(
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge the selected contacts into the target document.
|
||||||
|
*
|
||||||
|
* Normally we let the framework handle this, but in addressbook we want to
|
||||||
|
* interfere and customize things a little to ask about saving to infolog.
|
||||||
|
*
|
||||||
|
* @param {egwAction} action - The document they clicked
|
||||||
|
* @param {egwActionObject[]} selected - Rows selected
|
||||||
|
*/
|
||||||
|
merge_mail: function merge_mail(action, selected, target)
|
||||||
|
{
|
||||||
|
// Special processing for email documents - ask about infolog
|
||||||
|
if(action && action.data && selected.length > 1)
|
||||||
|
{
|
||||||
|
var callback = function(button, value) {
|
||||||
|
if(button == et2_dialog.OK_BUTTON)
|
||||||
|
{
|
||||||
|
var _action = jQuery.extend(true, {}, action);
|
||||||
|
if(value.infolog)
|
||||||
|
{
|
||||||
|
_action.data.menuaction += '&to_app=infolog';
|
||||||
|
}
|
||||||
|
nm_action(_action, selected, target);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
et2_createWidget("dialog",{
|
||||||
|
callback: callback,
|
||||||
|
title: action.caption,
|
||||||
|
buttons: et2_dialog.BUTTONS_OK_CANCEL,
|
||||||
|
type: et2_dialog.QUESTION_MESSAGE,
|
||||||
|
template: egw.webserverUrl+'/addressbook/templates/default/mail_merge_dialog.xet'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Normal processing for only one contact selected
|
||||||
|
return nm_action(action, selected, target);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the current state of the application for future restoration
|
* Retrieve the current state of the application for future restoration
|
||||||
*
|
*
|
||||||
|
21
addressbook/templates/default/mail_merge_dialog.xet
Normal file
21
addressbook/templates/default/mail_merge_dialog.xet
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||||
|
<!-- $Id$ -->
|
||||||
|
<overlay>
|
||||||
|
<template id="addressbook.mail_merge_dialog" template="" lang="" group="0" version="">
|
||||||
|
<grid>
|
||||||
|
<columns>
|
||||||
|
<column/>
|
||||||
|
<column/>
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row>
|
||||||
|
<description value="Do you want to send the message to all selected entries, WITHOUT further editing?"/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<checkbox id="infolog" label="Save as infolog"/>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
</template>
|
||||||
|
</overlay>
|
@ -256,4 +256,45 @@ class Merge extends Api\Storage\Merge
|
|||||||
|
|
||||||
$GLOBALS['egw']->framework->render(ob_get_clean());
|
$GLOBALS['egw']->framework->render(ob_get_clean());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get insert-in-document action with optional default document on top
|
||||||
|
*
|
||||||
|
* Overridden from parent to change the insert-in-email actions so we can
|
||||||
|
* have a custom action handler.
|
||||||
|
*
|
||||||
|
* @param string $dirs Directory(s comma or space separated) to search
|
||||||
|
* @param int $group see nextmatch_widget::egw_actions
|
||||||
|
* @param string $caption ='Insert in document'
|
||||||
|
* @param string $prefix ='document_'
|
||||||
|
* @param string $default_doc ='' full path to default document to show on top with action == 'document'!
|
||||||
|
* @param int|string $export_limit =null export-limit, default $GLOBALS['egw_info']['server']['export_limit']
|
||||||
|
* @return array see nextmatch_widget::egw_actions
|
||||||
|
*/
|
||||||
|
public static function document_action($dirs, $group=0, $caption='Insert in document', $prefix='document_', $default_doc='',
|
||||||
|
$export_limit=null)
|
||||||
|
{
|
||||||
|
$actions = parent::document_action($dirs, $group, $caption, $prefix, $default_doc, $export_limit);
|
||||||
|
|
||||||
|
// Change merge into email actions so we can customize them
|
||||||
|
static::customise_mail_actions($actions);
|
||||||
|
|
||||||
|
return $actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function customise_mail_actions(&$action)
|
||||||
|
{
|
||||||
|
if(strpos($action['egw_open'], 'edit-mail') === 0)
|
||||||
|
{
|
||||||
|
unset($action['confirm_multiple']);
|
||||||
|
$action['onExecute'] = 'javaScript:app.addressbook.merge_mail';
|
||||||
|
}
|
||||||
|
else if ($action['children'])
|
||||||
|
{
|
||||||
|
foreach($action['children'] as &$child)
|
||||||
|
{
|
||||||
|
static::customise_mail_actions($child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6824,6 +6824,9 @@ class Mail
|
|||||||
$sendOK = true;
|
$sendOK = true;
|
||||||
try {
|
try {
|
||||||
$mailObject->send();
|
$mailObject->send();
|
||||||
|
$message_id = $mailObject->getHeader('Message-ID');
|
||||||
|
$id = $this->appendMessage($_folder, $mailObject->getRaw(), '');
|
||||||
|
$importID = $id->current();
|
||||||
}
|
}
|
||||||
catch(Exception $e) {
|
catch(Exception $e) {
|
||||||
$sendOK = false;
|
$sendOK = false;
|
||||||
|
@ -3520,6 +3520,19 @@ class mail_compose
|
|||||||
array((int)$contact_id, ''),
|
array((int)$contact_id, ''),
|
||||||
$folder,$merged_mail_id
|
$folder,$merged_mail_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Also save as infolog
|
||||||
|
if($merged_mail_id && $_REQUEST['to_app'] && isset($GLOBALS['egw_info']['user']['apps'][$_REQUEST['to_app']]))
|
||||||
|
{
|
||||||
|
$rowid = mail_ui::generateRowID($this->mail_bo->profileID, $folder, $merged_mail_id, true);
|
||||||
|
$data = mail_integration::get_integrate_data($rowid);
|
||||||
|
if($data && $_REQUEST['to_app'] == 'infolog')
|
||||||
|
{
|
||||||
|
$bo = new infolog_bo();
|
||||||
|
$entry = $bo->import_mail($data['addresses'],$data['subject'],$data['message'],$data['attachments'],$data['date']);
|
||||||
|
$bo->write($entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user