Files
edx-platform/lms/djangoapps/discussion/plugins.py
Kshitij Sobti 6769a280a9 Added a new LTI-based course tab, and LtiDiscussion tab
This PR lays the groundwork for a an LTI tab that can embed any LTI1.1-based
tool as an course tab. It also adds another tab based on this LTI Tab that
offers special support for embedding LTI-based discussion tools in a course
tab. If enabled this will replace the existing discussion tab.
2021-01-20 16:24:55 +05:30

38 lines
1.3 KiB
Python

"""
Views handling read (GET) requests for the Discussion tab and inline discussions.
"""
from django.conf import settings
from django.utils.translation import ugettext_noop
import lms.djangoapps.discussion.django_comment_client.utils as utils
from lms.djangoapps.courseware.tabs import EnrolledTab
from openedx.features.lti_course_tab.tab import DiscussionLtiCourseTab
from xmodule.tabs import TabFragmentViewMixin
class DiscussionTab(TabFragmentViewMixin, EnrolledTab):
"""
A tab for the cs_comments_service forums.
"""
type = 'discussion'
title = ugettext_noop('Discussion')
priority = None
view_name = 'forum_form_discussion'
fragment_view_name = 'lms.djangoapps.discussion.views.DiscussionBoardFragmentView'
is_hideable = settings.FEATURES.get('ALLOW_HIDING_DISCUSSION_TAB', False)
is_default = False
body_class = 'discussion'
online_help_token = 'discussions'
@classmethod
def is_enabled(cls, course, user=None):
if not super(DiscussionTab, cls).is_enabled(course, user):
return False
# Disable the regular discussion tab if LTI-based external Discussion forum is enabled
if DiscussionLtiCourseTab.is_enabled(course, user):
return False
return utils.is_discussion_enabled(course.id)