forked from extern/egroupware
* Mail: Make the saveAsDraft and print functionality working in mail compose dialog
This commit is contained in:
parent
614be1770d
commit
5939930c60
@ -448,6 +448,10 @@ class mail_compose
|
||||
$response = egw_json_response::get();
|
||||
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');
|
||||
if ($_content['button']['saveAsDraftAndPrint'])
|
||||
{
|
||||
$response->call('app.mail.mail_compose_print',"mail::" .$draft_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($activeProfile != $composeProfile) $this->changeProfile($activeProfile);
|
||||
@ -2376,7 +2380,7 @@ class mail_compose
|
||||
}
|
||||
$mail_bo->closeConnection();
|
||||
}
|
||||
|
||||
|
||||
function saveAsDraft($_formData, &$savingDestination='')
|
||||
{
|
||||
$mail_bo = $this->mail_bo;
|
||||
|
@ -1951,27 +1951,30 @@ class mail_ui
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
function displayMessage($_requesteddata = null)
|
||||
{
|
||||
if (!is_null($_requesteddata) && isset($_requesteddata['id']))
|
||||
{
|
||||
$rowID = $_requesteddata['id'];
|
||||
}
|
||||
if (is_null($_requesteddata)) $_requesteddata = $_GET;
|
||||
|
||||
$preventRedirect=false;
|
||||
if(isset($_GET['id'])) $rowID = $_GET['id'];
|
||||
if(isset($_GET['part'])) $partID = $_GET['part'];
|
||||
if(isset($_GET['mode'])) $preventRedirect = ($_GET['mode']=='display'?true:false);
|
||||
if(isset($_requesteddata['id'])) $rowID = $_requesteddata['id'];
|
||||
if(isset($_requesteddata['part'])) $partID = $_requesteddata['part'];
|
||||
if(isset($_requesteddata['mode'])) $preventRedirect = (($_requesteddata['mode']=='display' || $_requesteddata['mode'] == 'print')?true:false);
|
||||
$htmlOptions = $this->mail_bo->htmlOptions;
|
||||
if (!empty($_GET['tryastext'])) $htmlOptions = "only_if_no_text";
|
||||
if (!empty($_GET['tryashtml'])) $htmlOptions = "always_display";
|
||||
if (!empty($_requesteddata['tryastext'])) $htmlOptions = "only_if_no_text";
|
||||
if (!empty($_requesteddata['tryashtml'])) $htmlOptions = "always_display";
|
||||
|
||||
$hA = self::splitRowID($rowID);
|
||||
$uid = $hA['msgUID'];
|
||||
$mailbox = $hA['folder'];
|
||||
//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)))
|
||||
{
|
||||
egw::redirect_link('/index.php',array('menuaction'=>'mail.mail_compose.compose','id'=>$rowID,'from'=>'composefromdraft'));
|
||||
|
@ -200,7 +200,9 @@ app.classes.mail = AppJS.extend(
|
||||
}
|
||||
});
|
||||
/*Trigger compose_resizeHandler after the CKEditor is fully loaded*/
|
||||
jQuery('#mail-compose').load ('load', function() {that.compose_resizeHandler();});
|
||||
jQuery('#mail-compose').on ('load',function() {
|
||||
window.setTimeout(function(){that.compose_resizeHandler()}, 100);
|
||||
});
|
||||
|
||||
this.compose_fieldExpander();
|
||||
|
||||
@ -388,7 +390,7 @@ app.classes.mail = AppJS.extend(
|
||||
var dataElem = egw.dataGetUIDdata(_id);
|
||||
var subject = dataElem.data.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() {
|
||||
h.document.title = subject;
|
||||
});
|
||||
@ -3158,7 +3160,7 @@ app.classes.mail = AppJS.extend(
|
||||
{
|
||||
this.et2_obj.submit();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Focus handler for folder, address, reject textbox/taglist to automatic check associated radio button
|
||||
*
|
||||
@ -3532,7 +3534,7 @@ app.classes.mail = AppJS.extend(
|
||||
var textArea = this.et2.getWidgetById('mail_plaintext');
|
||||
var toolbar = jQuery('.mailSignature');
|
||||
|
||||
if (typeof textArea != 'undefined')
|
||||
if (typeof textArea != 'undefined' && textArea != null)
|
||||
{
|
||||
var textAreaH = textArea.node.clientHeight;
|
||||
if (textArea.getParent().disabled)
|
||||
@ -3707,14 +3709,43 @@ app.classes.mail = AppJS.extend(
|
||||
switch (currentTemp)
|
||||
{
|
||||
case 'mail.index':
|
||||
this.mail_prev_print();
|
||||
this.mail_prev_print(_action, _senders);
|
||||
break;
|
||||
case 'mail.display':
|
||||
this.mail_display_print();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user