mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
@@ -5,6 +5,7 @@ Admin extension tags.
|
||||
from django import template
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
||||
|
||||
from modoboa.lib import events
|
||||
@@ -192,7 +193,7 @@ def identity_actions(user, ident):
|
||||
return render_actions(actions)
|
||||
|
||||
|
||||
@register.assignment_tag
|
||||
@register.simple_tag
|
||||
def check_identity_status(identity):
|
||||
"""Check if identity is enabled or not."""
|
||||
if identity.__class__.__name__ == "User":
|
||||
@@ -232,7 +233,7 @@ def domain_aliases(domain):
|
||||
res = ''
|
||||
for alias in domain.aliases.all():
|
||||
res += '%s<br/>' % alias.name
|
||||
return res
|
||||
return mark_safe(res)
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
@@ -283,4 +284,4 @@ def get_extra_admin_content(user, target, currentpage):
|
||||
res = events.raiseQueryEvent(
|
||||
"ExtraAdminContent", user, target, currentpage
|
||||
)
|
||||
return "".join(res)
|
||||
return mark_safe("".join(res))
|
||||
|
||||
@@ -7,6 +7,7 @@ from django.contrib.sessions.models import Session
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils import timezone
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from modoboa.lib import events
|
||||
@@ -149,11 +150,12 @@ def visirule(field):
|
||||
field.html_name not in field.form.visirules:
|
||||
return ""
|
||||
rule = field.form.visirules[field.html_name]
|
||||
return " data-visibility-field='%s' data-visibility-value='%s' " \
|
||||
% (rule["field"], rule["value"])
|
||||
return mark_safe(
|
||||
" data-visibility-field='{}' data-visibility-value='{}' "
|
||||
.format(rule["field"], rule["value"]))
|
||||
|
||||
|
||||
@register.assignment_tag
|
||||
@register.simple_tag
|
||||
def get_version():
|
||||
import pkg_resources
|
||||
return pkg_resources.get_distribution("modoboa").version
|
||||
@@ -234,10 +236,10 @@ def display_messages(msgs):
|
||||
else:
|
||||
timeout = "undefined"
|
||||
|
||||
return """
|
||||
return mark_safe("""
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('body').notify('%s', '%s', %s);
|
||||
});
|
||||
</script>
|
||||
""" % (level, text, timeout)
|
||||
""" % (level, text, timeout))
|
||||
|
||||
Reference in New Issue
Block a user