mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-21 06:18:45 +02:00
New event 'AdminMenuDisplay' with targets:
* admin_user_box for left menu box * admin_user_bar for admin menubar (inside mailboxes and aliases)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
from django import template
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from mailng import admin
|
||||
from mailng.lib import events
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@@ -10,9 +13,35 @@ genders = {
|
||||
|
||||
@register.simple_tag
|
||||
def domain_menu(domain_id, selection, perms):
|
||||
return render_to_string('admin/domain_menu.html',
|
||||
{"selection" : selection,
|
||||
"domain_id" : domain_id,
|
||||
entries = [
|
||||
{"name" : "",
|
||||
"url" : reverse(admin.views.newmailbox, args=[domain_id]),
|
||||
"label" : _("New mailbox"),
|
||||
"img" : "/static/pics/add.png",
|
||||
"class" : "boxed",
|
||||
"rel" : "{handler:'iframe',size:{x:300,y:280}}"},
|
||||
{"name" : "mailboxes",
|
||||
"url" : reverse(admin.views.mailboxes, args=[domain_id]),
|
||||
"img" : "/static/pics/mailbox.png",
|
||||
"label" : _("Mailboxes")},
|
||||
{"name" : "aliases",
|
||||
"url" : reverse("full-aliases", args=[domain_id]),
|
||||
"img" : "/static/pics/alias.png",
|
||||
"label" : _("Aliases")},
|
||||
]
|
||||
|
||||
if perms.user.has_perm("admin.change_domain"):
|
||||
entries += [
|
||||
{"name" : "",
|
||||
"url" : reverse(admin.views.editdomain, args=[domain_id]),
|
||||
"label" : _("Properties"),
|
||||
"img" : "/static/pics/edit.png",
|
||||
"class" : "boxed",
|
||||
"rel" : "{handler:'iframe',size:{x:300,y:180}}"}
|
||||
]
|
||||
entries += events.raiseQueryEvent("AdminMenuDisplay", target="admin_menu_bar")
|
||||
return render_to_string('main/menu.html',
|
||||
{"selection" : selection, "entries" : entries,
|
||||
"perms" : perms})
|
||||
|
||||
@register.simple_tag
|
||||
|
||||
Reference in New Issue
Block a user