mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
Make the saveAsDraft and print functionality working in mail compose dialog
This commit is contained in:
parent
c0877bdaef
commit
bdcda95930
@ -448,6 +448,10 @@ class mail_compose
|
|||||||
$response = egw_json_response::get();
|
$response = egw_json_response::get();
|
||||||
if (isset($previouslyDrafted) && $previouslyDrafted!=$draft_id) $response->call('opener.egw_refresh',lang('Message saved successfully.'),'mail',$previouslyDrafted,'delete');
|
if (isset($previouslyDrafted) && $previouslyDrafted!=$draft_id) $response->call('opener.egw_refresh',lang('Message saved successfully.'),'mail',$previouslyDrafted,'delete');
|
||||||
$response->call('opener.egw_refresh',lang('Message saved successfully.'),'mail',$draft_id,'add');
|
$response->call('opener.egw_refresh',lang('Message saved successfully.'),'mail',$draft_id,'add');
|
||||||
|
if ($_content['button']['saveAsDraftAndPrint'])
|
||||||
|
{
|
||||||
|
$response->call('app.mail.mail_compose_print',"mail::" .$draft_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($activeProfile != $composeProfile) $this->changeProfile($activeProfile);
|
if ($activeProfile != $composeProfile) $this->changeProfile($activeProfile);
|
||||||
|
@ -1951,27 +1951,30 @@ class mail_ui
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* display messages
|
* display messages
|
||||||
* @param array $_requesteddata
|
* @param array $_requesteddata etemplate content
|
||||||
* all params are passed as GET Parameters, but can be passed via ExecMethod2 as array too
|
* all params are passed as GET Parameters, but can be passed via ExecMethod2 as array too
|
||||||
*/
|
*/
|
||||||
function displayMessage($_requesteddata = null)
|
function displayMessage($_requesteddata = null)
|
||||||
{
|
{
|
||||||
if (!is_null($_requesteddata) && isset($_requesteddata['id']))
|
if (is_null($_requesteddata)) $_requesteddata = $_GET;
|
||||||
{
|
|
||||||
$rowID = $_requesteddata['id'];
|
|
||||||
}
|
|
||||||
$preventRedirect=false;
|
$preventRedirect=false;
|
||||||
if(isset($_GET['id'])) $rowID = $_GET['id'];
|
if(isset($_requesteddata['id'])) $rowID = $_requesteddata['id'];
|
||||||
if(isset($_GET['part'])) $partID = $_GET['part'];
|
if(isset($_requesteddata['part'])) $partID = $_requesteddata['part'];
|
||||||
if(isset($_GET['mode'])) $preventRedirect = ($_GET['mode']=='display'?true:false);
|
if(isset($_requesteddata['mode'])) $preventRedirect = (($_requesteddata['mode']=='display' || $_requesteddata['mode'] == 'print')?true:false);
|
||||||
$htmlOptions = $this->mail_bo->htmlOptions;
|
$htmlOptions = $this->mail_bo->htmlOptions;
|
||||||
if (!empty($_GET['tryastext'])) $htmlOptions = "only_if_no_text";
|
if (!empty($_requesteddata['tryastext'])) $htmlOptions = "only_if_no_text";
|
||||||
if (!empty($_GET['tryashtml'])) $htmlOptions = "always_display";
|
if (!empty($_requesteddata['tryashtml'])) $htmlOptions = "always_display";
|
||||||
|
|
||||||
$hA = self::splitRowID($rowID);
|
$hA = self::splitRowID($rowID);
|
||||||
$uid = $hA['msgUID'];
|
$uid = $hA['msgUID'];
|
||||||
$mailbox = $hA['folder'];
|
$mailbox = $hA['folder'];
|
||||||
//error_log(__METHOD__.__LINE__.array2string($hA));
|
//error_log(__METHOD__.__LINE__.array2string($hA));
|
||||||
|
if (($this->mail_bo->isDraftFolder($mailbox)) && $_requesteddata['mode'] == 'print')
|
||||||
|
{
|
||||||
|
$response = egw_json_response::get();
|
||||||
|
$response->call('app.mail.print_for_compose', $rowID);
|
||||||
|
}
|
||||||
if (!$preventRedirect && ($this->mail_bo->isDraftFolder($mailbox) || $this->mail_bo->isTemplateFolder($mailbox)))
|
if (!$preventRedirect && ($this->mail_bo->isDraftFolder($mailbox) || $this->mail_bo->isTemplateFolder($mailbox)))
|
||||||
{
|
{
|
||||||
egw::redirect_link('/index.php',array('menuaction'=>'mail.mail_compose.compose','id'=>$rowID,'from'=>'composefromdraft'));
|
egw::redirect_link('/index.php',array('menuaction'=>'mail.mail_compose.compose','id'=>$rowID,'from'=>'composefromdraft'));
|
||||||
|
@ -390,7 +390,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
var dataElem = egw.dataGetUIDdata(_id);
|
var dataElem = egw.dataGetUIDdata(_id);
|
||||||
var subject = dataElem.data.subject;
|
var subject = dataElem.data.subject;
|
||||||
//alert('Open Message:'+_id+' '+subject);
|
//alert('Open Message:'+_id+' '+subject);
|
||||||
var h = egw().open( _id,'mail','view',_mode+'='+_id.replace(/=/g,"_") );
|
var h = egw().open( _id,'mail','view',_mode+'='+_id.replace(/=/g,"_")+'&mode='+_mode);
|
||||||
egw(h).ready(function() {
|
egw(h).ready(function() {
|
||||||
h.document.title = subject;
|
h.document.title = subject;
|
||||||
});
|
});
|
||||||
@ -3537,7 +3537,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
var textArea = this.et2.getWidgetById('mail_plaintext');
|
var textArea = this.et2.getWidgetById('mail_plaintext');
|
||||||
var toolbar = jQuery('.mailSignature');
|
var toolbar = jQuery('.mailSignature');
|
||||||
|
|
||||||
if (typeof textArea != 'undefined')
|
if (typeof textArea != 'undefined' && textArea != null)
|
||||||
{
|
{
|
||||||
var textAreaH = textArea.node.clientHeight;
|
var textAreaH = textArea.node.clientHeight;
|
||||||
if (textArea.getParent().disabled)
|
if (textArea.getParent().disabled)
|
||||||
@ -3712,7 +3712,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
switch (currentTemp)
|
switch (currentTemp)
|
||||||
{
|
{
|
||||||
case 'mail.index':
|
case 'mail.index':
|
||||||
this.mail_prev_print();
|
this.mail_prev_print(_action, _senders);
|
||||||
break;
|
break;
|
||||||
case 'mail.display':
|
case 'mail.display':
|
||||||
this.mail_display_print();
|
this.mail_display_print();
|
||||||
@ -3720,6 +3720,35 @@ app.classes.mail = AppJS.extend(
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print a mail from compose
|
||||||
|
* @param {stirng} _id id of new draft
|
||||||
|
*/
|
||||||
|
mail_compose_print:function (_id)
|
||||||
|
{
|
||||||
|
this.egw.open(_id,'mail','view','&print='+_id+'&mode=print');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind special handler on print media.
|
||||||
|
* -FF and IE have onafterprint event, and as Chrome does not have that event we bind afterprint function to onFocus
|
||||||
|
*/
|
||||||
|
print_for_compose: function()
|
||||||
|
{
|
||||||
|
var afterprint = function (){
|
||||||
|
window.close();
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!window.onafterprint)
|
||||||
|
{
|
||||||
|
window.onfocus = afterprint;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.onafterprint = afterprint;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a mail from Display
|
* Print a mail from Display
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user