diff --git a/admin/views.py b/admin/views.py index 942e22059..f40d27c40 100644 --- a/admin/views.py +++ b/admin/views.py @@ -76,7 +76,8 @@ def newdomain(request): events.raiseEvent("CreateDomain", user, domain) commonctx = {"title" : _("New domain"), - "submit_label" : _("Create"), + "action_label" : _("Create"), + "action_classes" : "submit", "action" : reverse(newdomain), "formid" : "domform"} if request.method == "POST": @@ -96,7 +97,8 @@ def editdomain(request, dom_id, tplname="admin/domainform.html"): raise PermDeniedException(_("You can't edit this domain")) commonctx = {"title" : _("Domain editing"), - "submit_label" : _("Update"), + "action_label" : _("Update"), + "action_classes" : "submit", "action" : reverse(editdomain, args=[dom_id]), "formid" : "domform"} if request.method == "POST": @@ -186,7 +188,8 @@ def _validate_dlist(request, form, successmsg, tplname, commonctx, callback=None def newdlist(request, tplname="common/generic_modal_form.html"): events.raiseEvent("CanCreate", request.user, "mailbox_aliases") commonctx = {"title" : _("New distribution list"), - "submit_label" : _("Create"), + "action_label" : _("Create"), + "action_classes" : "submit", "action" : reverse(newdlist), "formid" : "dlistform"} @@ -210,7 +213,8 @@ def editdlist(request, dlist_id, tplname="admin/dlistform.html"): if not request.user.is_owner(dlist.domain): raise PermDeniedException(_("You do not have access to this domain")) commonctx = {"title" : dlist.full_address, - "submit_label" : _("Update"), + "action_label" : _("Update"), + "action_classes" : "submit", "action" : reverse(editdlist, args=[dlist.id]), "formid" : "dlistform"} if request.method == "POST": @@ -521,7 +525,8 @@ def import_identities(request): ctx = dict( title=_("Import identities"), - submit_label=_("Import"), + action_label=_("Import"), + action_classes="submit", action=reverse(import_identities), formid="importform", enctype="multipart/form-data", @@ -538,7 +543,8 @@ def import_domains(request): ctx = dict( title=_("Import domains"), - submit_label=_("Import"), + action_label=_("Import"), + action_classes="submit", action=reverse(import_domains), formid="importform", enctype="multipart/form-data", diff --git a/extensions/amavis_quarantine/sql_listing.py b/extensions/amavis_quarantine/sql_listing.py index 6086d7452..414b04862 100644 --- a/extensions/amavis_quarantine/sql_listing.py +++ b/extensions/amavis_quarantine/sql_listing.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# coding: utf-8 from datetime import datetime from django.utils.translation import ugettext as _, ugettext_noop @@ -11,6 +11,7 @@ from models import * class Qtable(tables.Table): tableid = "emails" + styles = "table-condensed" idkey = "mailid" type = tables.Column("type", align="center", width="30px", @@ -81,7 +82,6 @@ class SQLlisting(EmailListing): deflocation = "listing/" defcallback = "updatelisting" reset_wm_url = True - table_styles = "table-condensed" def __init__(self, user, msgs, filter, **kwargs): if user.group == 'SimpleUsers': diff --git a/extensions/amavis_quarantine/views.py b/extensions/amavis_quarantine/views.py index a48973905..1bdd586d0 100644 --- a/extensions/amavis_quarantine/views.py +++ b/extensions/amavis_quarantine/views.py @@ -94,7 +94,7 @@ def _listing(request): return empty_quarantine(request) content = lst.fetch(request, page.id_start, page.id_stop) - navbar = lst.render_navbar(page, "listing/") + navbar = lst.render_navbar(page, "listing/?") ctx = getctx("ok", listing=content, navbar=navbar, menu=quar_menu("", request.user)) return HttpResponse(simplejson.dumps(ctx), mimetype="application/json") diff --git a/extensions/webmail/exceptions.py b/extensions/webmail/exceptions.py index f05766371..60514abfa 100644 --- a/extensions/webmail/exceptions.py +++ b/extensions/webmail/exceptions.py @@ -5,8 +5,10 @@ """ import re +from django.utils.translation import ugettext as _ +from modoboa.lib.exceptions import ModoboaException -class WebmailError(Exception): +class WebmailError(ModoboaException): errorexpr = re.compile("\[([^\]]+)\]\s*([^\.]+)") def __init__(self, reason, ajax=False): @@ -20,7 +22,7 @@ class WebmailError(Exception): def __str__(self): return self.reason -class ImapError(Exception): +class ImapError(ModoboaException): def __init__(self, reason): self.reason = reason diff --git a/extensions/webmail/forms.py b/extensions/webmail/forms.py index a1ec4f000..b00ae102e 100644 --- a/extensions/webmail/forms.py +++ b/extensions/webmail/forms.py @@ -3,11 +3,11 @@ from django.utils.translation import ugettext_noop as _ 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) + to = forms.CharField(label=_("To")) + cc = forms.CharField(label=_("Cc"), required=False) subject = forms.CharField(label=_("Subject"), max_length=255, required=False) - origmsgid = forms.CharField(widget=forms.HiddenInput(), required=False) + origmsgid = forms.CharField(label="", widget=forms.HiddenInput(), required=False) class FolderForm(forms.Form): name = forms.CharField() diff --git a/extensions/webmail/imaputils.py b/extensions/webmail/imaputils.py index ab74df89d..dd9839511 100644 --- a/extensions/webmail/imaputils.py +++ b/extensions/webmail/imaputils.py @@ -135,7 +135,7 @@ class IMAPconnector(object): if not status: raise Exception(msg) - def _cmd(self, name, *args): + def _cmd(self, name, *args, **kwargs): """IMAP command wrapper To simplify errors handling, this wrapper calls the @@ -166,9 +166,16 @@ class IMAPconnector(object): raise ImapError(e) if typ == "NO": raise ImapError(data) - if not name in self.m.untagged_responses: - return None - return self.m.untagged_responses.pop(name) + if not kwargs.has_key('responses'): + if not name in self.m.untagged_responses: + return None + return self.m.untagged_responses.pop(name) + res = [] + for r in kwargs['responses']: + if not r in self.m.untagged_responses: + return None + res.append(self.m.untagged_responses.pop(r)) + return res def __find_content_in_bodystruct(self, bodystruct, mtype, stype, prefix=""): """Retrieve the number (index) of a specific part @@ -358,7 +365,6 @@ class IMAPconnector(object): if r'\HasChildren' in flags: descr["path"] = name descr["sub"] = [] - descr["class"] = "subfolders" result += [descr] from operator import itemgetter return sorted(result, key=itemgetter("name")) @@ -411,7 +417,7 @@ class IMAPconnector(object): """ self._add_flag(mbox, msgset, r'(\Seen)') - def msgforwarded(self, mailbox, mailid): + def msg_forwarded(self, mailbox, mailid): self._add_flag(mailbox, mailid, '($Forwarded)') def msg_answered(self, mailbox, mailid): @@ -475,7 +481,8 @@ class IMAPconnector(object): self.quota_limit = self.quota_actual = None return - data = self._cmd("GETQUOTAROOT", self._encodefolder(mailbox)) + data = self._cmd("GETQUOTAROOT", self._encodefolder(mailbox), + responses=["QUOTAROOT", "QUOTA"]) if data is None: self.quota_limit = self.quota_actual = None return diff --git a/extensions/webmail/lib.py b/extensions/webmail/lib.py index 2b9556049..c7d0f523d 100644 --- a/extensions/webmail/lib.py +++ b/extensions/webmail/lib.py @@ -26,15 +26,18 @@ from exceptions import * class WMtable(tables.Table): tableid = "emails" + styles = "table-condensed" idkey = "imapid" - select = tables.ImgColumn("select", cssclass="draggable left", width="1%", - defvalue="%spics/grippy.png" % settings.MEDIA_URL, - header="") + select = tables.ImgColumn( + "select", cssclass="draggable left", width="1%", + defvalue="%spics/grippy.png" % settings.MEDIA_URL, + header="" + ) flags = tables.ImgColumn("flags", width="2%") withatts = tables.ImgColumn("withatts", width="2%") - subject = tables.Column("subject", label=__("Subject"), width="50%") - from_ = tables.Column("from", width="20%", label=__("From")) - date = tables.Column("date", width="20%", label=__("Date")) + subject = tables.Column("subject", label=__("Subject"), width="50%", limit=60) + from_ = tables.Column("from", width="20%", label=__("From"), limit=30) + date = tables.Column("date", width="10%", label=__("Date")) cols_order = ["select", "withatts", "flags", "subject", "from_", "date"] diff --git a/extensions/webmail/templates/webmail/attachments.html b/extensions/webmail/templates/webmail/attachments.html index 34b2a3d9f..2cbdaa4e0 100644 --- a/extensions/webmail/templates/webmail/attachments.html +++ b/extensions/webmail/templates/webmail/attachments.html @@ -1,115 +1,24 @@ -{% extends "layout_simple.html" %} +{% extends "common/generic_modal_form.html" %} {% load i18n %} -{% block html_head %} - - - -{% endblock %} -{% block content %} -

{% trans "Attachments" %}

-
{{ error }}
-
- {% include "common/genericform.html" %} -
- -
-
+{% block modalbody %} +{{ block.super }} +
+ +
-
+
{% for att in attachments %} -
+
- +
{% endfor %}
-
- -
{% endblock %} diff --git a/extensions/webmail/templates/webmail/compose.html b/extensions/webmail/templates/webmail/compose.html index 5284049c4..177cee21e 100644 --- a/extensions/webmail/templates/webmail/compose.html +++ b/extensions/webmail/templates/webmail/compose.html @@ -1,7 +1,7 @@ {% load i18n libextras %} -
+
-
+
{% render_form form %}
@@ -14,7 +14,7 @@
-
+
{% if body %}