diff options
author | Leif Johansson <leifj@sunet.se> | 2012-02-02 15:12:49 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2012-02-02 15:12:49 +0100 |
commit | ef6ff581acf04d14e2f70c8800e221a38659eba9 (patch) | |
tree | f242fe59d1c0cbbc1e7e1ac8d6bef69a0c3afa05 /src | |
parent | dfec2d9ac88dded5047aa52aaede1e4c510953eb (diff) |
make it possible to look at other users stats for debugging
Diffstat (limited to 'src')
-rw-r--r-- | src/meetingtools/apps/stats/views.py | 12 | ||||
-rw-r--r-- | src/meetingtools/urls.py | 4 | ||||
-rw-r--r-- | src/templates/apps/stats/user.html | 6 |
3 files changed, 13 insertions, 9 deletions
diff --git a/src/meetingtools/apps/stats/views.py b/src/meetingtools/apps/stats/views.py index 8cdee25..38f21d1 100644 --- a/src/meetingtools/apps/stats/views.py +++ b/src/meetingtools/apps/stats/views.py @@ -25,9 +25,11 @@ def _date_ts(date): return int(mktime((int(y),int(m),int(d),12,0,0,0,0,-1)))*1000 # high noon @login_required -def user(request): - (local,domain) = request.user.username.split('@') - return respond_to(request,{'text/html': 'apps/stats/user.html'},{'domain': domain}) +def user(request,username=None): + if username == None: + username = request.user.username + (local,domain) = username.split('@') + return respond_to(request,{'text/html': 'apps/stats/user.html'},{'domain': domain,'username': username}) @login_required def domain(request,domain): @@ -47,8 +49,8 @@ def room(request,rid): @login_required def user_minutes_api(request,username=None): - if username and username != request.user.username: - return HttpResponseForbidden("You can't spy on others!") + #if username and username != request.user.username: + # return HttpResponseForbidden("You can't spy on others!") if username == None: username = request.user.username diff --git a/src/meetingtools/urls.py b/src/meetingtools/urls.py index d1a6ef2..ed541b9 100644 --- a/src/meetingtools/urls.py +++ b/src/meetingtools/urls.py @@ -19,7 +19,8 @@ urlpatterns = patterns('', (r'^accounts/login?$','meetingtools.apps.auth.views.login'), (r'^accounts/login-federated$','meetingtools.apps.auth.views.accounts_login_federated'), (r'^accounts/logout$','meetingtools.apps.auth.views.logout'), - (r'^(?:room|rooms)$','meetingtools.apps.room.views.user_rooms'), + (r'^user/?(.*)$','meetingtools.apps.room.views.list_rooms'), + (r'^(?:room|rooms)$','meetingtools.apps.room.views.list_rooms'), (r'^go/(\d+)$','meetingtools.apps.room.views.go_by_id'), (r'^go/(.+)$','meetingtools.apps.room.views.go_by_path'), (r'^launch/(\d+)$','meetingtools.apps.room.views.launch'), @@ -45,6 +46,7 @@ urlpatterns = patterns('', (r'^api/stats/domain/(.+)$','meetingtools.apps.stats.views.domain_minutes_api'), (r'^api/stats/room/(\d+)$','meetingtools.apps.stats.views.room_minutes_api'), (r'^stats$','meetingtools.apps.stats.views.user'), + (r'^stats/user/(.+)$','meetingtools.apps.stats.views.user'), (r'^stats/domain/(.+)$','meetingtools.apps.stats.views.domain'), (r'^stats/room/(\d+)$','meetingtools.apps.stats.views.room'), # Uncomment the next line to enable the admin: diff --git a/src/templates/apps/stats/user.html b/src/templates/apps/stats/user.html index 486c9be..35a40fb 100644 --- a/src/templates/apps/stats/user.html +++ b/src/templates/apps/stats/user.html @@ -3,11 +3,11 @@ {% load prefix %} {% block widgets %} $.ajax({ - url: '{% prefix %}/api/stats/user/{{user.username}}', + url: '{% prefix %}/api/stats/user/{{username}}', method: 'GET', success: function (resp) { var graph = $('#graph'); - series = [{label: 'Meeting minutes for {{user}}',data: resp['data']}]; + series = [{label: 'Meeting minutes for {{username}}',data: resp['data']}]; $.plot(graph,series,{ lines: { show: true }, points: { show: true }, @@ -19,7 +19,7 @@ $.ajax({ }); {% endblock %} {% block content %} -<h1>Meeting statistics for {{user}}</h1> +<h1>Meeting statistics for {{username}}</h1> <div id="graph" style="width:600px;height:300px; display: block; float: left; margin-right: 20px;"></div> <div> <h2>Summary</h2> |