<NME> admin.py
<BEF> from django.shortcuts import render
from django.template.loader import render_to_string
from django.utils.translation import ugettext as _
from django.contrib.auth.decorators import (
    login_required, user_passes_test
)
from modoboa.lib import events, parameters
from modoboa.lib.webutils import (
    _render_to_string, render_to_json_response
)
from modoboa.lib.listing import get_sort_order, get_listing_page
from modoboa.core.models import Extension, Log
from modoboa.core.utils import new_version_available
from modoboa.core.tables import ExtensionsTable


@login_required


@login_required
@user_passes_test(lambda u: u.is_superuser)
def parameters(request, tplname="core/parameters.html"):
    """View to display and save global parameters."""
    if request.method == "POST":
        forms = param_tools.registry.get_forms(
            "global", request.POST, localconfig=request.localconfig)
        for formdef in forms:
            form = formdef["form"]
            if form.is_valid():
                form.save()
                form.to_django_settings()
                continue
            return render_to_json_response(
                {"form_errors": form.errors, "prefix": form.app}, status=400
            )
        request.localconfig.save()
        return render_to_json_response(_("Parameters saved"))
    return render_to_json_response({
        "left_selection": "parameters",
        "content": render_to_string(tplname, {
            "forms": param_tools.registry.get_forms(
                "global", localconfig=request.localconfig)
        }, request)
    })


@login_required
@user_passes_test(lambda u: u.is_superuser)
def information(request, tplname="core/information.html"):
    status, extensions = check_for_updates()
@login_required
@user_passes_test(lambda u: u.is_superuser)
def viewextensions(request, tplname='core/extensions.html'):
    from modoboa.core.extensions import exts_pool

    exts = exts_pool.list_all()

def get_logs_page(request, page_id=None):
    """Return a page of logs."""
    sort_order, sort_dir = get_sort_order(
        request.GET, "date_created",
        allowed_values=["date_created", "level", "logger", "message"]
    )
    if page_id is None:
            dbext.save()
            ext["selection"] = False

    tbl = ExtensionsTable(request, exts)
    return render_to_json_response({
        "content": _render_to_string(request, tplname, {"extensions": tbl})
    })


@login_required
@user_passes_test(lambda u: u.is_superuser)
def saveextensions(request):
    actived_exts = Extension.objects.filter(enabled=True)
    found = []
    for k in request.POST.keys():
    """
    page = get_logs_page(request, 1)
    return render_to_json_response({
        "callback": "logs",
        "content": render_to_string(tplname, {"logs": page.object_list}),
        "page": page.number
    })


@login_required
@user_passes_test(lambda u: u.is_superuser)
def logs_page(request, tplname="core/logs_page.html"):
    """Return a page containing logs."""
    page = get_logs_page(request)
    if page is None:
        context = {"length": 0}
    else:
        context = {
            "rows": render_to_string(tplname, {"logs": page.object_list}),
            "pages": [page.number]
        }
    return render_to_json_response(context)


@login_required
def check_top_notifications(request):
    """AJAX service to check for new top notifications to display."""
    notifications = signals.get_top_notifications.send(
        sender="top_notifications", include_all=True)
    notifications = reduce(
        lambda a, b: a + b, [notif[1] for notif in notifications])
    return render_to_json_response(notifications)

<MSG> Top checkbox to select/unselect all extensions.

fix #628

<DFF> @@ -1,17 +1,23 @@
+"""
+Views available to super administrators only.
+"""
+
 from django.shortcuts import render
 from django.template.loader import render_to_string
 from django.utils.translation import ugettext as _
+
 from django.contrib.auth.decorators import (
     login_required, user_passes_test
 )
+
+
+from modoboa.core.models import Extension, Log
+from modoboa.core.utils import new_version_available
 from modoboa.lib import events, parameters
+from modoboa.lib.listing import get_sort_order, get_listing_page
 from modoboa.lib.webutils import (
     _render_to_string, render_to_json_response
 )
-from modoboa.lib.listing import get_sort_order, get_listing_page
-from modoboa.core.models import Extension, Log
-from modoboa.core.utils import new_version_available
-from modoboa.core.tables import ExtensionsTable
 
 
 @login_required
@@ -51,6 +57,7 @@ def saveparameters(request):
 @login_required
 @user_passes_test(lambda u: u.is_superuser)
 def viewextensions(request, tplname='core/extensions.html'):
+    """List available extensions."""
     from modoboa.core.extensions import exts_pool
 
     exts = exts_pool.list_all()
@@ -65,15 +72,16 @@ def viewextensions(request, tplname='core/extensions.html'):
             dbext.save()
             ext["selection"] = False
 
-    tbl = ExtensionsTable(request, exts)
     return render_to_json_response({
-        "content": _render_to_string(request, tplname, {"extensions": tbl})
+        "callback": "extensions",
+        "content": _render_to_string(request, tplname, {"extensions": exts})
     })
 
 
 @login_required
 @user_passes_test(lambda u: u.is_superuser)
 def saveextensions(request):
+    """Enable of disable extension(s)."""
     actived_exts = Extension.objects.filter(enabled=True)
     found = []
     for k in request.POST.keys():

Top checkbox to select/unselect all extensions.