mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
@@ -724,7 +724,11 @@ class Mailbox(DatesAware):
|
||||
else:
|
||||
self.quota = value
|
||||
|
||||
def get_cur_quota(self):
|
||||
def get_quota(self):
|
||||
q = Quota.objects.get(username=self.full_address)
|
||||
return int(q.bytes / 1048576)
|
||||
|
||||
def get_quota_in_percent(self):
|
||||
if not self.quota:
|
||||
return 0
|
||||
q = Quota.objects.get(username=self.full_address)
|
||||
|
||||
@@ -10,6 +10,7 @@ span.title {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
table th#quotabar,
|
||||
table th#actions {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@@ -2,18 +2,22 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Address" %}</th><th>{% trans "Current quota" %}</th><th id="actions">{% trans "Actions" %}</th>
|
||||
<th>{% trans "Address" %}</th>
|
||||
<th>{% trans "Value" %}</th>
|
||||
<th>{% trans "Limit" %}</th>
|
||||
<th id="quotabar">{% trans "%" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for mbox in mboxes %}<tr>
|
||||
<td>{{ mbox.full_address }}</td>
|
||||
<td>{{ mbox.get_quota }}M</td>
|
||||
<td>{{ mbox.quota }}M</td>
|
||||
<td name="quota">
|
||||
<div id="quotabar" class="progress {% progress_color mbox.get_cur_quota %}">
|
||||
<div class="bar" style="width: {{ mbox.get_cur_quota }}%"></div>
|
||||
<div id="quotabar" class="progress {% progress_color mbox.get_quota_in_percent %}">
|
||||
<div class="bar" style="width: {{ mbox.get_quota_in_percent }}%"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td name="actions"></td>
|
||||
</tr>{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -345,8 +345,16 @@ def mboxes_list(request):
|
||||
@permission_required("admin.add_mailbox")
|
||||
def list_quotas(request, tplname="admin/quotas.html"):
|
||||
mboxes = request.user.get_mailboxes()
|
||||
paginator = Paginator(mboxes, int(parameters.get_admin("ITEMS_PER_PAGE")))
|
||||
pagenum = int(request.GET.get("page", "1"))
|
||||
try:
|
||||
page = paginator.page(pagenum)
|
||||
except (EmptyPage, PageNotAnInteger):
|
||||
page = paginator.page(paginator.num_pages)
|
||||
return ajax_simple_response({
|
||||
"status": "ok",
|
||||
"page": page.number,
|
||||
"paginbar": pagination_bar(page),
|
||||
"table": _render_to_string(request, tplname, {
|
||||
"mboxes": mboxes
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# coding: utf-8
|
||||
from django.utils.translation import ugettext_lazy
|
||||
from modoboa.extensions import ModoExtension, exts_pool
|
||||
|
||||
from modoboa.lib import parameters
|
||||
|
||||
class UserPreferences(ModoExtension):
|
||||
name = "userprefs"
|
||||
@@ -11,7 +11,6 @@ class UserPreferences(ModoExtension):
|
||||
always_active = True
|
||||
|
||||
def load(self):
|
||||
from modoboa.lib import parameters
|
||||
from app_settings import UserSettings
|
||||
parameters.register(UserSettings, ugettext_lazy("General"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user