diff --git a/extensions/stats/__init__.py b/extensions/stats/__init__.py
index e833c252e..664818af7 100644
--- a/extensions/stats/__init__.py
+++ b/extensions/stats/__init__.py
@@ -31,6 +31,9 @@ def load():
parameters.register_admin("IMG_ROOTDIR", type="string",
deflt="/tmp/modoboa",
help=_("Path to directory where PNG files are stored"))
+ parameters.register_admin("GRAPHS_LOCATION", type="string",
+ deflt="graphs",
+ help=_("Graphics location (to build URLs)"))
def destroy():
events.unregister("AdminMenuDisplay", menu)
diff --git a/extensions/stats/templates/stats/graphs.html b/extensions/stats/templates/stats/graphs.html
index 83a088259..3c1625f81 100644
--- a/extensions/stats/templates/stats/graphs.html
+++ b/extensions/stats/templates/stats/graphs.html
@@ -4,6 +4,6 @@
{% endif %}
{% for elems in graphs %}
{% trans elems.label %}
-

{% endfor %}
diff --git a/extensions/stats/views.py b/extensions/stats/views.py
index fc7d28a97..5881d90b0 100644
--- a/extensions/stats/views.py
+++ b/extensions/stats/views.py
@@ -32,12 +32,10 @@ def index(request):
domains = request.user.get_domains()
return _render(request, 'stats/index.html', {
- "domains" : domains,
"graphs" : graph_list,
"periods" : periods,
"period" : period,
- "selection" : "stats",
- "domid" : domid
+ "selection" : "stats"
})
@login_required
@@ -47,7 +45,8 @@ def graphs(request):
if not view:
raise ModoboaException(_("Invalid request"))
period = request.GET.get("period", "day")
- tplvars = dict(graphs=graph_list, period=period)
+ tplvars = dict(graphs=graph_list, period=period,
+ graphs_loc=parameters.get_admin("GRAPHS_LOCATION"))
if view == "global":
if not request.user.is_superuser:
raise PermDeniedError(_("you're not allowed to see those statistics"))