From 7977491ddf5ba8dadc3d45b8072e75b9a03d7238 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 14 Dec 2012 09:04:34 -0500 Subject: [PATCH] WIP: LMS Courseware appears to be working --- common/lib/xmodule/xmodule/course_module.py | 5 ++ .../lib/xmodule/xmodule/discussion_module.py | 6 +++ lms/djangoapps/django_comment_client/utils.py | 8 ++- lms/templates/staff_problem_info.html | 51 +++++++++---------- 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index b8d4032a18..596344d934 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -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') diff --git a/common/lib/xmodule/xmodule/discussion_module.py b/common/lib/xmodule/xmodule/discussion_module.py index 19a2b4300f..b373f337fb 100644 --- a/common/lib/xmodule/xmodule/discussion_module.py +++ b/common/lib/xmodule/xmodule/discussion_module.py @@ -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) diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py index 174805a999..bb91dfaa28 100644 --- a/lms/djangoapps/django_comment_client/utils.py +++ b/lms/djangoapps/django_comment_client/utils.py @@ -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()} diff --git a/lms/templates/staff_problem_info.html b/lms/templates/staff_problem_info.html index e0c957a05c..4fee7c22fb 100644 --- a/lms/templates/staff_problem_info.html +++ b/lms/templates/staff_problem_info.html @@ -46,22 +46,18 @@ github = ${edit_link | h} %if source_file: source_url = ${source_file | h} %endif -
-

Module Fields

+ + %for name, field in fields: -
- ${name} =
${field | h}
-
+ %endfor - -
-

edX Fields

+
Module Fields
${name}
${field | h}
+ + %for name, field in lms_fields: -
- ${name} =
${field | h}
-
+ %endfor - +
edX Fields
${name}
${field | h}
category = ${category | h}
%if render_histogram: @@ -75,18 +71,21 @@ category = ${category | h}