From 62a2a6501d7c3cab9fe77f2f44ee32c4d4a36a3f Mon Sep 17 00:00:00 2001
From: "Dave St.Germain"
Date: Mon, 24 Mar 2014 14:53:21 -0400
Subject: [PATCH 1/2] Added image tags to the whitelist for matlab
---
common/lib/capa/capa/inputtypes.py | 10 ++++++++--
common/lib/capa/capa/tests/test_inputtypes.py | 5 +++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py
index a9ce23c2e5..a0631a12db 100644
--- a/common/lib/capa/capa/inputtypes.py
+++ b/common/lib/capa/capa/inputtypes.py
@@ -804,9 +804,15 @@ class MatlabInput(CodeInput):
# the graded response takes precedence
if 'queue_msg' in self.input_state and self.status in ['queued', 'incomplete', 'unsubmitted']:
attributes = bleach.ALLOWED_ATTRIBUTES.copy()
- attributes.update({'*': ['class', 'style', 'id'], 'audio': ['controls', 'autobuffer', 'autoplay', 'src']})
+ # Yuck! but bleach does not offer the option of passing in allowed_protocols,
+ # and matlab uses data urls for images
+ if u'data' not in bleach.BleachSanitizer.allowed_protocols:
+ bleach.BleachSanitizer.allowed_protocols.append(u'data')
+ attributes.update({'*': ['class', 'style', 'id'],
+ 'audio': ['controls', 'autobuffer', 'autoplay', 'src'],
+ 'img': ['src', 'width', 'height', 'class']})
self.queue_msg = bleach.clean(self.input_state['queue_msg'],
- tags=bleach.ALLOWED_TAGS + ['div', 'p', 'audio', 'pre'],
+ tags=bleach.ALLOWED_TAGS + ['div', 'p', 'audio', 'pre', 'img'],
styles=['white-space'],
attributes=attributes
)
diff --git a/common/lib/capa/capa/tests/test_inputtypes.py b/common/lib/capa/capa/tests/test_inputtypes.py
index 890dbb2ecc..cba14ff0f2 100644
--- a/common/lib/capa/capa/tests/test_inputtypes.py
+++ b/common/lib/capa/capa/tests/test_inputtypes.py
@@ -665,7 +665,8 @@ class MatlabTest(unittest.TestCase):
Zero or more ELSEIF parts can be used as well as nested if's.
The expression is usually of the form expr rop expr where
rop is ==, <, >, <=, >=, or ~=.
-
+
+
Example
if I == J
A(I,J) = 2;
@@ -692,7 +693,7 @@ class MatlabTest(unittest.TestCase):
the_input = self.input_class(test_capa_system(), elt, state)
context = the_input._get_render_context() # pylint: disable=W0212
self.maxDiff = None
- expected = u'\n
if Conditionally execute statements.\nThe general form of the if statement is\n\n if expression\n statements\n ELSEIF expression\n statements\n ELSE\n statements\n END\n\nThe statements are executed if the real part of the expression \nhas all non-zero elements. The ELSE and ELSEIF parts are optional.\nZero or more ELSEIF parts can be used as well as nested if\'s.\nThe expression is usually of the form expr rop expr where \nrop is ==, <, >, <=, >=, or ~=.\n\nExample\n if I == J\n A(I,J) = 2;\n elseif abs(I-J) == 1\n A(I,J) = -1;\n else\n A(I,J) = 0;\n end\n\nSee also relop, else, elseif, end, for, while, switch.\n\nReference page in Help browser\n doc if\n\n
\n'
+ expected = u'\n
if Conditionally execute statements.\nThe general form of the if statement is\n\n if expression\n statements\n ELSEIF expression\n statements\n ELSE\n statements\n END\n\nThe statements are executed if the real part of the expression \nhas all non-zero elements. The ELSE and ELSEIF parts are optional.\nZero or more ELSEIF parts can be used as well as nested if\'s.\nThe expression is usually of the form expr rop expr where \nrop is ==, <, >, <=, >=, or ~=.\n\n\nExample\n if I == J\n A(I,J) = 2;\n elseif abs(I-J) == 1\n A(I,J) = -1;\n else\n A(I,J) = 0;\n end\n\nSee also relop, else, elseif, end, for, while, switch.\n\nReference page in Help browser\n doc if\n\n
\n'
self.assertEqual(context['queue_msg'], expected)
From 3f318331788f2f8f51271f11e532808429e74278 Mon Sep 17 00:00:00 2001
From: Gabe Mulley
Date: Tue, 18 Mar 2014 13:34:16 -0400
Subject: [PATCH 2/2] Clean up references to answer distribution-like things
In the near future an answer distribution report will be displayed in the data download reports table. In order to avoid confusion, we need to clean up several misleading labels and remove a redundant feature.
Note that the redundant feature is surrounded by a feature flag so that it can be disabled once the report goes live in the table.
Fixes: AN-694
---
.../instructor_dashboard/data_download.coffee | 2 +-
.../courseware/instructor_dashboard.html | 4 +++-
.../instructor_dashboard_2/analytics.html | 2 +-
.../instructor_dashboard_2/data_download.html | 21 ++++++++++++-------
4 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/lms/static/coffee/src/instructor_dashboard/data_download.coffee b/lms/static/coffee/src/instructor_dashboard/data_download.coffee
index 535f3d2b16..3ff456c871 100644
--- a/lms/static/coffee/src/instructor_dashboard/data_download.coffee
+++ b/lms/static/coffee/src/instructor_dashboard/data_download.coffee
@@ -171,7 +171,7 @@ class ReportDownloads
columns = [
id: 'link'
field: 'link'
- name: gettext('File Name (Newest First)')
+ name: gettext('File Name')
toolTip: gettext("Links are generated on demand and expire within 5 minutes due to the sensitive nature of student information.")
sortable: false
minWidth: 150
diff --git a/lms/templates/courseware/instructor_dashboard.html b/lms/templates/courseware/instructor_dashboard.html
index 2fb5633ac3..2dda9274e2 100644
--- a/lms/templates/courseware/instructor_dashboard.html
+++ b/lms/templates/courseware/instructor_dashboard.html
@@ -207,7 +207,9 @@ function goto( mode)
+ %if not settings.FEATURES.get('ENABLE_ASYNC_ANSWER_DISTRIBUTION'):
+ %endif
@@ -639,7 +641,7 @@ function goto( mode)
%if analytics_results.get("ProblemGradeDistribution"):
- ${_("Answer distribution for problems")}
+ ${_("Score distribution for problems")}
(${analytics_results["ProblemGradeDistribution"]['time']})