diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 92837e8448..65931e2842 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -2856,7 +2856,9 @@ def change_due_date(request, course_id): student = require_student_from_identifier(request.POST.get('student')) unit = find_unit(course, request.POST.get('url')) due_date = parse_datetime(request.POST.get('due_datetime')) - set_due_date_extension(course, unit, student, due_date, request.user) + reason = strip_tags(request.POST.get('reason', '')) + + set_due_date_extension(course, unit, student, due_date, request.user, reason=reason) return JsonResponse(_( u'Successfully changed due date for student {0} for {1} ' @@ -2877,7 +2879,9 @@ def reset_due_date(request, course_id): course = get_course_by_id(CourseKey.from_string(course_id)) student = require_student_from_identifier(request.POST.get('student')) unit = find_unit(course, request.POST.get('url')) - set_due_date_extension(course, unit, student, None, request.user) + reason = strip_tags(request.POST.get('reason', '')) + + set_due_date_extension(course, unit, student, None, request.user, reason=reason) if not getattr(unit, "due", None): # It's possible the normal due date was deleted after an extension was granted: return JsonResponse( diff --git a/lms/djangoapps/instructor/views/tools.py b/lms/djangoapps/instructor/views/tools.py index 80e52e9b1a..1f5370fe97 100644 --- a/lms/djangoapps/instructor/views/tools.py +++ b/lms/djangoapps/instructor/views/tools.py @@ -150,20 +150,20 @@ def title_or_url(node): return title -def set_due_date_extension(course, unit, student, due_date, actor=None): +def set_due_date_extension(course, unit, student, due_date, actor=None, reason=''): """ Sets a due date extension. Raises DashboardError if the unit or extended due date is invalid. """ if due_date: try: - api.set_date_for_block(course.id, unit.location, 'due', due_date, user=student, reason=None, actor=actor) + api.set_date_for_block(course.id, unit.location, 'due', due_date, user=student, reason=reason, actor=actor) except api.MissingDateError: raise DashboardError(_(u"Unit {0} has no due date to extend.").format(unit.location)) except api.InvalidDateError: raise DashboardError(_("An extended due date must be later than the original due date.")) else: - api.set_date_for_block(course.id, unit.location, 'due', None, user=student, reason=None, actor=actor) + api.set_date_for_block(course.id, unit.location, 'due', None, user=student, reason=reason, actor=actor) def dump_module_extensions(course, unit): diff --git a/lms/static/js/instructor_dashboard/extensions.js b/lms/static/js/instructor_dashboard/extensions.js index 21e5ee9273..342ac113ea 100644 --- a/lms/static/js/instructor_dashboard/extensions.js +++ b/lms/static/js/instructor_dashboard/extensions.js @@ -25,10 +25,13 @@ ext.$student_input = ext.$section.find("#set-extension input[name='student']"); ext.$url_input = ext.$section.find("#set-extension select[name='url']"); ext.$due_datetime_input = ext.$section.find("#set-extension input[name='due_datetime']"); + ext.$reason_input = ext.$section.find("#set-extension input[name='reason']"); + sendData = { student: ext.$student_input.val(), url: ext.$url_input.val(), - due_datetime: ext.$due_datetime_input.val() + due_datetime: ext.$due_datetime_input.val(), + reason: ext.$reason_input.val() }; return $.ajax({ type: 'POST', @@ -48,9 +51,12 @@ ext.clear_display(); ext.$student_input = ext.$section.find("#reset-extension input[name='student']"); ext.$url_input = ext.$section.find("#reset-extension select[name='url']"); + ext.$reason_input = ext.$section.find("#reset-extension input[name='reason']"); + sendData = { student: ext.$student_input.val(), - url: ext.$url_input.val() + url: ext.$url_input.val(), + reason: ext.$reason_input.val() }; return $.ajax({ type: 'POST', diff --git a/lms/templates/instructor/instructor_dashboard_2/extensions.html b/lms/templates/instructor/instructor_dashboard_2/extensions.html index b464394d11..504080cb8f 100644 --- a/lms/templates/instructor/instructor_dashboard_2/extensions.html +++ b/lms/templates/instructor/instructor_dashboard_2/extensions.html @@ -7,7 +7,7 @@ from django.utils.translation import ugettext as _

${_("Individual due date extensions")}

${_("In this section, you have the ability to grant extensions on specific " - "units to individual students. Please note that the latest date is always " + "subsections to individual students. Please note that the latest date is always " "taken; you cannot use this tool to make an assignment due earlier for a " "particular student.")}

@@ -17,7 +17,7 @@ from django.utils.translation import ugettext as _

- ${_("Choose the graded unit:")} + ${_("Choose the graded subsection:")} + placeholder="${format_string}"/>

@@ -45,14 +45,14 @@ from django.utils.translation import ugettext as _

${_("Viewing granted extensions")}

${_("Here you can see what extensions have been granted on particular " - "units or for a particular student.")} + "subsection or for a particular student.")}

- ${_("Choose a graded unit and click the button to obtain a list of all " - "students who have extensions for the given unit.")} + ${_("Choose a graded subsection and click the button to obtain a list of all " + "students who have extensions for the given subsection.")}

- ${_("Choose the graded unit:")} + ${_("Choose the graded subsection:")}

- ${_("Choose the graded unit:")} + ${_("Choose the graded subsection:")} +