diff --git a/admin/migrations/0007_auto__alter_full_address.py b/admin/migrations/0007_auto__alter_full_address.py index 04232559c..0a48e2f73 100644 --- a/admin/migrations/0007_auto__alter_full_address.py +++ b/admin/migrations/0007_auto__alter_full_address.py @@ -19,7 +19,7 @@ class Migration(SchemaMigration): 'Meta': {'object_name': 'Alias'}, 'address': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'full_address': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '150'}), + 'full_address': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '254'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'mboxes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['admin.Mailbox']", 'symmetrical': 'False'}) }, diff --git a/admin/models.py b/admin/models.py index c07383ab7..e8458086a 100644 --- a/admin/models.py +++ b/admin/models.py @@ -51,6 +51,20 @@ class Domain(models.Model): % (parameters.get_admin("STORAGE_PATH"), self.name)) + def delete(self, *args, **kwargs): + keepdir = False + if kwargs.has_key("keepdir"): + keepdir = kwargs["keepdir"] + del kwargs["keepdir"] + # Not very optimized but currently, this is the simple way + # I've found to delete all related objects (mailboxes, users + # and aliases)! + for mb in self.mailbox_set.all(): + mb.delete(keepdir=keepdir) + super(Domain, self).delete(*args, **kwargs) + if not keepdir: + self.delete_dir() + def __str__(self): return self.name @@ -74,7 +88,7 @@ class Mailbox(models.Model): gid = models.IntegerField() path = models.CharField(max_length=200) domain = models.ForeignKey(Domain) - user = models.ForeignKey(User) + user = models.OneToOneField(User) path = models.CharField(max_length=255) class Meta: @@ -164,6 +178,20 @@ class Mailbox(models.Model): pass super(Mailbox, self).save(*args, **kwargs) + def delete(self, *args, **kwargs): + keepdir = False + if kwargs.has_key("keepdir"): + keepdir = kwargs["keepdir"] + del kwargs["keepdir"] + for alias in self.alias_set.all(): + alias.mboxes.remove(self) + if len(alias.mboxes.all()) == 0: + alias.delete() + self.user.delete() + super(Mailbox, self).delete(*args, **kwargs) + if not keepdir: + self.delete_dir() + def tohash(self): return { "id" : self.id, diff --git a/admin/templatetags/admin_extras.py b/admin/templatetags/admin_extras.py index be71aff28..9f6596896 100644 --- a/admin/templatetags/admin_extras.py +++ b/admin/templatetags/admin_extras.py @@ -58,40 +58,6 @@ def admin_menu(user): return render_to_string("common/menulist.html", {"entries" : entries, "user" : user}) -@register.simple_tag -def domain_menu(domain_id, selection, user): - entries = [ - {"name" : "", - "url" : reverse(admin.views.newmailbox), - "label" : _("New mailbox"), - "img" : static_url("pics/add.png"), - "class" : "boxed", - "rel" : "{handler:'iframe',size:{x:300,y:280}}"}, - {"name" : "mailboxes", - "url" : reverse(admin.views.mailboxes), - "img" : static_url("pics/mailbox.png"), - "label" : _("Mailboxes")}, - {"name" : "aliases", - "url" : reverse("full-aliases"), - "img" : static_url("/pics/alias.png"), - "label" : _("Aliases")}, - ] - - if user.has_perm("admin.change_domain"): - entries += [ - {"name" : "", - "url" : reverse(admin.views.editdomain, args=[domain_id]), - "label" : _("Properties"), - "img" : static_url("pics/edit.png"), - "class" : "boxed", - "rel" : "{handler:'iframe',size:{x:300,y:180}}"} - ] - entries += events.raiseQueryEvent("AdminMenuDisplay", target="admin_menu_bar", - user=user, domain=domain_id) - return render_to_string('common/menu.html', - {"selection" : selection, "entries" : entries, - "user" : user}) - @register.simple_tag def settings_menu(selection, user): entries = [ @@ -114,13 +80,6 @@ def dommenu_entry(name, label, img, listurl, newurl): "img" : img, "url" : listurl, "class" : "menubardropdown", - "menu" : [{"name" : "%s_new" % name, - "url" : newurl, - "label" : _("New"), - "img" : static_url("pics/add.png"), - "class" : "boxed", - "rel" : "{handler:'iframe',size:{x:300,y:200}}"} - ] } return result @@ -128,6 +87,15 @@ def dommenu_entry(name, label, img, listurl, newurl): def domains_menu(selection, user, domid): args = domid != "" and ("?domid=%s" % domid) or "" entries = [] + entries += [{"name" : "new", + "label" : _("New"), + "img" : static_url("pics/add.png")}, + {"name" : "remove", + "label" : _("Remove"), + "img" : static_url("pics/remove.png") + }] + + entries += [{"separator" : True}] if user.has_perm("admin.view_domains"): entries += dommenu_entry("domains", _("Domains"), static_url("pics/domains.png"), @@ -188,11 +156,6 @@ def domain_actions(user, domid): "title" : _("Edit domain"), "class" : "boxed", "rel" : "{handler:'iframe',size:{x:300,y:180}}"}, - {"name" : "deldomain", - "url" : reverse(admin.views.deldomain, args=[domid]), - "img" : static_url("pics/remove.png"), - "title" : _("Delete domain"), - "confirm" : _("Delete this domain?")}, {"name" : "domaliases", "url" : reverse(admin.views.domaliases) + "?domid=%s" % domid, "img" : static_url("pics/alias.png"), @@ -221,10 +184,6 @@ def mailbox_actions(user, mbox): "title" : _("Edit mailbox"), "class" : "boxed", "rel" : "{handler:'iframe',size:{x:300,y:280}}"}, - {"name" : "deleteMb", - "url" : reverse(admin.views.delmailbox, args=[mbox.id]), - "img" : static_url("pics/remove.png"), - "title" : _("Delete mailbox")}, {"name" : "aliases", "url" : reverse(admin.views.mbaliases) + "?mbid=%d" % mbox.id, "img" : static_url("pics/alias.png"), @@ -240,12 +199,7 @@ def mbalias_actions(user, alias): "img" : static_url("pics/edit.png"), "title" : _("Edit mailbox alias"), "class" : "boxed", - "rel" : "{handler:'iframe',size:{x:300,y:250}}"}, - {"name" : "dembalias", - "url" : reverse(admin.views.delmbalias, args=[alias.id]), - "img" : static_url("pics/remove.png"), - "title" : _("Delete mailbox alias"), - "confirm" : _("Delete this alias?")}, + "rel" : "{handler:'iframe',size:{x:300,y:250}}"} ] return render_actions(actions) diff --git a/admin/urls.py b/admin/urls.py index 6ea81b344..7afac93d8 100644 --- a/admin/urls.py +++ b/admin/urls.py @@ -5,21 +5,22 @@ urlpatterns = patterns('modoboa.admin.views', url(r'^domains/$', 'domains', name="domains"), (r'^domains/new/', 'newdomain'), (r'^domains/(?P\d+)/edit/$', 'editdomain'), - (r'^domains/(?P\d+)/delete/$', 'deldomain'), + (r'^domains/delete/$', 'deldomain'), (r'^domaliases/$', "domaliases"), (r'^domaliases/new/', 'newdomalias'), (r'^domaliases/edit/(?P\d+)/', 'editdomalias'), + (r'^domaliases/delete/$', 'deldomalias'), (r'^mailboxes/$', 'mailboxes'), (r'^mailboxes/new/$', 'newmailbox'), (r'^mailboxes/edit/(?P\d+)/$', 'editmailbox'), - (r'^mailboxes/delete/(?P\d+)/$', 'delmailbox'), + (r'^mailboxes/delete/$', 'delmailbox'), (r'^mbaliases/$', 'mbaliases'), (r'^mbaliases/new/$', 'newmbalias'), (r'^mbaliases/edit/(?P\d+)/$', 'editmbalias'), - (r'^mbaliases/delete/(?P\d+)/$', 'delmbalias'), + (r'^mbaliases/delete/$', 'delmbalias'), (r'^domains/(?P\d+)/raw/$', 'mailboxes_raw'), #url(r'^domains/(?P\d+)/aliases/$', "aliases", name="full-aliases"), diff --git a/admin/views.py b/admin/views.py index db9a50a04..f8cb91b72 100644 --- a/admin/views.py +++ b/admin/views.py @@ -63,8 +63,10 @@ def domains(request): counters = {} for dom in domains: dom.mboxcounter = len(dom.mailbox_set.all()) + deloptions = {"keepdir" : _("Do not delete domain directory")} return render_domains_page(request, "domains", - domains=domains, counter=counters) + domains=domains, counter=counters, + deloptions=deloptions) @login_required def domaliases(request): @@ -137,6 +139,15 @@ def editdomalias(request, alias_id): "form" : form, "domalias" : domalias }) +@login_required +@permission_required("admin.delete_domalias") +def deldomalias(request): + selection = request.GET["selection"].split(",") + DomainAlias.objects.filter(id__in=selection).delete() + messages.info(request, _("Domain alias(es) deleted"), fail_silently=True) + return HttpResponse(simplejson.dumps(_ctx_ok("")), + mimetype="application/json") + @login_required @permission_required("admin.add_domain") def newdomain(request): @@ -200,13 +211,26 @@ def editdomain(request, dom_id): @login_required @permission_required("admin.delete_domain") -def deldomain(request, dom_id): - domain = Domain.objects.get(pk=dom_id) - events.raiseEvent("DeleteDomain", dom=domain) - domain.delete_dir() - domain.delete() - messages.info(request, _("Domain deleted"), fail_silently=True) - return HttpResponseRedirect(reverse(admin.views.domains)) +def deldomain(request): + selection = request.GET["selection"].split(",") + error = None + if request.user.id != 1: + mb = Mailbox.objects.get(user__id=request.user.id) + if dom.id in selection: + error = _("You can't delete your own domain") + if error is None: + if request.GET.has_key("keepdir") and request.GET["keepdir"] == "true": + keepdir = True + else: + keepdir = False + for dom in Domain.objects.filter(id__in=selection): + events.raiseEvent("DeleteDomain", dom=dom) + dom.delete(keepdir=keepdir) + messages.info(request, _("Domain deleted"), fail_silently=True) + ctx = _ctx_ok("") + else: + ctx = getctx("ko", error=error) + return HttpResponse(simplejson.dumps(ctx), mimetype="application/json") @login_required @good_domain @@ -214,12 +238,13 @@ def deldomain(request, dom_id): def mailboxes(request): if request.GET.has_key("domid"): domain = Domain.objects.get(pk=request.GET["domid"]) - mailboxes = Mailbox.objects.filter(domain=domain.id) + mboxes = Mailbox.objects.filter(domain=domain.id) else: - mailboxes = Mailbox.objects.all() + mboxes = Mailbox.objects.all() domain = None + deloptions = {"keepdir" : _("Do not delete mailbox directory")} return render_domains_page(request, "mailboxes", - mailboxes=mailboxes, domain=domain) + mailboxes=mboxes, domain=domain, deloptions=deloptions) @login_required @good_domain @@ -306,18 +331,26 @@ def editmailbox(request, mbox_id=None): @login_required @good_domain @permission_required("admin.delete_mailbox") -def delmailbox(request, mbox_id=None): - mb = Mailbox.objects.get(pk=mbox_id) - if mb.user.id != request.user.id: - events.raiseEvent("DeleteMailbox", mbox=mb) - if not request.GET.has_key("keepdir") or request.GET["keepdir"] != "true": - mb.delete_dir() - mb.user.delete() - mb.delete() +def delmailbox(request): + selection = request.GET["selection"].split(",") + error = None + if not request.user.is_superuser: + mb = Mailbox.objects.get(user__id=request.user.id) + if mb.id in selection: + error = _("You can't delete your own mailbox") + + if error is None: + if request.GET.has_key("keepdir") and request.GET["keepdir"] == "true": + keepdir = True + else: + keepdir = False + for mb in Mailbox.objects.filter(id__in=selection): + events.raiseEvent("DeleteMailbox", mbox=mb) + mb.delete()#keepdir=keepdir) messages.info(request, _("Mailbox deleted"), fail_silently=True) ctx = _ctx_ok("") else: - ctx = getctx("ko", error=_("You can't delete your own mailbox")) + ctx = getctx("ko", error=error) return HttpResponse(simplejson.dumps(ctx), mimetype="application/json") @@ -398,11 +431,12 @@ def editmbalias(request, alias_id): @login_required @good_domain @permission_required("admin.delete_alias") -def delmbalias(request, alias_id): - alias = Alias.objects.get(pk=alias_id) - alias.delete() +def delmbalias(request): + selection = request.GET["selection"].split(",") + Alias.objects.filter(id__in=selection).delete() messages.info(request, _("Alias deleted"), fail_silently=True) - return HttpResponseRedirect(reverse(admin.views.mbaliases)) + return HttpResponse(simplejson.dumps(_ctx_ok("")), + mimetype="application/json") @login_required @permission_required("auth.view_permissions") diff --git a/static/css/box.css b/static/css/box.css index 3c8054731..c4cb0d8e3 100644 --- a/static/css/box.css +++ b/static/css/box.css @@ -104,31 +104,6 @@ td.even { width: 120px; } -/* Dialog box */ -#dlg-buttons { - clear: both; - width: 100%; - text-align: center; - padding-top: 20px; -} - -#dlg-iconbox { - float: left; - margin-top: 20px; - width: 32px; -} - -#dlg-textbox { - float: left; - margin-left: 20px; - margin-top: 10px; - width: 80%; -} - -#dlg-buttons input { - width: 90px; -} - /* Mootools tooltips */ .tip { color: #fff; diff --git a/static/css/default.css b/static/css/default.css index 98769bc9d..1eadb1605 100644 --- a/static/css/default.css +++ b/static/css/default.css @@ -290,15 +290,22 @@ th.right { text-align: right; } +th.center, td.center { + text-align: center; +} + td { border-bottom: 1px solid #C8D6E8; /*padding: 5px;*/ } +tr.table-tr-selected { + background: #ffffcc; +} + input { border: 1px solid #cccccc; color: inherit; - /*background-color: #e9e9e9;*/ background-color: #eee; padding: 2px; } @@ -389,3 +396,49 @@ div.row label { display: inline; color: red; } + +.separator { + padding-left: 5px; + padding-right: 5px; +} + +/* Custom confirmation box */ +#dlg-buttons { + clear: both; + width: 100%; + text-align: center; + padding-top: 20px; +} + +#dlg-iconbox { + float: left; + margin-top: 20px; + width: 32px; +} + +#dlg-textbox { + float: left; + margin-left: 20px; + margin-top: 10px; + width: 80%; +} + +#dlg-textbox input { + float: left; + padding: 0; + margin: 0; +} + +#dlg-textbox label { + margin-left: 5px; +} + +#dlg-buttons { + position: absolute; + bottom: 15px; +} + +#dlg-buttons input { + width: 90px; + margin: 2px; +} diff --git a/static/js/common.js b/static/js/common.js index 95a5e4eb3..8da1d2f86 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -193,7 +193,6 @@ parse_menubar = function(id) { }); myFx.wrapper.setStyles({ - /*"clear" : "both",*/ "position" : "absolute" }); myFx.hide(); @@ -235,43 +234,6 @@ get_iframe_body = function(id) { return (data); }; -confirmation = function(question, action, callback) { - SqueezeBox.initialize({ - size: {x: 350, y: 140}, - handler: 'iframe', - onClose: function(content) { - var ibody = get_iframe_body(this.asset); - var elt = ibody.getElement("input[name=result]"); - - if (elt.get("value") == "ok") { - var params = ""; - if (typeof callback != "undefined") { - params = callback(ibody); - } - new Request.JSON({ - method: "get", - url: action.get("href"), - onSuccess: function(res) { - if (res.status == "ok") { - window.location.reload(); - } else { - infobox.error(res.error); - infobox.hide(2); - } - } - }).send(params); - } - } - }); - - /* FIXME: avoid using a hard coded address like this, maybe it - could be fixed by creating a new class for "confirmation" and - create one instance for each section/page using it (I mean - directly inside the html template) */ - - SqueezeBox.open("/modoboa/userprefs/confirm/?question=" + question); -}; - setDivHeight = function(id, extrah, modulo) { var contentsize = $(document.body).getSize().y - $("topmenubar").getSize().y @@ -286,7 +248,7 @@ setDivHeight = function(id, extrah, modulo) { }; bindRows = function(rooturl, page) { - $$("tr").addEvent("click", function(event) { + $$("tr").addEvent("dblclick", function(event) { if (event.target.parentNode.id) { var url = rooturl + "?domid=" + event.target.parentNode.id; if (page != "") { diff --git a/static/js/confirmation.js b/static/js/confirmation.js new file mode 100644 index 000000000..b4c9d491b --- /dev/null +++ b/static/js/confirmation.js @@ -0,0 +1,91 @@ +var Confirmation = new Class({ + Implements: [Options, Events], + options: { + checkboxes: [] + }, + + build_checkboxes: function() { + var result = ""; + var cbhash = new Hash(this.options.checkboxes); + + cbhash.each(function(value, key, hash) { + result += ""; + result += ""; + }); + return result; + }, + + initialize: function(url, urlparams, question, options) { + this.setOptions(options); + Confirmation.url = url; + Confirmation.urlparams = urlparams; + + var content = new Element("div", {id: "confirmbox"}); + var icondiv = new Element("div", { + id: "dlg-iconbox", + html: "Warning" + }).inject(content); + + this.textdiv = new Element("div", { + id: "dlg-textbox", + html: "" + question + "" + + "

" + this.build_checkboxes() + "

" + }).inject(content); + + var buttonsdiv = new Element("div", { + id: "dlg-buttons" + }).inject(content); + new Element("input", {type: "button", name: "ok", id: "ok", value: "Ok"}) + .addEvent("click", this.ok_handler) + .inject(buttonsdiv); + new Element("input", {type: "button", name: "cancel", value: "Cancel"}) + .addEvent("click", this.cancel_handler) + .inject(buttonsdiv); + + new Element("input", {type: "hidden", name: "result", id: "result", value: "cancel"}) + .inject(content); + + SqueezeBox.initialize({ + size: {x: 350, y: 140}, + handler: "adopt", + onClose: this.close_handler + }); + SqueezeBox.open(content); + }, + + close_handler: function(content) { + var result = $("confirmbox").getElement("input[name=result]"); + if (result.get("value") != "ok") { + return; + } + + var params = Confirmation.urlparams; + $$("input[type=checkbox]:checked").each(function(item) { + if (params != "") { + params += "&"; + } + params += item.get("name") + "=true"; + }); + new Request.JSON({ + method: "get", + url: Confirmation.url, + onSuccess: function(res) { + if (res.status == "ok") { + window.location.reload(); + } else { + infobox.error(res.error); + infobox.hide(2); + } + } + }).send(params); + }, + + ok_handler: function(evt) { + $("result").value = "ok"; + parent.SqueezeBox.close(); + }, + + cancel_handler: function(evt) { + parent.SqueezeBox.close(); + } +}); \ No newline at end of file diff --git a/static/js/domains.js b/static/js/domains.js index 5f0a92d13..e7d7a59ae 100644 --- a/static/js/domains.js +++ b/static/js/domains.js @@ -1,4 +1,3 @@ - window.addEvent('domready', function() { var handlers = new Array(); @@ -19,28 +18,12 @@ window.addEvent('domready', function() { event.stop(); }); - if ($$("a[name=deleteMb]")) - $$("a[name=deleteMb]").addEvent('click', function(event) { - event.stop(); - confirmation(gettext("Delete this mailbox?"), this, function(body) { - var result = ""; - body.getElements("input[type=checkbox]:checked").each(function(obj) { - if (result != "") { - result += "&"; - } - result += obj.name + "=true"; - }); - return result; - }); - }); - if ($$("a[name=deleteAlias]")) $$("a[name=deleteAlias]").addEvent('click', function(event) { if (!confirm(gettext("Delete this alias?"))) event.stop(); }); - $(document.body).addEvent('click', function(event) { var target = event.target; if (target.get('tag') == 'a') { @@ -68,18 +51,12 @@ window.addEvent('domready', function() { } }); setDivHeight("content", 20, 0); + + objtable = new HtmlTable($("objects_table"), { + selectable: true + }); }); -newdom = function() { - form = $("form[name=newdom]"); - var params = obj.toQueryString(); - form.set('send', { - onSuccess: function(response) { - SqueezeBox.loadModal(obj.action + '?' + params); - } - }).send(); -}; - loadPage = function(url, destination, callback) { destination = (destination == null) ? "page" : destination; diff --git a/templates/admin/aliases.html b/templates/admin/aliases.html deleted file mode 100644 index 0ff7e3fff..000000000 --- a/templates/admin/aliases.html +++ /dev/null @@ -1,42 +0,0 @@ -{% extends "admin/domain_header.html" %} -{% block menu %} -{% load admin_extras %} -{% domain_menu domain.id "aliases" user %} -{% endblock %} -{% block domcontent %} -{% load i18n %} -{% if not aliases %} -

{% trans "No alias defined." %}

-{% else %} - - - - - - - -{% for alias in aliases %} - - - - - -{% endfor %} -
{% trans "Actions" %}{% trans "Address" %}{% trans "Mailbox" %}{% trans "Enabled" %}
- {% url admin.views.editalias domain.id alias.id as edit_url %} - - - - {% url admin.views.delalias domain.id alias.id as del_url %} - - - - {{ alias.full_address }} - {% for mb in alias.mboxes.all %} - {{ mb.full_address }}
- {% endfor %} -
{{ alias.enabled|yesno }}
-{% endif %} -{% endblock %} diff --git a/templates/admin/domain_header.html b/templates/admin/domain_header.html deleted file mode 100644 index d76a554a3..000000000 --- a/templates/admin/domain_header.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "nlayout.html" %} -{% load i18n libextras %} -{% block html_head %} - -{% endblock %} -{% block middletitle %}{% trans "Domain" %} {{ domain.name }}{% endblock %} -{% block content %} -{% if messages %} -{% display_messages messages %} -{% endif %} -
-{% block domcontent %}{% endblock %} -
-{% endblock %} diff --git a/templates/admin/domains.html b/templates/admin/domains.html index eb716b7de..2e2151a4a 100644 --- a/templates/admin/domains.html +++ b/templates/admin/domains.html @@ -11,11 +11,12 @@ {% endblock %} {% block middletitle %}{% trans "Available domains" %}{% endblock %} {% block subcontent %} +
{% if not domains %}
{% trans "No domain defined." %}
{% else %} - +
- + @@ -23,7 +24,7 @@ {% for dom in domains %} - + @@ -32,4 +33,5 @@ {% endfor %}
{% trans "Actions" %}{% trans "Actions" %} {% trans "Name" %} {% trans "Mailboxes" %} {% trans "Quota" %}
{% domain_actions user dom.id %}{% domain_actions user dom.id %} {{ dom.name }} {{ dom.mboxcounter }} {{ dom.quota }} {% trans "MB" %}
{% endif %} +
{% endblock %} diff --git a/templates/admin/domains_header.html b/templates/admin/domains_header.html index d797f377c..0b5baafe3 100644 --- a/templates/admin/domains_header.html +++ b/templates/admin/domains_header.html @@ -2,6 +2,44 @@ {% load i18n admin_extras libextras %} {% block html_head %} + + {% endblock %} {% block middletitle %} {% block pagetitle %}{% endblock %}{% if domain %} ({% trans "for" %} {{ domain.name }}){% endif %} diff --git a/templates/admin/domaliases.html b/templates/admin/domaliases.html index e3dcef78a..46dd758c7 100644 --- a/templates/admin/domaliases.html +++ b/templates/admin/domaliases.html @@ -2,10 +2,11 @@ {% load i18n admin_extras libextras %} {% block pagetitle %}{% trans "Domain aliases" %}{% endblock %} {% block subcontent %} +
{% if not domaliases %}
{% trans "No domain alias defined." %}
{% else %} - +
@@ -13,7 +14,7 @@ {% for domalias in domaliases %} - + @@ -22,4 +23,5 @@ {% endfor %}
{% trans "Actions" %} {% trans "Name" %}{% trans "Enabled" %}
{% domalias_actions user domalias.id %} {{ domalias.name }} {{ domalias.target.name }}
{% endif %} +
{% endblock %} diff --git a/templates/admin/layout.html b/templates/admin/layout.html deleted file mode 100644 index b63af4b4f..000000000 --- a/templates/admin/layout.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "nlayout.html" %} -{% block content %} -{% load i18n %} -
-
- {%block mainframe %}{% endblock %} -
-
-{% endblock %} diff --git a/templates/admin/mailboxes.html b/templates/admin/mailboxes.html index 02699541c..cacaa48c9 100644 --- a/templates/admin/mailboxes.html +++ b/templates/admin/mailboxes.html @@ -2,26 +2,28 @@ {% load i18n admin_extras %} {% block pagetitle %}{% trans "Available mailboxes" %}{% endblock %} {% block subcontent %} -{% if not mailboxes %} -
{% trans "No mailbox defined." %}
-{% else %} - - - - - - - - - {% for mb in mailboxes %} - - - - - - - - {% endfor %} -
{% trans "Actions" %}{% trans "Name" %}{% trans "Address" %}{% trans "Quota" %}{{ "Enabled"|gender:"f" }}
{% mailbox_actions user mb %}{{ mb.name }}{{ mb.address }}@{{ mb.domain.name }}{{ mb.quota }} {% trans "MB" %}{{ mb.user.is_active|yesno:_("yes,no") }}
-{% endif %} +
+ {% if not mailboxes %} +
{% trans "No mailbox defined." %}
+ {% else %} + + + + + + + + + {% for mb in mailboxes %} + + + + + + + + {% endfor %} +
{% trans "Actions" %}{% trans "Name" %}{% trans "Address" %}{% trans "Quota" %}{{ "Enabled"|gender:"f" }}
{% mailbox_actions user mb %}{{ mb.name }}{{ mb.address }}@{{ mb.domain.name }}{{ mb.quota }} {% trans "MB" %}{{ mb.user.is_active|yesno:_("yes,no") }}
+ {% endif %} +
{% endblock %} diff --git a/templates/admin/mbaliases.html b/templates/admin/mbaliases.html index 637cdfd8f..51038ab63 100644 --- a/templates/admin/mbaliases.html +++ b/templates/admin/mbaliases.html @@ -2,28 +2,30 @@ {% load i18n admin_extras %} {% block pagetitle %}{% trans "Mailbox aliases" %}{% endblock %} {% block subcontent %} -{% if not aliases %} -
{% trans "No mailbox alias defined." %}
-{% else %} - - - - - - - -{% for alias in aliases %} - - - - -{% endfor %} -
{% trans "Actions" %}{% trans "Address" %}{% trans "Mailbox" %}{% trans "Enabled" %}
{% mbalias_actions user alias %} - {{ alias.full_address }} - {% for mb in alias.mboxes.all %} - {{ mb.full_address }}
- {% endfor %} -
{{ alias.enabled|yesno }}
-{% endif %} +
+ {% if not aliases %} +
{% trans "No mailbox alias defined." %}
+ {% else %} + + + + + + + + {% for alias in aliases %} + + + + + + {% endfor %} +
{% trans "Actions" %}{% trans "Address" %}{% trans "Mailbox" %}{% trans "Enabled" %}
{% mbalias_actions user alias %} + {{ alias.full_address }} + {% for mb in alias.mboxes.all %} + {{ mb.full_address }}
+ {% endfor %} +
{{ alias.enabled|yesno }}
+ {% endif %} +
{% endblock %} diff --git a/templates/common/menulist.html b/templates/common/menulist.html index b54140cee..aeeb76b43 100644 --- a/templates/common/menulist.html +++ b/templates/common/menulist.html @@ -1,5 +1,8 @@ {% load i18n %} {% for entry in entries %} + {% if entry.separator %} +
  •  
  • + {% else %} {% if entry.menu %} + {% endif %} {% endif %} {% endfor %} diff --git a/templates/userprefs/confirm.html b/templates/userprefs/confirm.html deleted file mode 100644 index a605f1cde..000000000 --- a/templates/userprefs/confirm.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends "layout_simple.html" %} -{% block html_head %} - -{% endblock %} -{% block content %} -{% load i18n %} - -
    - Warning -
    -
    - {{ msg }}
    -

    - {% trans "Do not delete mailbox directory" %} -

    -
    - -
    - - -
    - -{% endblock %} - diff --git a/userprefs/urls.py b/userprefs/urls.py index 89f3bb74a..06bde3ff4 100644 --- a/userprefs/urls.py +++ b/userprefs/urls.py @@ -5,5 +5,4 @@ urlpatterns = patterns('modoboa.userprefs.views', (r'^preferences/$', 'preferences'), (r'^preferences/save/$', 'savepreferences'), (r'^changepassword/$', 'changepassword'), - (r'^confirm/$', 'confirm'), ) diff --git a/userprefs/views.py b/userprefs/views.py index 926f46bd8..af87f57d7 100644 --- a/userprefs/views.py +++ b/userprefs/views.py @@ -1,10 +1,6 @@ import copy -from django.shortcuts import get_object_or_404, render_to_response -from django.template.loader import render_to_string -from django.template import RequestContext from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect -from django.contrib.auth.forms import PasswordChangeForm from django.contrib.auth.decorators \ import login_required from django.utils import simplejson @@ -77,9 +73,3 @@ def savepreferences(request): ctx = getctx("ok") return HttpResponse(simplejson.dumps(ctx), mimetype="application/json") -@login_required -def confirm(request): - return _render(request, 'userprefs/confirm.html', { - "msg" : request.GET["question"] - }) -