Commit 7977491d by Calen Pennington

WIP: LMS Courseware appears to be working

parent b1c9b2ca
...@@ -36,6 +36,11 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -36,6 +36,11 @@ class CourseDescriptor(SequenceDescriptor):
tabs = List(help="List of tabs to enable in this course", scope=Scope.settings) 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) 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_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 has_children = True
info_sidebar_name = String(scope=Scope.settings, default='Course Handouts') info_sidebar_name = String(scope=Scope.settings, default='Course Handouts')
......
...@@ -15,6 +15,7 @@ class DiscussionModule(XModule): ...@@ -15,6 +15,7 @@ class DiscussionModule(XModule):
discussion_id = String(scope=Scope.settings) discussion_id = String(scope=Scope.settings)
discussion_category = String(scope=Scope.settings) discussion_category = String(scope=Scope.settings)
discussion_target = 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) data = String(help="XML definition of inline discussion", scope=Scope.content)
...@@ -42,3 +43,8 @@ class DiscussionDescriptor(RawDescriptor): ...@@ -42,3 +43,8 @@ class DiscussionDescriptor(RawDescriptor):
metadata_translations = dict(RawDescriptor.metadata_translations) metadata_translations = dict(RawDescriptor.metadata_translations)
metadata_translations['id'] = 'discussion_id' metadata_translations['id'] = 'discussion_id'
metadata_translations['for'] = 'discussion_target' 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): ...@@ -145,12 +145,12 @@ def initialize_discussion_info(course):
id = module.discussion_id id = module.discussion_id
category = module.discussion_category category = module.discussion_category
title = module.discussion_target 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("/")]) category = " / ".join([x.strip() for x in category.split("/")])
last_category = category.split("/")[-1] last_category = category.split("/")[-1]
discussion_id_map[id] = {"location": location, "title": last_category + " / " + title} discussion_id_map[id] = {"location": location, "title": last_category + " / " + title}
unexpanded_category_map[category].append({"title": title, "id": id, 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)} category_map = {"entries": defaultdict(dict), "subcategories": defaultdict(dict)}
for category_path, entries in unexpanded_category_map.items(): for category_path, entries in unexpanded_category_map.items():
...@@ -189,9 +189,7 @@ def initialize_discussion_info(course): ...@@ -189,9 +189,7 @@ def initialize_discussion_info(course):
"sort_key": entry["sort_key"], "sort_key": entry["sort_key"],
"start_date": entry["start_date"]} "start_date": entry["start_date"]}
default_topics = {'General': {'id' :course.location.html_id()}} for topic, entry in course.discussion_topics.items():
discussion_topics = course.metadata.get('discussion_topics', default_topics)
for topic, entry in discussion_topics.items():
category_map['entries'][topic] = {"id": entry["id"], category_map['entries'][topic] = {"id": entry["id"],
"sort_key": entry.get("sort_key", topic), "sort_key": entry.get("sort_key", topic),
"start_date": time.gmtime()} "start_date": time.gmtime()}
......
...@@ -46,22 +46,18 @@ github = <a href="${edit_link}">${edit_link | h}</a> ...@@ -46,22 +46,18 @@ github = <a href="${edit_link}">${edit_link | h}</a>
%if source_file: %if source_file:
source_url = <a href="${source_url}">${source_file | h}</a> source_url = <a href="${source_url}">${source_file | h}</a>
%endif %endif
<div> <table>
<header><h3>Module Fields</h3></header> <tr><th>Module Fields</th></tr>
%for name, field in fields: %for name, field in fields:
<div> <tr><td>${name}</td><td><pre style="display:inline-block; margin: 0;">${field | h}</pre></td></tr>
${name} = <pre style="display:inline-block">${field | h}</pre>
</div>
%endfor %endfor
</div> </table>
<div> <table>
<header><h3>edX Fields</h3></header> <tr><th>edX Fields</th></tr>
%for name, field in lms_fields: %for name, field in lms_fields:
<div> <tr><td>${name}</td><td><pre style="display:inline-block; margin: 0;">${field | h}</pre></td></tr>
${name} = <pre style="display:inline-block">${field | h}</pre>
</div>
%endfor %endfor
</div> </table>
category = ${category | h} category = ${category | h}
</div> </div>
%if render_histogram: %if render_histogram:
...@@ -75,18 +71,21 @@ category = ${category | h} ...@@ -75,18 +71,21 @@ category = ${category | h}
<script type="text/javascript"> <script type="text/javascript">
// assumes courseware.html's loaded this method. // assumes courseware.html's loaded this method.
% if staff_access: % if staff_access:
setup_debug('${element_id}', $(function() {
%if edit_link: setup_debug('${element_id}',
'${edit_link}', %if edit_link:
%else: '${edit_link}',
null, %else:
%endif null,
{ %endif
'location': '${location}', {
'xqa_key': '${xqa_key}', 'location': '${location}',
'category': '${category}', 'xqa_key': '${xqa_key}',
'user': '${user}' 'category': '${category}',
}); 'user': '${user}'
% endif }
);
});
% endif
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment