mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-25 05:58:42 +01:00
Merge with mainline
This commit is contained in:
@@ -5,7 +5,7 @@ class ComposeMailForm(forms.Form):
|
||||
from_ = forms.CharField(label=_("From"))
|
||||
to = forms.CharField(label=_("To"), widget=forms.Textarea())
|
||||
cc = forms.CharField(label=_("Cc"), widget=forms.Textarea(), required=False)
|
||||
subject = forms.CharField(label=_("Subject"), max_length=255)
|
||||
subject = forms.CharField(label=_("Subject"), max_length=255, required=False)
|
||||
|
||||
class FolderForm(forms.Form):
|
||||
name = forms.CharField()
|
||||
|
||||
@@ -542,7 +542,7 @@ def send_mail(request, origmsg=None, posturl=None):
|
||||
"""
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from forms import ComposeMailForm
|
||||
from modoboa.lib.webutils import getctx, ajax_simple_response
|
||||
from modoboa.lib.webutils import getctx, ajax_simple_response, _render_to_string
|
||||
from modoboa.auth.lib import get_password
|
||||
|
||||
form = ComposeMailForm(request.POST)
|
||||
@@ -623,13 +623,13 @@ def send_mail(request, origmsg=None, posturl=None):
|
||||
del request.session["compose_mail"]
|
||||
return True, ajax_simple_response(getctx("ok", url=get_current_url(request)))
|
||||
|
||||
|
||||
listing = render_to_string("webmail/compose.html",
|
||||
{"form" : form,
|
||||
listing = _render_to_string(request, "webmail/compose.html",
|
||||
{"form" : form, "noerrors" : True,
|
||||
"body" : request.POST["id_body"].strip(),
|
||||
"posturl" : posturl})
|
||||
error = _("Red fields are mandatories")
|
||||
return False, ajax_simple_response(
|
||||
getctx("ko", level=2, listing=listing, editor=editormode)
|
||||
getctx("ko", level=2, respmsg=error, listing=listing, editor=editormode)
|
||||
)
|
||||
|
||||
class AttachmentUploadHandler(FileUploadHandler):
|
||||
|
||||
@@ -762,6 +762,8 @@ function sendmail_callback(evt) {
|
||||
current_anchor.get_callback("compose")(resp);
|
||||
if ($defined(resp.respmsg)) {
|
||||
infobox.error(resp.respmsg);
|
||||
} else {
|
||||
infobox.hide();
|
||||
}
|
||||
enable_link(this, sendmail_callback);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user