diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index 4eaef20089..45b4e1821c 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -97,6 +97,14 @@ def _textbooks(tab, user, course, active_page): for index, textbook in enumerate(course.textbooks)] return [] + +def _staff_grading(tab, user, course, active_page): + if has_access(user, course, 'staff'): + link = reverse('staff_grading', args=[course.id]) + return [CourseTab('Staff grading', link, active_page == "staff_grading")] + return [] + + #### Validators @@ -132,6 +140,7 @@ VALID_TAB_TYPES = { 'textbooks': TabImpl(null_validator, _textbooks), 'progress': TabImpl(need_name, _progress), 'static_tab': TabImpl(key_checker(['name', 'url_slug']), _static_tab), + 'staff_grading': TabImpl(null_validator, _staff_grading), } diff --git a/lms/djangoapps/instructor/grading.py b/lms/djangoapps/instructor/grading.py new file mode 100644 index 0000000000..7a48b25a49 --- /dev/null +++ b/lms/djangoapps/instructor/grading.py @@ -0,0 +1,25 @@ +""" +LMS part of instructor grading: + +- views + ajax handling +- calls the instructor grading service +""" + +import json +import logging + +log = logging.getLogger(__name__) + + +class StaffGrading(object): + """ + Wrap up functionality for staff grading of submissions--interface exposes get_html, ajax views. + """ + def __init__(self, course): + self.course = course + + def get_html(self): + return "Instructor grading!" + # context = {} + # return render_to_string('courseware/instructor_grading_view.html', context) + diff --git a/lms/djangoapps/instructor/views.py b/lms/djangoapps/instructor/views.py index fec7536151..8a33f1d60b 100644 --- a/lms/djangoapps/instructor/views.py +++ b/lms/djangoapps/instructor/views.py @@ -27,6 +27,9 @@ from xmodule.modulestore.exceptions import InvalidLocationError, ItemNotFoundErr from xmodule.modulestore.search import path_to_location import track.views +from .grading import StaffGrading + + log = logging.getLogger(__name__) template_imports = {'urllib': urllib} @@ -409,6 +412,24 @@ def get_student_grade_summary_data(request, course, course_id, get_grades=True, return datatable + +@cache_control(no_cache=True, no_store=True, must_revalidate=True) +def staff_grading(request, course_id): + """ + Show the instructor grading interface. + """ + course = get_course_with_access(request.user, course_id, 'staff') + + grading = StaffGrading(course) + + return render_to_response('instructor/staff_grading.html', { + 'view_html': grading.get_html(), + 'course': course, + 'course_id': course_id, + # Checked above + 'staff_access': True, }) + + @cache_control(no_cache=True, no_store=True, must_revalidate=True) def gradebook(request, course_id): """ diff --git a/lms/templates/instructor/staff_grading.html b/lms/templates/instructor/staff_grading.html new file mode 100644 index 0000000000..b00fd935aa --- /dev/null +++ b/lms/templates/instructor/staff_grading.html @@ -0,0 +1,20 @@ +<%inherit file="/main.html" /> +<%block name="bodyclass">${course.css_class} +<%namespace name='static' file='/static_content.html'/> + +<%block name="headextra"> + <%static:css group='course'/> + + +<%block name="title">${course.number} Staff Grading + +<%include file="/courseware/course_navigation.html" args="active_page='staff_grading'" /> + +<%block name="js_extra"> + + +
+
+ ${view_html} +
+
diff --git a/lms/urls.py b/lms/urls.py index 62842ec5fe..7c1ccb6bde 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -230,6 +230,8 @@ if settings.COURSEWARE_ENABLED: 'instructor.views.grade_summary', name='grade_summary'), url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/enroll_students$', 'instructor.views.enroll_students', name='enroll_students'), + url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/staff_grading$', + 'instructor.views.staff_grading', name='staff_grading'), ) # discussion forums live within courseware, so courseware must be enabled first