mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
Added a new parameter to specify where the graphics can be found.
fixes #66
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
{% endif %}
|
||||
{% for elems in graphs %}
|
||||
<h3>{% trans elems.label %}</h3>
|
||||
<p><img src="{{ MEDIA_URL }}stats/{{ elems.name }}_{{ domain }}_AVERAGE_{% ifequal period 'custom' %}{{ period_name }}{% else %}{{ period }}{% endifequal %}.png"
|
||||
<p><img src="{{ MEDIA_URL }}{{ graphs_loc }}/{{ elems.name }}_{{ domain }}_AVERAGE_{% ifequal period 'custom' %}{{ period_name }}{% else %}{{ period }}{% endifequal %}.png"
|
||||
alt="{% trans 'No statistics available' %}" /></p>
|
||||
{% endfor %}
|
||||
|
||||
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user