WIP: LMS Courseware appears to be working
This commit is contained in:
@@ -36,6 +36,11 @@ class CourseDescriptor(SequenceDescriptor):
|
||||
tabs = List(help="List of tabs to enable in this course", scope=Scope.settings)
|
||||
end_of_course_survey_url = String(help="Url for the end-of-course survey", scope=Scope.settings)
|
||||
discussion_blackouts = List(help="List of pairs of start/end dates for discussion blackouts", scope=Scope.settings, default=[])
|
||||
discussion_topics = Object(
|
||||
help="Map of topics names to ids",
|
||||
scope=Scope.settings,
|
||||
computed_default=lambda c: {'General': {'id': c.location.html_id()}},
|
||||
)
|
||||
has_children = True
|
||||
|
||||
info_sidebar_name = String(scope=Scope.settings, default='Course Handouts')
|
||||
|
||||
@@ -15,6 +15,7 @@ class DiscussionModule(XModule):
|
||||
discussion_id = String(scope=Scope.settings)
|
||||
discussion_category = String(scope=Scope.settings)
|
||||
discussion_target = String(scope=Scope.settings)
|
||||
sort_key = String(scope=Scope.settings)
|
||||
|
||||
data = String(help="XML definition of inline discussion", scope=Scope.content)
|
||||
|
||||
@@ -42,3 +43,8 @@ class DiscussionDescriptor(RawDescriptor):
|
||||
metadata_translations = dict(RawDescriptor.metadata_translations)
|
||||
metadata_translations['id'] = 'discussion_id'
|
||||
metadata_translations['for'] = 'discussion_target'
|
||||
|
||||
discussion_id = String(scope=Scope.settings)
|
||||
discussion_category = String(scope=Scope.settings)
|
||||
discussion_target = String(scope=Scope.settings)
|
||||
sort_key = String(scope=Scope.settings)
|
||||
|
||||
@@ -145,12 +145,12 @@ def initialize_discussion_info(course):
|
||||
id = module.discussion_id
|
||||
category = module.discussion_category
|
||||
title = module.discussion_target
|
||||
sort_key = module.metadata.get('sort_key', title)
|
||||
sort_key = module.sort_key
|
||||
category = " / ".join([x.strip() for x in category.split("/")])
|
||||
last_category = category.split("/")[-1]
|
||||
discussion_id_map[id] = {"location": location, "title": last_category + " / " + title}
|
||||
unexpanded_category_map[category].append({"title": title, "id": id,
|
||||
"sort_key": sort_key, "start_date": module.start})
|
||||
"sort_key": sort_key, "start_date": module.lms.start})
|
||||
|
||||
category_map = {"entries": defaultdict(dict), "subcategories": defaultdict(dict)}
|
||||
for category_path, entries in unexpanded_category_map.items():
|
||||
@@ -189,9 +189,7 @@ def initialize_discussion_info(course):
|
||||
"sort_key": entry["sort_key"],
|
||||
"start_date": entry["start_date"]}
|
||||
|
||||
default_topics = {'General': {'id' :course.location.html_id()}}
|
||||
discussion_topics = course.metadata.get('discussion_topics', default_topics)
|
||||
for topic, entry in discussion_topics.items():
|
||||
for topic, entry in course.discussion_topics.items():
|
||||
category_map['entries'][topic] = {"id": entry["id"],
|
||||
"sort_key": entry.get("sort_key", topic),
|
||||
"start_date": time.gmtime()}
|
||||
|
||||
@@ -46,22 +46,18 @@ github = <a href="${edit_link}">${edit_link | h}</a>
|
||||
%if source_file:
|
||||
source_url = <a href="${source_url}">${source_file | h}</a>
|
||||
%endif
|
||||
<div>
|
||||
<header><h3>Module Fields</h3></header>
|
||||
<table>
|
||||
<tr><th>Module Fields</th></tr>
|
||||
%for name, field in fields:
|
||||
<div>
|
||||
${name} = <pre style="display:inline-block">${field | h}</pre>
|
||||
</div>
|
||||
<tr><td>${name}</td><td><pre style="display:inline-block; margin: 0;">${field | h}</pre></td></tr>
|
||||
%endfor
|
||||
</div>
|
||||
<div>
|
||||
<header><h3>edX Fields</h3></header>
|
||||
</table>
|
||||
<table>
|
||||
<tr><th>edX Fields</th></tr>
|
||||
%for name, field in lms_fields:
|
||||
<div>
|
||||
${name} = <pre style="display:inline-block">${field | h}</pre>
|
||||
</div>
|
||||
<tr><td>${name}</td><td><pre style="display:inline-block; margin: 0;">${field | h}</pre></td></tr>
|
||||
%endfor
|
||||
</div>
|
||||
</table>
|
||||
category = ${category | h}
|
||||
</div>
|
||||
%if render_histogram:
|
||||
@@ -75,18 +71,21 @@ category = ${category | h}
|
||||
|
||||
<script type="text/javascript">
|
||||
// assumes courseware.html's loaded this method.
|
||||
% if staff_access:
|
||||
setup_debug('${element_id}',
|
||||
%if edit_link:
|
||||
'${edit_link}',
|
||||
%else:
|
||||
null,
|
||||
%endif
|
||||
{
|
||||
'location': '${location}',
|
||||
'xqa_key': '${xqa_key}',
|
||||
'category': '${category}',
|
||||
'user': '${user}'
|
||||
});
|
||||
% endif
|
||||
% if staff_access:
|
||||
$(function() {
|
||||
setup_debug('${element_id}',
|
||||
%if edit_link:
|
||||
'${edit_link}',
|
||||
%else:
|
||||
null,
|
||||
%endif
|
||||
{
|
||||
'location': '${location}',
|
||||
'xqa_key': '${xqa_key}',
|
||||
'category': '${category}',
|
||||
'user': '${user}'
|
||||
}
|
||||
);
|
||||
});
|
||||
% endif
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user