Add an Abort / Retry / Skip prompt for long task when one fails

This commit is contained in:
nathangray 2016-06-30 15:45:31 -06:00 committed by Ralf Becker
parent 6c89b240bf
commit 116a1ce63c
3 changed files with 58 additions and 9 deletions

View File

@ -736,8 +736,39 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return
switch(response.type)
{
case 'error':
log.append("<div class='message error'>"+response.data+"</div>");
break;
jQuery("<div class='message error'></div>")
.text(response.data)
.appendTo(log);
// Ask to retry / ignore / abort
et2_createWidget("dialog", {
callback:function(button) {
switch(button)
{
case 'dialog[cancel]':
cancel = true;
return update.call(index,'');
case 'dialog[skip]':
// Continue with next index
return update.call(index,'');
default:
// Try again with previous index
return update.call(index-1,'');
}
},
message: response.data,
title: '',
buttons: [
// These ones will use the callback, just like normal
{text: egw.lang("Abort"),id:'dialog[cancel]',},
{text: egw.lang("Retry"),id:'dialog[retry]'},
{text: egw.lang("Skip"),id:'dialog[skip]', class:"ui-priority-primary", default: true}
],
dialog_type: et2_dialog.ERROR_MESSAGE
}, parent);
// Early exit
return;
default:
if(response)
{
@ -755,6 +786,7 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return
if(typeof parameters != 'object') parameters = [parameters];
// Async request, we'll take the next step in the callback
// We can't pass index = 0, it looks like false and causes issues
egw.json(_menuaction, parameters, update, index+1,true,index+1).sendRequest();
}
else

View File

@ -1858,6 +1858,10 @@ div.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset button {
.long_task .message {
height: inherit;
}
.long_task .message.error {
color: white;
background-color: red;
}
div.ui-dialog div.ui-dialog-content > div[id] {
width: 100%;
}

View File

@ -3494,13 +3494,26 @@ class mail_compose
// Actually do the merge
$folder = $merged_mail_id = null;
$results = $this->mail_bo->importMessageToMergeAndSend(
$document_merge, Vfs::PREFIX . $_REQUEST['document'],
// Send an extra non-numeric ID to force actual send of document
// instead of save as draft
array((int)$contact_id, ''),
$folder,$merged_mail_id
);
try
{
$results = $this->mail_bo->importMessageToMergeAndSend(
$document_merge, Vfs::PREFIX . $_REQUEST['document'],
// Send an extra non-numeric ID to force actual send of document
// instead of save as draft
array((int)$contact_id, ''),
$folder,$merged_mail_id
);
}
catch (Exception $e)
{
$contact = $document_merge->contacts->read((int)$contact_id);
//error_log(__METHOD__.' ('.__LINE__.') '.' ID:'.$val.' Data:'.array2string($contact));
$email = ($contact['email'] ? $contact['email'] : $contact['email_home']);
$nfn = ($contact['n_fn'] ? $contact['n_fn'] : $contact['n_given'].' '.$contact['n_family']);
$response->error(lang('Sending mail to "%1" failed', "$nfn <$email>").
"\n".$e->getMessage()
);
}
if($results['success'])
{