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
54ad4110
Commit
54ad4110
authored
Oct 24, 2013
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code
parent
b4ae4797
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
137 deletions
+0
-137
lms/djangoapps/courseware/views.py
+0
-27
lms/djangoapps/django_comment_client/utils.py
+0
-15
lms/templates/courseware/notifications.html
+0
-93
lms/urls.py
+0
-2
No files found.
lms/djangoapps/courseware/views.py
View file @
54ad4110
...
...
@@ -27,8 +27,6 @@ from .module_render import toc_for_course, get_module_for_descriptor, get_module
from
courseware.models
import
StudentModule
,
StudentModuleHistory
from
course_modes.models
import
CourseMode
from
django_comment_client.utils
import
get_discussion_title
from
student.models
import
UserTestGroup
,
CourseEnrollment
from
util.cache
import
cache
,
cache_if_anonymous
from
xblock.fragment
import
Fragment
...
...
@@ -39,8 +37,6 @@ from xmodule.modulestore.search import path_to_location
from
xmodule.course_module
import
CourseDescriptor
import
shoppingcart
import
comment_client
log
=
logging
.
getLogger
(
"mitx.courseware"
)
template_imports
=
{
'urllib'
:
urllib
}
...
...
@@ -674,29 +670,6 @@ def mktg_course_about(request, course_id):
})
def
render_notifications
(
request
,
course
,
notifications
):
context
=
{
'notifications'
:
notifications
,
'get_discussion_title'
:
partial
(
get_discussion_title
,
request
=
request
,
course
=
course
),
'course'
:
course
,
}
return
render_to_string
(
'courseware/notifications.html'
,
context
)
@login_required
def
news
(
request
,
course_id
):
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
notifications
=
comment_client
.
get_notifications
(
request
.
user
.
id
)
context
=
{
'course'
:
course
,
'content'
:
render_notifications
(
request
,
course
,
notifications
),
}
return
render_to_response
(
'courseware/news.html'
,
context
)
@login_required
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
def
progress
(
request
,
course_id
,
student_id
=
None
):
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
54ad4110
...
...
@@ -20,8 +20,6 @@ from django.utils.timezone import UTC
log
=
logging
.
getLogger
(
__name__
)
# TODO these should be cached via django's caching rather than in-memory globals
_FULLMODULES
=
None
_DISCUSSIONINFO
=
defaultdict
(
dict
)
...
...
@@ -62,13 +60,6 @@ def has_forum_access(uname, course_id, rolename):
return
role
.
users
.
filter
(
username
=
uname
)
.
exists
()
def
get_full_modules
():
global
_FULLMODULES
if
not
_FULLMODULES
:
_FULLMODULES
=
modulestore
()
.
modules
return
_FULLMODULES
def
get_discussion_id_map
(
course
):
"""
return a dict of the form {category: modules}
...
...
@@ -77,12 +68,6 @@ def get_discussion_id_map(course):
return
_DISCUSSIONINFO
[
course
.
id
][
'id_map'
]
def
get_discussion_title
(
course
,
discussion_id
):
initialize_discussion_info
(
course
)
title
=
_DISCUSSIONINFO
[
course
.
id
][
'id_map'
]
.
get
(
discussion_id
,
{})
.
get
(
'title'
,
'(no title)'
)
return
title
def
get_discussion_category_map
(
course
):
initialize_discussion_info
(
course
)
return
filter_unstarted_categories
(
_DISCUSSIONINFO
[
course
.
id
][
'category_map'
])
...
...
lms/templates/courseware/notifications.html
deleted
100644 → 0
View file @
b4ae4797
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%
def
url_for_thread
(
discussion_id
,
thread_id
)
:
return
reverse
('
django_comment_client
.
forum
.
views
.
single_thread
',
args=
[course.id,
discussion_id
,
thread_id
])
%
>
<
%
def
url_for_comment
(
discussion_id
,
thread_id
,
comment_id
)
:
return
url_for_thread
(
discussion_id
,
thread_id
)
+
"#"
+
comment_id
%
>
<
%
def
url_for_discussion
(
discussion_id
)
:
return
reverse
('
django_comment_client
.
forum
.
views
.
forum_form_discussion
',
args=
[course.id,
discussion_id
])
%
>
<
%
def
discussion_title
(
discussion_id
)
:
return
get_discussion_title
(
discussion_id=
discussion_id)
%
>
<
%
def
url_for_user
(
user_id
)
:
#
TODO
return
"
javascript:void
(
0
)"
%
>
<div
class=
"notifications"
>
% for notification in notifications:
${render_notification(notification)}
% endfor
</div>
<
%
def
name=
"render_user_link(notification)"
>
<
%
info =
notification['info']
%
>
% if notification.get('actor_id', None):
<a
href=
"${url_for_user(notification['actor_id'])}"
>
${info['actor_username']}
</a>
% else:
${_("Anonymous")}
% endif
</
%
def>
<
%
def
name=
"render_thread_link(notification)"
>
<
%
info =
notification['info']
%
>
<a
href=
"${url_for_thread(info['commentable_id'], info['thread_id'])}"
>
${info['thread_title']}
</a>
</
%
def>
<
%
def
name=
"render_comment_link(notification)"
>
<
%
info =
notification['info']
%
>
<a
href=
"${url_for_comment(info['commentable_id'], info['thread_id'], info['comment_id'])}"
>
${_("comment")}
</a>
</
%
def>
<
%
def
name=
"render_discussion_link(notification)"
>
<
%
info =
notification['info']
%
>
<a
href=
"${url_for_discussion(info['commentable_id'])}"
>
${discussion_title(info['commentable_id'])}
</a>
</
%
def>
<
%
def
name=
"render_notification(notification)"
>
<div
class=
"notification"
>
% if notification['notification_type'] == 'post_reply':
${_("{user} posted a {comment} to the thread {thread} in discussion {discussion}").format(
user=render_user_link(notification),
comment=render_comment_link(notification),
thread=render_thread_link(notification),
discussion=render_discussion_link(notification),
)}
% elif notification['notification_type'] == 'post_topic':
${_("{user} posted a new thread {thread} in discussion {discussion}").format(
user=render_user_link(notification),
thread=render_thread_link(notification),
discussion=render_discussion_link(notification),
)}
% elif notification['notification_type'] == 'at_user':
% if notification['info']['content_type'] == 'thread':
${_("{user} mentioned you in the thread {thread} in disucssion {discussion}").format(
user=render_user(info),
thread=render_thread_link(notification),
discussion=render_discussion_link(notification),
)}
% else:
${_("{user} mentioned you in {comment} to the thread {thread} in discussion {discussion}").format(
user=render_user(info),
comment=render_comment_link(notification),
thread=render_thread_link(notification),
discussion=render_discussion_link(notification),
)}
% endif
% endif
</div>
</
%
def>
lms/urls.py
View file @
54ad4110
...
...
@@ -329,8 +329,6 @@ if settings.COURSEWARE_ENABLED:
# discussion forums live within courseware, so courseware must be enabled first
if
settings
.
MITX_FEATURES
.
get
(
'ENABLE_DISCUSSION_SERVICE'
):
urlpatterns
+=
(
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/news$'
,
'courseware.views.news'
,
name
=
"news"
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/discussion/'
,
include
(
'django_comment_client.urls'
)),
url
(
r'^notification_prefs/enable/'
,
'notification_prefs.views.ajax_enable'
),
...
...
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