如何在edx平台中添加xblock作为课程选项卡

时间:2015-06-03 07:37:16

标签: edx

我在本地计算机上安装了devstack。 我计划在edx平台上添加聊天功能,学生可以联系该课程的教师。 (只是一个简单的页面,列出了课程的所有教师,并附有聊天链接) 我尝试使用xblock并成功创建了一个。但似乎xblock用于自定义课程内容,它们作为单元注入课件中。 我想要的是添加一个课程标签,该标签将显示在每个课程中,列出学生可以通过聊天咨询的所有教师。 是否有可能通过xblock?如果没有,你能否建议其他选择来达到我的目的?

1 个答案:

答案 0 :(得分:1)

完整教程:https://openedx.atlassian.net/wiki/display/AC/Adding+a+new+course+tab

将这样的入口点添加到Python库的 setup.py 中。请注意,new_tab是标签的ID,example.NewTab是新标签类的完全限定名称。

entry_points={
    "openedx.course_tab": [
        "new_tab = example.NewTab",
    }
}

将新选项卡类定义为CourseTab的子类并声明其属性:

from courseware.tabs import CourseTab


class NewTab(CourseTab):
    """A new course tab."""

    name = "new_tab"
    title = ugettext_noop("New Tab")  # We don't have the user in this context, so we don't want to translate it at this level.
    view_name = "new_tab_view"

    @classmethod
    def is_enabled(cls, course, user=None):
        """Returns true if this tab is enabled."""
        return settings.FEATURES.get('NEW_TAB_ENABLED', False)

相关:https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/edx-code/sE63D12V4Xc/78VRqMipBwAJ

https://groups.google.com/forum/#!topic/edx-code/ji-_w-nbu7c