mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-19 05:58:34 +02:00
+5
-5
@@ -2,7 +2,7 @@
|
||||
import os
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from modoboa.lib.webutils import ajax_response
|
||||
from modoboa.lib.webutils import ajax_simple_response
|
||||
from modoboa.lib.emailutils import sendmail_simple, sendmail_fromfile
|
||||
from modoboa.lib.decorators import needs_mailbox
|
||||
|
||||
@@ -13,8 +13,8 @@ def send_virus(request):
|
||||
os.path.join(settings.MODOBOA_DIR,
|
||||
"tmp/virus.msg"))
|
||||
if status:
|
||||
return ajax_response(request)
|
||||
return ajax_response(request, "ko", respmsg=error)
|
||||
return ajax_simple_response(dict(status="ok", respmsg=_("Message sent")))
|
||||
return ajax_simple_response(dict(status="ko", respmsg=error))
|
||||
|
||||
@login_required
|
||||
@needs_mailbox()
|
||||
@@ -37,5 +37,5 @@ XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
|
||||
You should send this test mail from an account outside of your network.
|
||||
""")
|
||||
if status:
|
||||
return ajax_response(request)
|
||||
return ajax_response(request, "ko", respmsg=error)
|
||||
return ajax_simple_response(dict(status="ok", respmsg=_("Message sent"))
|
||||
return ajax_simple_response(dict(status="ko", respmsg=error))
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
$(document).ready(function() {
|
||||
$(document).on('click', 'a[data-toggle="ajaxmodal"]', modalbox);
|
||||
$(document).on('click', 'a[data-toggle="ajaxmodal-autowidth"]', modalbox_autowidth);
|
||||
$(document).on('click', 'a[name=sendspam]', simple_ajax_request);
|
||||
$(document).on('click', 'a[name=sendvirus]', simple_ajax_request);
|
||||
|
||||
//parse_menubar('#topmenubar');
|
||||
//parse_menubar('#menubar');
|
||||
|
||||
@@ -201,4 +201,23 @@ function chpasswordform_cb() {
|
||||
error_cb: chpasswordform_cb
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a simple AJAX request.
|
||||
*/
|
||||
function simple_ajax_request(e) {
|
||||
var $this = $(this);
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: $this.attr("herf"),
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
if (data.status == "ok") {
|
||||
$("body").notify("success", data.respmsg, 2000);
|
||||
} else {
|
||||
$("body").notify("error", data.respmsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user