From 2969a9e48dce189769052b29dd583c4738fdf1fb Mon Sep 17 00:00:00 2001 From: cahrens Date: Wed, 23 Jan 2013 16:19:17 -0500 Subject: [PATCH 1/8] Toggling of code should mark editor as dirty. --- common/lib/xmodule/xmodule/js/src/html/edit.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/lib/xmodule/xmodule/js/src/html/edit.coffee b/common/lib/xmodule/xmodule/js/src/html/edit.coffee index 35c4464c89..39f1d8edef 100644 --- a/common/lib/xmodule/xmodule/js/src/html/edit.coffee +++ b/common/lib/xmodule/xmodule/js/src/html/edit.coffee @@ -54,6 +54,9 @@ class @HTMLEditingDescriptor image : '/static/images/ico-tinymce-code.png', onclick : () -> ed.formatter.toggle('code') + # Without this, the dirty flag does not get set unless the user also types in text. + # Visual Editor must be marked as dirty or else we won't populate the Advanced Editor from it. + ed.isNotDirty = false }) ed.onNodeChange.add((editor, command, e) -> From 2856971b45de4dcfc9745df61cd66a721a301fd0 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Wed, 23 Jan 2013 16:36:16 -0500 Subject: [PATCH 2/8] update templates to include attemps and weight values. Also update capa_module.py to accept empty strings ('') to mean 'default value' --- common/lib/xmodule/xmodule/capa_module.py | 8 +++++--- .../xmodule/templates/problem/circuitschematic.yaml | 2 ++ .../xmodule/xmodule/templates/problem/customgrader.yaml | 2 ++ common/lib/xmodule/xmodule/templates/problem/empty.yaml | 2 ++ .../xmodule/templates/problem/forumularesponse.yaml | 2 ++ .../xmodule/xmodule/templates/problem/imageresponse.yaml | 2 ++ .../xmodule/xmodule/templates/problem/multiplechoice.yaml | 2 ++ .../xmodule/templates/problem/numericalresponse.yaml | 2 ++ .../xmodule/xmodule/templates/problem/optionresponse.yaml | 2 ++ .../xmodule/templates/problem/string_response.yaml | 2 ++ 10 files changed, 23 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 2581973f92..e4ab804f49 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -116,9 +116,11 @@ class CapaModule(XModule): self.grace_period = None self.close_date = self.display_due_date - self.max_attempts = self.metadata.get('attempts', None) - if self.max_attempts is not None: - self.max_attempts = int(self.max_attempts) + max_attempts = self.metadata.get('attempts', None) + if max_attempts: + self.max_attempts = int(max_attempts) + else: + self.max_attempts = None self.show_answer = self.metadata.get('showanswer', 'closed') diff --git a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml index ced38faba6..f56b17b1b9 100644 --- a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml @@ -3,6 +3,8 @@ metadata: display_name: Circuit Schematic rerandomize: never showanswer: always + weight: "" + attempts: "" data: | Please make a voltage divider that splits the provided voltage evenly. diff --git a/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml b/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml index 1227e93829..6ada6f97f3 100644 --- a/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/customgrader.yaml @@ -3,6 +3,8 @@ metadata: display_name: Custom Grader rerandomize: never showanswer: always + weight: "" + attempts: "" data: |

diff --git a/common/lib/xmodule/xmodule/templates/problem/empty.yaml b/common/lib/xmodule/xmodule/templates/problem/empty.yaml index ae5491ff9f..346f49609c 100644 --- a/common/lib/xmodule/xmodule/templates/problem/empty.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/empty.yaml @@ -4,6 +4,8 @@ metadata: rerandomize: never showanswer: always markdown: "" + weight: "" + attempts: "" data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml index 231530b9f3..5b30a0497d 100644 --- a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml @@ -3,6 +3,8 @@ metadata: display_name: Formula Response rerandomize: never showanswer: always + weight: "" + attempts: "" data: |

diff --git a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml index 3a941aa939..069c157852 100644 --- a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml @@ -3,6 +3,8 @@ metadata: display_name: Image Response rerandomize: never showanswer: always + weight: "" + attempts: "" data: |

diff --git a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml index 322757beee..9e61324ae1 100644 --- a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml @@ -3,6 +3,8 @@ metadata: display_name: Multiple Choice rerandomize: never showanswer: always + weight: "" + attempts: "" markdown: "A multiple choice problem presents radio buttons for student input. Students can only select a single option presented. Multiple Choice questions have been the subject of many areas of research due to the early diff --git a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml index bdca1ef789..e0a5776222 100644 --- a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml @@ -3,6 +3,8 @@ metadata: display_name: Numerical Response rerandomize: never showanswer: always + weight: "" + attempts: "" markdown: "A numerical response problem accepts a line of text input from the student, and evaluates the input for correctness based on its diff --git a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml index d2603ca607..1a42a5a009 100644 --- a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml @@ -3,6 +3,8 @@ metadata: display_name: Option Response rerandomize: never showanswer: always + weight: "" + attempts: "" markdown: "OptionResponse gives a limited set of options for students to respond with, and presents those options in a format that encourages them to search for a specific answer rather than being immediately presented diff --git a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml index 987ee9a7bf..1761ea8f67 100644 --- a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml @@ -3,6 +3,8 @@ metadata: display_name: String Response rerandomize: never showanswer: always + weight: "" + attempts: "" # Note, the extra newlines are needed to make the yaml parser add blank lines instead of folding markdown: "A string response problem accepts a line of text input from the From 4a79643fde639fc40ededcbab59f9631bd750800 Mon Sep 17 00:00:00 2001 From: cahrens Date: Wed, 23 Jan 2013 16:43:49 -0500 Subject: [PATCH 3/8] Make code inline instead of block. --- common/lib/xmodule/xmodule/js/src/html/edit.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/html/edit.coffee b/common/lib/xmodule/xmodule/js/src/html/edit.coffee index 39f1d8edef..ea02d78e63 100644 --- a/common/lib/xmodule/xmodule/js/src/html/edit.coffee +++ b/common/lib/xmodule/xmodule/js/src/html/edit.coffee @@ -22,11 +22,13 @@ class @HTMLEditingDescriptor schema: "html5", # TODO: we should share this CSS with studio (and LMS) content_css : "/static/css/tiny-mce.css", - # Disable h4, h5, and h6 styles as we don't have CSS for them. formats : { + # Disable h4, h5, and h6 styles as we don't have CSS for them. h4: {}, h5: {}, - h6: {} + h6: {}, + # tinyMCE does block level for code by default + code: {inline: 'code'} }, # Disable visual aid on borderless table. visual:false, @@ -50,7 +52,7 @@ class @HTMLEditingDescriptor @setupTinyMCE: (ed) -> ed.addButton('wrapAsCode', { - title : 'Code Block', + title : 'Code', image : '/static/images/ico-tinymce-code.png', onclick : () -> ed.formatter.toggle('code') From 711cc9a041f707cf6658eccb0b3b695a1e1962ab Mon Sep 17 00:00:00 2001 From: cahrens Date: Wed, 23 Jan 2013 20:18:28 -0500 Subject: [PATCH 4/8] Tell tinyMCE to not change image paths. #143 --- common/lib/xmodule/xmodule/js/src/html/edit.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/lib/xmodule/xmodule/js/src/html/edit.coffee b/common/lib/xmodule/xmodule/js/src/html/edit.coffee index ea02d78e63..fa83343d7a 100644 --- a/common/lib/xmodule/xmodule/js/src/html/edit.coffee +++ b/common/lib/xmodule/xmodule/js/src/html/edit.coffee @@ -20,6 +20,8 @@ class @HTMLEditingDescriptor theme : "advanced", skin: 'studio', schema: "html5", + # Necessary to preserve relative URLs to our images. + convert_urls : false, # TODO: we should share this CSS with studio (and LMS) content_css : "/static/css/tiny-mce.css", formats : { From 0cb5f101ae1440a3a7fc81b6d10cac46eba2c875 Mon Sep 17 00:00:00 2001 From: Brian Wilson Date: Thu, 24 Jan 2013 01:18:10 -0500 Subject: [PATCH 5/8] add UTC time to registration end date --- common/lib/xmodule/xmodule/course_module.py | 2 +- lms/templates/test_center_register.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 5416dae583..7f97ca69dc 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -655,7 +655,7 @@ class CourseDescriptor(SequenceDescriptor): @property def registration_end_date_text(self): - return time.strftime("%b %d, %Y", self.registration_end_date) + return time.strftime("%b %d, %Y at %H:%M UTC", self.registration_end_date) @property def current_test_center_exam(self): diff --git a/lms/templates/test_center_register.html b/lms/templates/test_center_register.html index f6c53c0e89..6b87860fad 100644 --- a/lms/templates/test_center_register.html +++ b/lms/templates/test_center_register.html @@ -466,7 +466,7 @@ Last Eligible Appointment Date: ${exam_info.last_eligible_appointment_date_text}

  • - Registration End Date: ${exam_info.registration_end_date_text} + Registration Ends: ${exam_info.registration_end_date_text}
  • % endif From dfbe7dd4f9fb52f3f5fd81520d83eb35f6251f63 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Thu, 24 Jan 2013 15:54:02 -0500 Subject: [PATCH 6/8] fix merge problem. assign_default_role() ended up being defined twice as that code was added in both master and cms-master branches, but the merge didn't pick it up as a conflict --- lms/djangoapps/django_comment_client/models.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lms/djangoapps/django_comment_client/models.py b/lms/djangoapps/django_comment_client/models.py index 631e68f2fe..10c05c75e9 100644 --- a/lms/djangoapps/django_comment_client/models.py +++ b/lms/djangoapps/django_comment_client/models.py @@ -62,14 +62,3 @@ class Permission(models.Model): def __unicode__(self): return self.name - - -@receiver(post_save, sender=CourseEnrollment) -def assign_default_role(sender, instance, **kwargs): - if instance.user.is_staff: - role = Role.objects.get_or_create(course_id=instance.course_id, name="Moderator")[0] - else: - role = Role.objects.get_or_create(course_id=instance.course_id, name="Student")[0] - - logging.info("assign_default_role: adding %s as %s" % (instance.user, role)) - instance.user.roles.add(role) From 896933a3c4cae51492f92fd49a12c42f9ffa6040 Mon Sep 17 00:00:00 2001 From: Jay Zoldak Date: Thu, 24 Jan 2013 17:02:18 -0500 Subject: [PATCH 7/8] Fix broken IE --- .../js/src/graphical_slider_tool/el_output.js | 12 +++++------ .../g_label_el_output.js | 12 +++++------ .../js/src/graphical_slider_tool/graph.js | 20 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/el_output.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/el_output.js index 3175aae3f0..d713c6f2ac 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/el_output.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/el_output.js @@ -8,13 +8,13 @@ define('ElOutput', ['logme'], function (logme) { function ElOutput(config, state) { - if ($.isPlainObject(config.functions.function)) { - processFuncObj(config.functions.function); - } else if ($.isArray(config.functions.function)) { + if ($.isPlainObject(config.functions["function"])) { + processFuncObj(config.functions["function"]); + } else if ($.isArray(config.functions["function"])) { (function (c1) { - while (c1 < config.functions.function.length) { - if ($.isPlainObject(config.functions.function[c1])) { - processFuncObj(config.functions.function[c1]); + while (c1 < config.functions["function"].length) { + if ($.isPlainObject(config.functions["function"][c1])) { + processFuncObj(config.functions["function"][c1]); } c1 += 1; diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/g_label_el_output.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/g_label_el_output.js index 13c9dd3389..3e9e12b62e 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/g_label_el_output.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/g_label_el_output.js @@ -6,13 +6,13 @@ define('GLabelElOutput', ['logme'], function (logme) { return GLabelElOutput; function GLabelElOutput(config, state) { - if ($.isPlainObject(config.functions.function)) { - processFuncObj(config.functions.function); - } else if ($.isArray(config.functions.function)) { + if ($.isPlainObject(config.functions["function"])) { + processFuncObj(config.functions["function"]); + } else if ($.isArray(config.functions["function"])) { (function (c1) { - while (c1 < config.functions.function.length) { - if ($.isPlainObject(config.functions.function[c1])) { - processFuncObj(config.functions.function[c1]); + while (c1 < config.functions["function"].length) { + if ($.isPlainObject(config.functions["function"][c1])) { + processFuncObj(config.functions["function"][c1]); } c1 += 1; diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js index 5b6223df43..9f0d5046ca 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js @@ -838,33 +838,33 @@ define('Graph', ['logme'], function (logme) { return; } - if (typeof config.functions.function === 'string') { + if (typeof config.functions["function"] === 'string') { // If just one function string is present. - addFunction(config.functions.function); + addFunction(config.functions["function"]); - } else if ($.isPlainObject(config.functions.function) === true) { + } else if ($.isPlainObject(config.functions["function"]) === true) { // If a function is present, but it also has properties // defined. - callAddFunction(config.functions.function); + callAddFunction(config.functions["function"]); - } else if ($.isArray(config.functions.function)) { + } else if ($.isArray(config.functions["function"])) { // If more than one function is defined. - for (c1 = 0; c1 < config.functions.function.length; c1 += 1) { + for (c1 = 0; c1 < config.functions["function"].length; c1 += 1) { // For each definition, we must check if it is a simple // string definition, or a complex one with properties. - if (typeof config.functions.function[c1] === 'string') { + if (typeof config.functions["function"][c1] === 'string') { // Simple string. - addFunction(config.functions.function[c1]); + addFunction(config.functions["function"][c1]); - } else if ($.isPlainObject(config.functions.function[c1])) { + } else if ($.isPlainObject(config.functions["function"][c1])) { // Properties are present. - callAddFunction(config.functions.function[c1]); + callAddFunction(config.functions["function"][c1]); } } From 1787157e009888b1819e1b88f1913661016a6b0d Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Thu, 24 Jan 2013 21:38:02 -0500 Subject: [PATCH 8/8] put back the 'position' argument to get_module() which got accidentially - or so I think - dropped in a previous commit --- lms/djangoapps/courseware/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index b1c4a5e9a9..c00aa25dae 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -235,7 +235,7 @@ def index(request, course_id, chapter=None, section=None, # Load all descendents of the section, because we're going to display it's # html, which in general will need all of its children section_module = get_module(request.user, request, section_descriptor.location, - student_module_cache, course.id, depth=None) + student_module_cache, course.id, position=position, depth=None) if section_module is None: # User may be trying to be clever and access something # they don't have access to.