Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d95693eb
Commit
d95693eb
authored
Jul 25, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hook up panel to new stats service
parent
5d106ee0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
2 deletions
+51
-2
common/static/coffee/src/discussion/utils.coffee
+3
-0
common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+11
-0
lms/djangoapps/django_comment_client/base/urls.py
+1
-1
lms/djangoapps/django_comment_client/base/views.py
+17
-0
lms/djangoapps/django_comment_client/forum/urls.py
+1
-0
lms/djangoapps/django_comment_client/utils.py
+2
-1
lms/lib/comment_client/user.py
+16
-0
No files found.
common/static/coffee/src/discussion/utils.coffee
View file @
d95693eb
...
@@ -80,6 +80,9 @@ class @DiscussionUtil
...
@@ -80,6 +80,9 @@ class @DiscussionUtil
permanent_link_thread
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/threads/
#{
param1
}
"
permanent_link_thread
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/threads/
#{
param1
}
"
permanent_link_comment
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/threads/
#{
param1
}
#
#{
param2
}
"
permanent_link_comment
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/threads/
#{
param1
}
#
#{
param2
}
"
user_profile
:
"/courses/
#{
$$course_id
}
/discussion/forum/users/
#{
param
}
"
user_profile
:
"/courses/
#{
$$course_id
}
/discussion/forum/users/
#{
param
}
"
user_stats
:
"/courses/
#{
$$course_id
}
/discussion/panel/stats"
followed_threads
:
"/courses/
#{
$$course_id
}
/discussion/forum/users/
#{
param
}
/followed"
followed_threads
:
"/courses/
#{
$$course_id
}
/discussion/forum/users/
#{
param
}
/followed"
threads
:
"/courses/
#{
$$course_id
}
/discussion/forum"
threads
:
"/courses/
#{
$$course_id
}
/discussion/forum"
}[
name
]
}[
name
]
...
...
common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
d95693eb
...
@@ -197,6 +197,7 @@ if Backbone?
...
@@ -197,6 +197,7 @@ if Backbone?
@
template
=
_
.
template
(
$
(
"#discussion-home"
).
html
())
@
template
=
_
.
template
(
$
(
"#discussion-home"
).
html
())
$
(
".discussion-column"
).
html
(
@
template
)
$
(
".discussion-column"
).
html
(
@
template
)
$
(
".post-list a"
).
removeClass
(
"active"
)
$
(
".post-list a"
).
removeClass
(
"active"
)
@
retrieveUserStats
()
thread_id
=
null
thread_id
=
null
toggleTopicDrop
:
(
event
)
=>
toggleTopicDrop
:
(
event
)
=>
...
@@ -320,6 +321,16 @@ if Backbone?
...
@@ -320,6 +321,16 @@ if Backbone?
if
callback
?
if
callback
?
callback
()
callback
()
retrieveUserStats
:
()
->
url
=
DiscussionUtil
.
urlFor
(
"user_stats"
)
DiscussionUtil
.
safeAjax
url
:
url
type
:
"GET"
success
:
(
response
,
textStatus
)
=>
alert
(
'success'
)
error
:
(
response
)
=>
alert
(
'error'
)
retrieveDiscussions
:
(
discussion_ids
)
->
retrieveDiscussions
:
(
discussion_ids
)
->
@
discussionIds
=
discussion_ids
.
join
(
','
)
@
discussionIds
=
discussion_ids
.
join
(
','
)
@
mode
=
'commentables'
@
mode
=
'commentables'
...
...
lms/djangoapps/django_comment_client/base/urls.py
View file @
d95693eb
...
@@ -3,6 +3,7 @@ from django.conf.urls.defaults import url, patterns
...
@@ -3,6 +3,7 @@ from django.conf.urls.defaults import url, patterns
urlpatterns
=
patterns
(
'django_comment_client.base.views'
,
# nopep8
urlpatterns
=
patterns
(
'django_comment_client.base.views'
,
# nopep8
url
(
r'upload$'
,
'upload'
,
name
=
'upload'
),
url
(
r'upload$'
,
'upload'
,
name
=
'upload'
),
url
(
r'users/(?P<user_id>\w+)/update_moderator_status$'
,
'update_moderator_status'
,
name
=
'update_moderator_status'
),
url
(
r'users/(?P<user_id>\w+)/update_moderator_status$'
,
'update_moderator_status'
,
name
=
'update_moderator_status'
),
url
(
r'panel/stats'
,
'user_stats'
,
name
=
'user_stats'
),
url
(
r'threads/tags/autocomplete$'
,
'tags_autocomplete'
,
name
=
'tags_autocomplete'
),
url
(
r'threads/tags/autocomplete$'
,
'tags_autocomplete'
,
name
=
'tags_autocomplete'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/update$'
,
'update_thread'
,
name
=
'update_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/update$'
,
'update_thread'
,
name
=
'update_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/reply$'
,
'create_comment'
,
name
=
'create_comment'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/reply$'
,
'create_comment'
,
name
=
'create_comment'
),
...
@@ -17,7 +18,6 @@ urlpatterns = patterns('django_comment_client.base.views', # nopep8
...
@@ -17,7 +18,6 @@ urlpatterns = patterns('django_comment_client.base.views', # nopep8
url
(
r'threads/(?P<thread_id>[\w\-]+)/follow$'
,
'follow_thread'
,
name
=
'follow_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/follow$'
,
'follow_thread'
,
name
=
'follow_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/unfollow$'
,
'unfollow_thread'
,
name
=
'unfollow_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/unfollow$'
,
'unfollow_thread'
,
name
=
'unfollow_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/close$'
,
'openclose_thread'
,
name
=
'openclose_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/close$'
,
'openclose_thread'
,
name
=
'openclose_thread'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/update$'
,
'update_comment'
,
name
=
'update_comment'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/update$'
,
'update_comment'
,
name
=
'update_comment'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/endorse$'
,
'endorse_comment'
,
name
=
'endorse_comment'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/endorse$'
,
'endorse_comment'
,
name
=
'endorse_comment'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/reply$'
,
'create_sub_comment'
,
name
=
'create_sub_comment'
),
url
(
r'comments/(?P<comment_id>[\w\-]+)/reply$'
,
'create_sub_comment'
,
name
=
'create_sub_comment'
),
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
d95693eb
...
@@ -649,3 +649,20 @@ def upload(request, course_id): # ajax upload file to a question or answer
...
@@ -649,3 +649,20 @@ def upload(request, course_id): # ajax upload file to a question or answer
'file_url'
:
file_url
,
'file_url'
:
file_url
,
}
}
})
})
@login_required
def
user_stats
(
request
,
course_id
):
try
:
profiled_user
=
cc
.
User
(
id
=
request
.
user
.
id
,
course_id
=
course_id
)
print
"
\n\n\n
*******************
\n\n\n
"
print
profiled_user
.
course_id
query_params
=
{}
user_stats_results
=
profiled_user
.
stats
(
query_params
)
return
utils
.
JsonResponse
({
'stats'
:
user_stats_results
})
except
(
cc
.
utils
.
CommentClientError
,
cc
.
utils
.
CommentClientUnknownError
,
User
.
DoesNotExist
):
raise
Http404
lms/djangoapps/django_comment_client/forum/urls.py
View file @
d95693eb
...
@@ -4,6 +4,7 @@ urlpatterns = patterns('django_comment_client.forum.views', # nopep8
...
@@ -4,6 +4,7 @@ urlpatterns = patterns('django_comment_client.forum.views', # nopep8
url
(
r'users/(?P<user_id>\w+)/followed$'
,
'followed_threads'
,
name
=
'followed_threads'
),
url
(
r'users/(?P<user_id>\w+)/followed$'
,
'followed_threads'
,
name
=
'followed_threads'
),
url
(
r'users/(?P<user_id>\w+)$'
,
'user_profile'
,
name
=
'user_profile'
),
url
(
r'users/(?P<user_id>\w+)$'
,
'user_profile'
,
name
=
'user_profile'
),
url
(
r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$'
,
'single_thread'
,
name
=
'single_thread'
),
url
(
r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$'
,
'single_thread'
,
name
=
'single_thread'
),
url
(
r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$'
,
'single_thread'
,
name
=
'single_thread'
),
url
(
r'^(?P<discussion_id>[\w\-.]+)/inline$'
,
'inline_discussion'
,
name
=
'inline_discussion'
),
url
(
r'^(?P<discussion_id>[\w\-.]+)/inline$'
,
'inline_discussion'
,
name
=
'inline_discussion'
),
url
(
r''
,
'forum_form_discussion'
,
name
=
'forum_form_discussion'
),
url
(
r''
,
'forum_form_discussion'
,
name
=
'forum_form_discussion'
),
)
)
lms/djangoapps/django_comment_client/utils.py
View file @
d95693eb
...
@@ -387,7 +387,8 @@ def safe_content(content):
...
@@ -387,7 +387,8 @@ def safe_content(content):
'updated_at'
,
'depth'
,
'type'
,
'commentable_id'
,
'comments_count'
,
'updated_at'
,
'depth'
,
'type'
,
'commentable_id'
,
'comments_count'
,
'at_position_list'
,
'children'
,
'highlighted_title'
,
'highlighted_body'
,
'at_position_list'
,
'children'
,
'highlighted_title'
,
'highlighted_body'
,
'courseware_title'
,
'courseware_url'
,
'tags'
,
'unread_comments_count'
,
'courseware_title'
,
'courseware_url'
,
'tags'
,
'unread_comments_count'
,
'read'
,
'group_id'
,
'group_name'
,
'group_string'
,
'pinned'
,
'abuse_flaggers'
'read'
,
'group_id'
,
'group_name'
,
'group_string'
,
'pinned'
,
'abuse_flaggers'
,
'stats'
]
]
...
...
lms/lib/comment_client/user.py
View file @
d95693eb
...
@@ -75,6 +75,15 @@ class User(models.Model):
...
@@ -75,6 +75,15 @@ class User(models.Model):
response
=
perform_request
(
'get'
,
url
,
params
)
response
=
perform_request
(
'get'
,
url
,
params
)
return
response
.
get
(
'collection'
,
[]),
response
.
get
(
'page'
,
1
),
response
.
get
(
'num_pages'
,
1
)
return
response
.
get
(
'collection'
,
[]),
response
.
get
(
'page'
,
1
),
response
.
get
(
'num_pages'
,
1
)
def
stats
(
self
,
query_params
=
{}):
if
not
self
.
course_id
:
raise
CommentClientError
(
"Must provide course_id when retrieving stats for the user"
)
url
=
_url_for_user_stats
(
self
.
id
,
self
.
course_id
)
params
=
{
'course_id'
:
self
.
course_id
}
params
=
merge_dict
(
params
,
query_params
)
response
=
perform_request
(
'get'
,
url
,
params
)
return
response
.
get
(
'collection'
,
[]),
response
.
get
(
'page'
,
1
),
response
.
get
(
'num_pages'
,
1
)
def
_retrieve
(
self
,
*
args
,
**
kwargs
):
def
_retrieve
(
self
,
*
args
,
**
kwargs
):
url
=
self
.
url
(
action
=
'get'
,
params
=
self
.
attributes
)
url
=
self
.
url
(
action
=
'get'
,
params
=
self
.
attributes
)
retrieve_params
=
self
.
default_retrieve_params
retrieve_params
=
self
.
default_retrieve_params
...
@@ -97,8 +106,15 @@ def _url_for_subscription(user_id):
...
@@ -97,8 +106,15 @@ def _url_for_subscription(user_id):
def
_url_for_user_active_threads
(
user_id
):
def
_url_for_user_active_threads
(
user_id
):
print
(
"
\n\n\n
*********** ACTIVE THREADS **********
\n\n\n
"
)
return
"{prefix}/users/{user_id}/active_threads"
.
format
(
prefix
=
settings
.
PREFIX
,
user_id
=
user_id
)
return
"{prefix}/users/{user_id}/active_threads"
.
format
(
prefix
=
settings
.
PREFIX
,
user_id
=
user_id
)
def
_url_for_user_subscribed_threads
(
user_id
):
def
_url_for_user_subscribed_threads
(
user_id
):
return
"{prefix}/users/{user_id}/subscribed_threads"
.
format
(
prefix
=
settings
.
PREFIX
,
user_id
=
user_id
)
return
"{prefix}/users/{user_id}/subscribed_threads"
.
format
(
prefix
=
settings
.
PREFIX
,
user_id
=
user_id
)
def
_url_for_user_stats
(
user_id
,
course_id
):
print
(
"
\n\n\n
*********** USER STATS **********
\n\n\n
"
)
return
"{prefix}/users/{user_id}/stats?course_id={course_id}"
.
format
(
prefix
=
settings
.
PREFIX
,
user_id
=
user_id
,
course_id
=
course_id
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment