Commit d39ee7ca authored by Denis Chenu's avatar Denis Chenu
Browse files

[feature] Allow to stop process od send email, without close dialog

parent 6915a16a
......@@ -5,7 +5,6 @@ $(document).on('click','a.popup-sendmailajax',function(event){
delay=$("#plugin\\[sendMailAjax\\]\\[mindelay\\]").val();
maxmail=$("#plugin\\[sendMailAjax\\]\\[maxemail\\]").val();
*/
dialogName = '#dialogsendmailajax';
contentUrl=$(this).attr('href');
dialogTitle=$(this).text();
if($("#admin-notification-modal").length)// 2.50
......@@ -15,6 +14,7 @@ $(document).on('click','a.popup-sendmailajax',function(event){
$(modal).find('.modal-title').text(dialogTitle);
$(modal).modal('show');
$(modal).find(".modal-body").load(contentUrl);
$(modal).find(".modal-footer").append("<button type='button' class='btn btn-info hidden' data-send='true'>&nbsp;Stop</button>");
$(modal).on('hidden.bs.modal', function (e) {
$(modal).html(originalModalHtml);
})
......@@ -39,16 +39,23 @@ $(document).on('click','a.popup-sendmailajax',function(event){
});
$(document).on('click','a#launch-email',function(event){
var jsonurl=$(this).attr('rel');
$("[data-send]").removeClass("hidden");
$(this).closest('li').text($(this).text());
loopSendEmail(jsonurl,0);
});
$(document).on('click','[data-send]',function(event){
$(this).html("Stopped");
$(this).attr("data-send",'stop');
$(".sendmailajax-list").prepend("<li><strong>Stop</strong></li>");
$(this).addClass('hidden');
});
/*
* Used to update response one by one
* @param {string} jsonurl : The json Url to request
* @param {integer} tokenid : The token id
*/
function loopSendEmail(jsonurl,tokenid) {
if($(".sendmailajax-list").length>0)// Don't send if user click on 'Cancel'
if($(".sendmailajax-list").length>0 && $("[data-send='stop']").length==0)// Don't send if user click on 'Cancel'
{
$.ajax({
url: jsonurl,
......
......@@ -5,7 +5,7 @@
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2015-2016 Denis Chenu <http://sondages.pro>
* @license AGPL v3
* @version 0.2.2
* @version 0.3.2
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment