diff --git a/doc/extending/events.rst b/doc/extending/events.rst index 8ffa83b55..2741bd421 100644 --- a/doc/extending/events.rst +++ b/doc/extending/events.rst @@ -629,8 +629,10 @@ template but need javascript stuff. *Callback prototype*:: - def callback(user): pass + def callback(caller, user): pass +* ``caller`` is name of the application (or the location) responsible + for the call * ``user`` is a ``User`` instance corresponding to the currently logged in user diff --git a/doc/index.rst b/doc/index.rst index f4467b5e4..f6024fb06 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -6,8 +6,6 @@ Modoboa's documentation! ======================== -This documentation refers to version |release|. - *************** Getting started *************** @@ -49,12 +47,3 @@ Additional resource additional/migrating additional/virtualmachine - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/modoboa/core/commands/postfix_maps.py b/modoboa/core/commands/postfix_maps.py index c9c0ca184..d37fb1dbb 100644 --- a/modoboa/core/commands/postfix_maps.py +++ b/modoboa/core/commands/postfix_maps.py @@ -158,17 +158,17 @@ class AutoRepliesMap(MapFile): class RelayDomainsTransportMap(MapFile): category = "relaydomains" filename = "sql-relaydomains-transport.cf" - mysql = "SELECT CONCAT(srv.name, ':') FROM postfix_relaydomains_service AS srv INNER JOIN postfix_relaydomains_relaydomain AS rdom ON rdom.service_id=srv.id WHERE rdom.enabled=1 AND rdom.name='%s'" - postgres = "SELECT srv.name || ':' FROM postfix_relaydomains_service AS srv INNER JOIN postfix_relaydomains_relaydomain AS rdom ON rdom.service_id=srv.id WHERE rdom.enabled AND rdom.name='%s'" - sqlite = "SELECT srv.name || ':' FROM postfix_relaydomains_service AS srv INNER JOIN postfix_relaydomains_relaydomain AS rdom ON rdom.service_id=srv.id WHERE rdom.enabled=1 AND rdom.name='%s'" + mysql = "SELECT CONCAT(srv.name, ':') FROM postfix_relay_domains_service AS srv INNER JOIN postfix_relay_domains_relaydomain AS rdom ON rdom.service_id=srv.id WHERE rdom.enabled=1 AND rdom.name='%s'" + postgres = "SELECT srv.name || ':' FROM postfix_relay_domains_service AS srv INNER JOIN postfix_relay_domains_relaydomain AS rdom ON rdom.service_id=srv.id WHERE rdom.enabled AND rdom.name='%s'" + sqlite = "SELECT srv.name || ':' FROM postfix_relay_domains_service AS srv INNER JOIN postfix_relay_domains_relaydomain AS rdom ON rdom.service_id=srv.id WHERE rdom.enabled=1 AND rdom.name='%s'" class RelayDomainAliasesTransportMap(MapFile): category = "relaydomains" filename = "sql-relaydomain-aliases-transport.cf" - mysql = "SELECT CONCAT(srv.name, ':') FROM postfix_relaydomains_service AS srv INNER JOIN postfix_relaydomains_relaydomain AS rdom ON rdom.service_id=srv.id INNER JOIN postfix_relaydomains_relaydomainalias AS rdomalias ON rdom.id=rdomalias.target_id WHERE rdom.enabled=1 AND rdomalias.enabled=1 AND rdomalias.name='%s'" - postgres = "SELECT srv.name || ':' FROM postfix_relaydomains_service AS srv INNER JOIN postfix_relaydomains_relaydomain AS rdom ON rdom.service_id=srv.id INNER JOIN postfix_relaydomains_relaydomainalias AS rdomalias ON rdom.id=rdomalias.target_id WHERE rdom.enabled AND rdomalias.enabled AND rdomalias.name='%s'" - sqlite = "SELECT srv.name || ':' FROM postfix_relaydomains_service AS srv INNER JOIN postfix_relaydomains_relaydomain AS rdom ON rdom.service_id=srv.id INNER JOIN postfix_relaydomains_relaydomainalias AS rdomalias ON rdom.id=rdomalias.target_id WHERE rdom.enabled=1 AND rdomalias.enabled=1 AND rdomalias.name='%s'" + mysql = "SELECT CONCAT(srv.name, ':') FROM postfix_relay_domains_service AS srv INNER JOIN postfix_relay_domains_relaydomain AS rdom ON rdom.service_id=srv.id INNER JOIN postfix_relay_domains_relaydomainalias AS rdomalias ON rdom.id=rdomalias.target_id WHERE rdom.enabled=1 AND rdomalias.enabled=1 AND rdomalias.name='%s'" + postgres = "SELECT srv.name || ':' FROM postfix_relay_domains_service AS srv INNER JOIN postfix_relay_domains_relaydomain AS rdom ON rdom.service_id=srv.id INNER JOIN postfix_relay_domains_relaydomainalias AS rdomalias ON rdom.id=rdomalias.target_id WHERE rdom.enabled AND rdomalias.enabled AND rdomalias.name='%s'" + sqlite = "SELECT srv.name || ':' FROM postfix_relay_domains_service AS srv INNER JOIN postfix_relay_domains_relaydomain AS rdom ON rdom.service_id=srv.id INNER JOIN postfix_relay_domains_relaydomainalias AS rdomalias ON rdom.id=rdomalias.target_id WHERE rdom.enabled=1 AND rdomalias.enabled=1 AND rdomalias.name='%s'" class PostfixMapsCommand(Command): diff --git a/modoboa/extensions/webmail/static/webmail/js/webmail.js b/modoboa/extensions/webmail/static/webmail/js/webmail.js index 005485522..ace4ba0ba 100644 --- a/modoboa/extensions/webmail/static/webmail/js/webmail.js +++ b/modoboa/extensions/webmail/static/webmail/js/webmail.js @@ -746,9 +746,8 @@ Webmail.prototype = { $("body").notify("success", gettext("Message sent"), 2000); }, this)).fail($.proxy(function(jqxhr) { var data = $.parseJSON(jqxhr.responseText); - this.navobject.get_callback("compose")(data); - if (data.respmsg != undefined) { - $("body").notify("error", data.respmsg); + if (data != undefined) { + $("body").notify("error", data); } $("a[name=sendmail]").attr("disabled", null); }, this)); diff --git a/modoboa/lib/events.py b/modoboa/lib/events.py index e5baac544..cd574b412 100644 --- a/modoboa/lib/events.py +++ b/modoboa/lib/events.py @@ -139,7 +139,7 @@ def raiseEvent(event, *args, **kwargs): :param event: the event to raise """ - if not event in events or not event in callbacks.keys(): + if not event in events or not event in callbacks: return 0 for callback in callbacks[event].values(): callback(*args, **kwargs) @@ -155,7 +155,7 @@ def raiseQueryEvent(event, *args, **kwargs): :param event: the event to raise """ result = [] - if not event in events or not event in callbacks.keys(): + if not event in events or not event in callbacks: return result for callback in callbacks[event].values(): tmp = callback(*args, **kwargs) diff --git a/modoboa/lib/webutils.py b/modoboa/lib/webutils.py index ec9ed7313..df578c2e1 100644 --- a/modoboa/lib/webutils.py +++ b/modoboa/lib/webutils.py @@ -6,9 +6,10 @@ This module contains extra functions/shortcuts used to render HTML. import sys import re import json +from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required -from django.shortcuts import render, render_to_response +from django.shortcuts import render from django.template.loader import render_to_string from django import template from django.conf import settings @@ -140,9 +141,9 @@ def topredirection(request): """Simple view to redirect the request when no application is specified. The default "top redirection" can be specified in the *Admin > - Settings* panel. It is the application that will be launched by - default. Users that are not allowed to access this application - will be redirected to the "User preferences" application. + Settings* panel. It is the application that will be + launched. Those not allowed to access the application will be + redirected to their preferences page. This feature only applies to simple users. @@ -151,9 +152,12 @@ def topredirection(request): from modoboa.lib import parameters from modoboa.core.extensions import exts_pool - topredir = parameters.get_admin("DEFAULT_TOP_REDIRECTION", app="core") - infos = exts_pool.get_extension_infos(topredir) - path = infos["url"] if infos["url"] else infos["name"] + if request.user.group == 'SimpleUsers': + topredir = parameters.get_admin("DEFAULT_TOP_REDIRECTION", app="core") + infos = exts_pool.get_extension_infos(topredir) + path = infos["url"] if infos["url"] else infos["name"] + else: + path = reverse("domains") return HttpResponseRedirect(path)