diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 4171c3c3f0..61bd7a079e 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -250,6 +250,7 @@ def instructor_dashboard_2(request, course_id): 'generate_bulk_certificate_exceptions_url': generate_bulk_certificate_exceptions_url, 'certificate_exception_view_url': certificate_exception_view_url, 'certificate_invalidation_view_url': certificate_invalidation_view_url, + 'xqa_server': settings.FEATURES.get('XQA_SERVER', "http://your_xqa_server.com"), } return render_to_response('instructor/instructor_dashboard_2/instructor_dashboard_2.html', context) diff --git a/lms/static/js/spec/staff_debug_actions_spec.js b/lms/static/js/spec/staff_debug_actions_spec.js index 2ce26f7d55..6828f5d3a2 100644 --- a/lms/static/js/spec/staff_debug_actions_spec.js +++ b/lms/static/js/spec/staff_debug_actions_spec.js @@ -31,6 +31,15 @@ define([ }); }); + describe('getURL ', function() { + it('defines that getCurrentUrl works on instructor page as expected', function() { + spyOn(StaffDebug, 'getCurrentUrl') + .and.returnValue('/courses/edx_demo_course/instructor#view-open_response_assessment'); + expect(StaffDebug.getURL('rescore_problem')) + .toBe('/courses/edx_demo_course/instructor/api/rescore_problem'); + }); + }); + describe('sanitizeString', function() { it('escapes escapable characters in a string', function() { expect(StaffDebug.sanitizeString('.*+?^:${}()|][')) diff --git a/lms/static/js/staff_debug_actions.js b/lms/static/js/staff_debug_actions.js index 65b5717b65..fc808a6950 100644 --- a/lms/static/js/staff_debug_actions.js +++ b/lms/static/js/staff_debug_actions.js @@ -4,7 +4,11 @@ var StaffDebug = (function() { /* global getCurrentUrl:true */ var getURL = function(action) { var pathname = this.getCurrentUrl(); - return pathname.substr(0, pathname.indexOf('/courseware')) + '/instructor/api/' + action; + var index = pathname.indexOf('/courseware'); + if (index <= 0) { + index = pathname.indexOf('/', '/courses/'.length); + } + return pathname.substr(0, index) + '/instructor/api/' + action; }; var sanitizeString = function(string) { @@ -48,7 +52,10 @@ var StaffDebug = (function() { var html = _.template('
{text}
', {interpolate: /\{(.+?)\}/g})( {text: text} ); - $('#result_' + sanitizeString(action.locationName)).html(html); + edx.HtmlUtils.setHtml( + $('#result_' + sanitizeString(action.locationName)), + edx.HtmlUtils.HTML(html) + ); }, error: function(request, status, error) { var responseJSON; @@ -66,7 +73,10 @@ var StaffDebug = (function() { var html = _.template('{text}
', {interpolate: /\{(.+?)\}/g})( {text: text} ); - $('#result_' + sanitizeString(action.locationName)).html(html); + edx.HtmlUtils.setHtml( + $('#result_' + sanitizeString(action.locationName)), + edx.HtmlUtils.HTML(html) + ); }, dataType: 'json' }); diff --git a/lms/static/sass/course/instructor/_instructor_2.scss b/lms/static/sass/course/instructor/_instructor_2.scss index cf874d1237..6a18f4741b 100644 --- a/lms/static/sass/course/instructor/_instructor_2.scss +++ b/lms/static/sass/course/instructor/_instructor_2.scss @@ -2905,3 +2905,40 @@ input[name="subject"] { } } } + +div.staff_info { + display: none; + + @include clearfix(); + + white-space: pre-wrap; + border-top: 1px solid $gray-l3; + padding-top: lh(); + margin-top: lh(); + line-height: lh(); + font-family: Consolas, "Lucida Console", Monaco, "Courier New", Courier, monospace; + + // Debugging content is always in English, therefore it's never RTL + direction: ltr; + text-align: left; +} + +.xqa-modal, +.staff-modal, +.history-modal { + width: 80%; + height: 80%; + left: left(20%); + overflow: auto; + display: none; +} + +div.staff_actions { + p.error { + color: theme-color("danger"); + } + + p.success { + color: theme-color("success"); + } +} diff --git a/lms/templates/courseware/xqa_interface.html b/lms/templates/courseware/xqa_interface.html index df6035acad..891ea10de3 100644 --- a/lms/templates/courseware/xqa_interface.html +++ b/lms/templates/courseware/xqa_interface.html @@ -28,7 +28,7 @@ function setup_debug(element_id, edit_link, staff_context){ var username = $("#" + element_id + "_history_student_username").val(); var location = $("#" + element_id + "_history_location").val(); // xss-lint: disable=mako-invalid-js-filter - $("#" + element_id + "_history_text").load('/courses/' + "${six.text_type(course.id) | u}" + + $("#" + element_id + "_history_text").load('/courses/' + "${six.text_type(getattr(course,'id','')) | u}" + "/submission_history/" + username + "/" + location); return false; } diff --git a/lms/templates/instructor/instructor_dashboard_2/open_response_assessment.html b/lms/templates/instructor/instructor_dashboard_2/open_response_assessment.html index 24b71e92f9..e9e3b62e41 100644 --- a/lms/templates/instructor/instructor_dashboard_2/open_response_assessment.html +++ b/lms/templates/instructor/instructor_dashboard_2/open_response_assessment.html @@ -1,6 +1,8 @@ <%page args="section_data" expression_filter="h"/> <%! from openedx.core.djangolib.markup import HTML %> +<%include file="/courseware/xqa_interface.html/"/> +