diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 0c596b73bfad..7b5dddc0294f 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -29,6 +29,7 @@ from xblock.field_data import DictFieldData from xblock.fields import ScopeIds +from openedx.core.lib.instructor_dashboard_tabs import InstructorDashboardTabPluginManager from bulk_email.api import is_bulk_email_feature_enabled from class_dashboard.dashboard_data import get_array_section_has_problem, get_section_display_name from course_modes.models import CourseMode, CourseModesArchive @@ -234,6 +235,10 @@ def instructor_dashboard_2(request, course_id): certificate_invalidations = CertificateInvalidation.get_certificate_invalidations(course_key) + # load externally registered sections + for Tab in InstructorDashboardTabPluginManager.get_tabs(): + sections.append(Tab(course, access).to_dict()) + context = { 'course': course, 'studio_url': get_studio_url(course, 'course'), diff --git a/openedx/core/djangoapps/course_groups/views.py b/openedx/core/djangoapps/course_groups/views.py index 696e0fcc469a..4479b829327d 100644 --- a/openedx/core/djangoapps/course_groups/views.py +++ b/openedx/core/djangoapps/course_groups/views.py @@ -503,6 +503,9 @@ class CohortHandler(DeveloperErrorViewMixin, APIPermissions): * user_partition_id: The integer identified of the UserPartition. * group_id: The integer identified of the specific group in the partition. """ + + queryset = '' + def get(self, request, course_key_string, cohort_id=None): """ Endpoint to get either one or all cohorts. @@ -528,6 +531,8 @@ def post(self, request, course_key_string, cohort_id=None): 'Please use the parent endpoint.', 'wrong-endpoint') course_key, course = _get_course_with_access(request, course_key_string) + + # TODO: add bulk import support for this name = request.data.get('name') if not name: raise self.api_error(status.HTTP_400_BAD_REQUEST, diff --git a/openedx/core/lib/instructor_dashboard_tabs.py b/openedx/core/lib/instructor_dashboard_tabs.py new file mode 100644 index 000000000000..efcc05795afd --- /dev/null +++ b/openedx/core/lib/instructor_dashboard_tabs.py @@ -0,0 +1,28 @@ +""" +Tabs for the instructor dashboard. +""" +from __future__ import absolute_import + +from openedx.core.lib.plugins import PluginManager + + +# Stevedore extension point namespaces +INSTRUCTOR_DASHBOARD_TAB_NAMESPACE = 'lms.instructor_dashboard.tab' + + +class InstructorDashboardTabPluginManager(PluginManager): + """ + Manager for all of the course tabs that have been made available. + + TODO: develop abstract base class for tabs to implement. + """ + NAMESPACE = INSTRUCTOR_DASHBOARD_TAB_NAMESPACE + + @classmethod + def get_tabs(cls): + """ + Returns the list of available tabs in their canonical order. + """ + tabs = list(cls.get_available_plugins().values()) + tabs.sort(key=lambda tab: (tab.priority, tab.section_key)) + return tabs