wip: UI refactoring

* translation files update
* various fixes

see #204
This commit is contained in:
Antoine Nguyen
2012-04-25 16:45:01 +02:00
parent 57572ec19f
commit 14268578ba
33 changed files with 4873 additions and 3746 deletions
+12 -12
View File
@@ -1,34 +1,34 @@
# -*- coding: utf-8 -*-
from modoboa.lib import parameters, events
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext as _, ugettext_lazy
from django.db.utils import DatabaseError
from models import Extension
parameters.register_admin("AUTHENTICATION_TYPE", type="list", deflt="local",
values=[('local', _("Local")),
values=[('local', ugettext_lazy("Local")),
('ldap', "LDAP")],
help=_("The backend used for authentication"))
help=ugettext_lazy("The backend used for authentication"))
parameters.register_admin("CREATE_DIRECTORIES", type="list_yesno", deflt="yes",
help=_("Modoboa will handle mailbox creation on filesystem"))
help=ugettext_lazy("Modoboa will handle mailbox creation on filesystem"))
parameters.register_admin("STORAGE_PATH", type="string", deflt="/var/vmail",
help=_("Path to the root directory where messages are stored"))
help=ugettext_lazy("Path to the root directory where messages are stored"))
parameters.register_admin("VIRTUAL_UID", type="string", deflt="vmail",
help=_("UID of the virtual user which owns domains/mailboxes/messages on the filesystem"))
help=ugettext_lazy("UID of the virtual user which owns domains/mailboxes/messages on the filesystem"))
parameters.register_admin("VIRTUAL_GID", type="string", deflt="vmail",
help=_("GID of the virtual user which owns domains/mailboxes/messages on the filesystem"))
help=ugettext_lazy("GID of the virtual user which owns domains/mailboxes/messages on the filesystem"))
parameters.register_admin("MAILBOX_TYPE", type="list", deflt="maildir",
values=[("maildir", "maildir"), ("mbox", "mbox")],
help=_("Mailboxes storage format"))
help=ugettext_lazy("Mailboxes storage format"))
parameters.register_admin("MAILDIR_ROOT", type="string", deflt=".maildir",
help=_("Sub-directory (inside the mailbox) where messages are stored when using the maildir format"))
help=ugettext_lazy("Sub-directory (inside the mailbox) where messages are stored when using the maildir format"))
parameters.register_admin(
"PASSWORD_SCHEME", type="list", deflt="crypt",
values=[("crypt", "crypt"), ("md5", "md5"), ("sha256", "sha256"), ("clear", "clear")],
help=_("Scheme used to crypt mailbox passwords")
help=ugettext_lazy("Scheme used to crypt mailbox passwords")
)
parameters.register_admin("ITEMS_PER_PAGE", type="int", deflt=30,
help=_("Number of displayed items per page"))
help=ugettext_lazy("Number of displayed items per page"))
def enabled_applications():
"""Return the list of currently enabled extensions
@@ -51,7 +51,7 @@ def enabled_applications():
parameters.register_admin("DEFAULT_TOP_REDIRECTION", type="list", deflt="admin",
app="general",
values=enabled_applications(),
help=_("The default redirection used when no application is specified"))
help=ugettext_lazy("The default redirection used when no application is specified"))
@events.observe("ExtDisabled")
def unset_default_topredirection(extension):
+17 -17
View File
@@ -2,7 +2,7 @@
from django import forms
from django.contrib.auth.models import Group
from modoboa.admin.models import *
from django.utils.translation import ugettext as _, ugettext_noop
from django.utils.translation import ugettext as _, ugettext_lazy
from django.http import QueryDict
from modoboa.admin.templatetags.admin_extras import gender
from modoboa.lib.emailutils import split_mailbox
@@ -12,9 +12,9 @@ from modoboa.lib.permissions import *
class DomainForm(forms.ModelForm, DynamicForm):
aliases = DomainNameField(
label=ugettext_noop("Alias(es)"),
label=ugettext_lazy("Alias(es)"),
required=False,
help_text=ugettext_noop("Alias(es) of this domain")
help_text=ugettext_lazy("Alias(es) of this domain")
)
class Meta:
@@ -102,12 +102,12 @@ class DomainForm(forms.ModelForm, DynamicForm):
class DlistForm(forms.ModelForm, DynamicForm):
email = forms.EmailField(
label=ugettext_noop("Email address"),
help_text=ugettext_noop("")
label=ugettext_lazy("Email address"),
help_text=ugettext_lazy("The distribution list address")
)
recipients = forms.EmailField(
label=ugettext_noop("Recipients"), required=False,
help_text=ugettext_noop("Mailbox(es) this alias will point to")
label=ugettext_lazy("Recipients"), required=False,
help_text=ugettext_lazy("Mailbox(es) this alias will point to")
)
class Meta:
@@ -209,10 +209,10 @@ class ImportDataForm(forms.Form):
return str(self.cleaned_data["sepcar"])
class AccountFormGeneral(forms.ModelForm):
username = forms.CharField(max_length=254)
username = forms.CharField(label=ugettext_lazy("Username"), max_length=254)
role = forms.ChoiceField(
choices=[('', ugettext_noop("Choose"))],
help_text=ugettext_noop("What level of permission this user will have")
choices=[('', ugettext_lazy("Choose"))],
help_text=ugettext_lazy("What level of permission this user will have")
)
class Meta:
@@ -229,7 +229,7 @@ class AccountFormGeneral(forms.ModelForm):
return
self.fields["role"].choices = \
[('', ugettext_noop("Choose"))] + get_account_roles(user)
[('', ugettext_lazy("Choose"))] + get_account_roles(user)
if kwargs.has_key("instance"):
u = kwargs["instance"]
if u.is_superuser:
@@ -263,9 +263,9 @@ class AccountFormGeneral(forms.ModelForm):
class AccountFormGeneralPwd(AccountFormGeneral):
password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
password2 = forms.CharField(
label=ugettext_noop("Confirmation"),
label=ugettext_lazy("Confirmation"),
widget=forms.PasswordInput,
help_text=ugettext_noop("Enter the same password as above, for verification.")
help_text=ugettext_lazy("Enter the same password as above, for verification.")
)
class Meta:
@@ -295,9 +295,9 @@ class AccountFormMail(forms.Form, DynamicForm):
email = forms.EmailField(label=_("E-mail"), required=False)
quota = forms.IntegerField(label=_("Quota"), required=False)
aliases = forms.EmailField(
label=ugettext_noop("Alias(es)"),
label=ugettext_lazy("Alias(es)"),
required=False,
help_text=ugettext_noop("Alias(es) of this mailbox")
help_text=ugettext_lazy("Alias(es) of this mailbox")
)
def __init__(self, *args, **kwargs):
@@ -385,9 +385,9 @@ class AccountFormMail(forms.Form, DynamicForm):
class AccountPermissionsForm(forms.Form, DynamicForm):
domains = DomainNameField(
label=ugettext_noop("Domain(s)"),
label=ugettext_lazy("Domain(s)"),
required=False,
help_text=ugettext_noop("Domain(s) that user administrates")
help_text=ugettext_lazy("Domain(s) that user administrates")
)
def __init__(self, *args, **kwargs):
+22 -22
View File
@@ -3,7 +3,7 @@ from django.db import models, IntegrityError
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User as DUser, UserManager, Group
from django.utils.translation import ugettext as _, ugettext_noop
from django.utils.translation import ugettext as _, ugettext_lazy
from django.utils.crypto import constant_time_compare
from django.conf import settings
from modoboa.lib import parameters, events
@@ -375,11 +375,11 @@ class DatesAware(models.Model):
return self.dates.last_modification
class Domain(DatesAware):
name = models.CharField(ugettext_noop('name'), max_length=100, unique=True,
help_text=ugettext_noop("The domain name"))
quota = models.IntegerField(help_text=ugettext_noop("Default quota in MB applied to mailboxes"))
enabled = models.BooleanField(ugettext_noop('enabled'),
help_text=ugettext_noop("Check to activate this domain"))
name = models.CharField(ugettext_lazy('name'), max_length=100, unique=True,
help_text=ugettext_lazy("The domain name"))
quota = models.IntegerField(help_text=ugettext_lazy("Default quota in MB applied to mailboxes"))
enabled = models.BooleanField(ugettext_lazy('enabled'),
help_text=ugettext_lazy("Check to activate this domain"))
owners = generic.GenericRelation(ObjectAccess)
class Meta:
@@ -452,13 +452,13 @@ class Domain(DatesAware):
self.save()
class DomainAlias(DatesAware):
name = models.CharField(ugettext_noop("name"), max_length=100, unique=True,
help_text=ugettext_noop("The alias name"))
target = models.ForeignKey(Domain, verbose_name=ugettext_noop('target'),
help_text=ugettext_noop("The domain this alias points to"))
name = models.CharField(ugettext_lazy("name"), max_length=100, unique=True,
help_text=ugettext_lazy("The alias name"))
target = models.ForeignKey(Domain, verbose_name=ugettext_lazy('target'),
help_text=ugettext_lazy("The domain this alias points to"))
enabled = models.BooleanField(
ugettext_noop('enabled'),
help_text=ugettext_noop("Check to activate this alias")
ugettext_lazy('enabled'),
help_text=ugettext_lazy("Check to activate this alias")
)
class Meta:
@@ -471,8 +471,8 @@ class DomainAlias(DatesAware):
class Mailbox(DatesAware):
address = models.CharField(
ugettext_noop('address'), max_length=100,
help_text=ugettext_noop("Mailbox address (without the @domain.tld part)")
ugettext_lazy('address'), max_length=100,
help_text=ugettext_lazy("Mailbox address (without the @domain.tld part)")
)
quota = models.IntegerField()
uid = models.IntegerField()
@@ -684,17 +684,17 @@ class Mailbox(DatesAware):
class Alias(DatesAware):
address = models.CharField(
ugettext_noop('address'), max_length=254,
help_text=ugettext_noop("The alias address (without the domain part). For a 'catch-all' address, just enter an * character.")
ugettext_lazy('address'), max_length=254,
help_text=ugettext_lazy("The alias address (without the domain part). For a 'catch-all' address, just enter an * character.")
)
domain = models.ForeignKey(Domain)
mboxes = models.ManyToManyField(
Mailbox, verbose_name=ugettext_noop('mailboxes'),
help_text=ugettext_noop("The mailboxes this alias points to")
Mailbox, verbose_name=ugettext_lazy('mailboxes'),
help_text=ugettext_lazy("The mailboxes this alias points to")
)
extmboxes = models.TextField(blank=True)
enabled = models.BooleanField(ugettext_noop('enabled'),
help_text=ugettext_noop("Check to activate this alias"))
enabled = models.BooleanField(ugettext_lazy('enabled'),
help_text=ugettext_lazy("Check to activate this alias"))
class Meta:
permissions = (
@@ -779,8 +779,8 @@ class Alias(DatesAware):
class Extension(models.Model):
name = models.CharField(max_length=150)
enabled = models.BooleanField(
ugettext_noop('enabled'),
help_text=ugettext_noop("Check to enable this extension")
ugettext_lazy('enabled'),
help_text=ugettext_lazy("Check to enable this extension")
)
def init(self):
+4 -4
View File
@@ -1,6 +1,6 @@
from django import template
from django.template.loader import render_to_string
from django.utils.translation import ugettext as _, ugettext_noop
from django.utils.translation import ugettext as _, ugettext_lazy
from django.core.urlresolvers import reverse
from modoboa import admin
from modoboa.lib import events
@@ -9,7 +9,7 @@ from modoboa.lib.webutils import static_url, render_actions
register = template.Library()
genders = {
"Enabled" : (ugettext_noop("enabled_m"), ugettext_noop("enabled_f"))
"Enabled" : (ugettext_lazy("enabled_m"), ugettext_lazy("enabled_f"))
}
@register.simple_tag
@@ -166,7 +166,7 @@ def param(app, definition):
result = """<div class='control-group'>
<label class="param-label" for="%s">%s</label>
<div class="param-controls">""" \
% (name, definition.has_key("label") and _(definition["label"])
% (name, definition.has_key("label") and _(definition["label"])
or definition["name"])
if definition["type"] in ["string", "int"]:
result += """
@@ -197,7 +197,7 @@ def param(app, definition):
if definition.has_key("help"):
result += """
<p class="help-block">%s</p>
""" % definition["help"]
""" % _(definition["help"])
result += """
</div>
</div>