mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-18 12:41:10 +01:00
* 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();
|
$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'));
|
||||||
|
@ -200,7 +200,9 @@ app.classes.mail = AppJS.extend(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
/*Trigger compose_resizeHandler after the CKEditor is fully loaded*/
|
/*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();
|
this.compose_fieldExpander();
|
||||||
|
|
||||||
@ -388,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;
|
||||||
});
|
});
|
||||||
@ -3532,7 +3534,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)
|
||||||
@ -3707,7 +3709,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();
|
||||||
@ -3715,6 +3717,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