示例#1
0
def register_module():
    """Registers this module in the registry."""

    global_routes = [('/modules/search/assets/.*', AssetsHandler),
                     ('/cron/search/index_courses', CronHandler)]
    namespaced_routes = [('/search', SearchHandler)]

    def notify_module_enabled():
        dashboard.DashboardHandler.add_sub_nav_mapping(
            'publish',
            'search',
            'Search',
            action='settings_search',
            contents=_get_search,
            placement=1000)
        dashboard.DashboardHandler.add_custom_post_action(
            'index_course', _post_index_course)
        dashboard.DashboardHandler.add_custom_post_action(
            'clear_index', _post_clear_index)

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        MODULE_NAME,
        'Provides search capabilities for courses',
        global_routes,
        namespaced_routes,
        notify_module_enabled=notify_module_enabled)
    return custom_module
示例#2
0
def register_module():
    """Registers this module in the registry."""

    course_settings_fields = get_course_settings_fields()

    def on_module_enabled():
        courses.Course.OPTIONS_SCHEMA_PROVIDERS[
            COURSE_SETTINGS_SCHEMA_SECTION] += course_settings_fields
        utils.StudentProfileHandler.EXTRA_STUDENT_DATA_PROVIDERS += [
            get_student_profile_invitation_link,
            get_student_profile_sub_unsub_link]
        settings.CourseSettingsHandler.ADDITIONAL_DIRS.append(
            TEMPLATES_DIR)
        settings.CourseSettingsHandler.EXTRA_JS_FILES.append(
            'invitation_course_settings.js')
        data_removal.Registry.register_indexed_by_user_id_remover(
            InvitationStudentProperty.delete_by_user_id_prefix)

    global_routes = [
        (os.path.join(RESOURCES_PATH, '.*'), tags.ResourcesHandler)]

    namespaced_routes = [
        ('/' + InvitationHandler.URL, InvitationHandler),
        ('/' + InvitationRESTHandler.URL, InvitationRESTHandler)]

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Invitation Page',
        'A page to invite others to register.',
        global_routes, namespaced_routes,
        notify_module_enabled=on_module_enabled)
    return custom_module
示例#3
0
def register_module():

    def on_module_enabled():
        tags.Registry.add_tag_binding(
            QuestionnaireTag.binding_name, QuestionnaireTag)
        data_sources.Registry.register(QuestionnaireDataSource)
        data_removal.Registry.register_indexed_by_user_id_remover(
            StudentFormEntity.delete_by_user_id_prefix)

    global_routes = [
        (os.path.join(RESOURCES_PATH, 'js', '.*'), tags.JQueryHandler),
        (os.path.join(RESOURCES_PATH, '.*'), tags.ResourcesHandler)]

    namespaced_routes = [(QuestionnaireHandler.URL, QuestionnaireHandler)]

    global questionnaire_module  # pylint: disable=global-statement
    questionnaire_module = custom_modules.Module(
        'Questionnaire',
        'Can create a questionnaire for students to answer.'
        'The responses submitted by students will be saved as a form which can'
        'be reviewed at a later date.',
        global_routes, namespaced_routes,
        notify_module_enabled=on_module_enabled)

    return questionnaire_module
示例#4
0
def register_module():
    """Registers this module in the registry."""

    underscore_js_handler = sites.make_zip_handler(
        os.path.join(appengine_config.BUNDLE_ROOT, 'lib',
                     'underscore-1.7.0.zip'))

    global_routes = [
        (os.path.join(RESOURCES_PATH, 'css', '.*'), tags.ResourcesHandler),
        (os.path.join(RESOURCES_PATH, 'js', '.*'), tags.JQueryHandler),
        ('/static/underscore-1.7.0/(underscore.js)', underscore_js_handler),
        ('/static/underscore-1.7.0/(underscore.min.js)', underscore_js_handler)
    ]

    namespaced_routes = [(SkillListRestHandler.URL, SkillListRestHandler),
                         (SkillRestHandler.URL, SkillRestHandler),
                         (SkillMapHandler.URL, SkillMapHandler)]

    global skill_mapping_module  # pylint: disable=global-statement
    skill_mapping_module = custom_modules.Module(
        'Skill Mapping Module',
        'Provide skill mapping of course content',
        global_routes,
        namespaced_routes,
        notify_module_enabled=notify_module_enabled)

    return skill_mapping_module
示例#5
0
def register_module():
    """Registers this module in the registry."""

    # Register the dashboard handler
    tabs.Registry.register(base.StudentListBase.DASHBOARD_NAV,
                           base.StudentListBase.DASHBOARD_TAB,
                           base.StudentListBase.NAME,
                           student_list_dashboard.StudentListDashboardHandler)

    dashboard.DashboardHandler.add_custom_get_action(
        base.StudentListBase.DASHBOARD_NAV, None)

    dashboard.DashboardHandler.add_custom_get_action(
        base.StudentListBase.DETAILS_ACTION,
        student_list_dashboard.StudentListDashboardHandler.get_details)

    dashboard.DashboardHandler.add_custom_post_action(
        base.StudentListBase.ENROLL_ACTION,
        student_list_dashboard.StudentListDashboardHandler.post_enroll)

    dashboard.DashboardHandler.add_custom_post_action(
        base.StudentListBase.UNENROLL_ACTION,
        student_list_dashboard.StudentListDashboardHandler.post_unenroll)

    dashboard.DashboardHandler.add_nav_mapping(
        base.StudentListBase.DASHBOARD_NAV, base.StudentListBase.NAME)

    global custom_module
    custom_module = custom_modules.Module(
        'Student List', 'A set of classes for managing students', [], [])
    return custom_module
示例#6
0
def register_module():
    """Registers this module for use."""
    def on_module_disable():
        tags.Registry.remove_tag_binding(TextFileUploadTag.binding_name)
        tags.EditorBlacklists.unregister(TextFileUploadTag.binding_name,
                                         tags.EditorBlacklists.COURSE_SCOPE)

    def on_module_enable():
        tags.Registry.add_tag_binding(TextFileUploadTag.binding_name,
                                      TextFileUploadTag)
        tags.EditorBlacklists.register(TextFileUploadTag.binding_name,
                                       tags.EditorBlacklists.COURSE_SCOPE)

    global_routes = [
        (os.path.join(_RESOURCES_PATH, '.*'), tags.ResourcesHandler),
    ]
    namespaced_routes = [
        (_POST_ACTION_SUFFIX, TextFileUploadHandler),
    ]

    global custom_module

    custom_module = custom_modules.Module(
        'Student Text File Submission Upload',
        'Adds a custom tag for students to upload text files <= 1MB in size.',
        global_routes,
        namespaced_routes,
        notify_module_disabled=on_module_disable,
        notify_module_enabled=on_module_enable,
    )

    return custom_module
示例#7
0
def register_module():
    """Registers this module in the registry."""

    # provide parser to verify
    verify.parse_content = content.parse_string_in_scope

    # setup routes
    courses_routes = [('/', lessons.CourseHandler),
                      ('/activity', lessons.ActivityHandler),
                      ('/answer', assessments.AnswerHandler),
                      ('/assessment', lessons.AssessmentHandler),
                      ('/course', lessons.CourseHandler),
                      ('/forum', utils.ForumHandler),
                      ('/preview', utils.PreviewHandler),
                      ('/register', utils.RegisterHandler),
                      ('/review', lessons.ReviewHandler),
                      ('/reviewdashboard', lessons.ReviewDashboardHandler),
                      ('/student/editstudent',
                       utils.StudentEditStudentHandler),
                      ('/student/home', utils.StudentProfileHandler),
                      ('/student/unenroll', utils.StudentUnenrollHandler),
                      ('/unit', lessons.UnitHandler)]

    global custom_module
    custom_module = custom_modules.Module(
        'Course', 'A set of pages for delivering an online course.', [],
        courses_routes)
    return custom_module
示例#8
0
def register_module():
    """Registers this module in the registry."""

    # set the page initializer
    utils.PageInitializerService.set(ExplorerPageInitializer)
    settings.CourseExplorerSettings.register()

    # setup routes
    explorer_routes = [
        ('/', student.IndexPageHandler),
        (admin.ExplorerPageRESTHandler.URI, admin.ExplorerPageRESTHandler),
        (admin.CategoryListRESTHandler.URI, admin.CategoryListRESTHandler),
        (admin.AddNewCategoryRESTHandler.URI, admin.AddNewCategoryRESTHandler),
        (admin.CourseCategoryRESTHandler.URI, admin.CourseCategoryRESTHandler),
        (admin.CourseFeaturedRESTHandler.URI, admin.CourseFeaturedRESTHandler),
        ('/explorer', student.AllCoursesHandler),
        (r'/explorer/search', student.SearchCourseHandler),
        (r'/explorer/assets/(.*)', student.AssetsHandler),
        ('/explorer/profile', student.ProfileHandler)
    ]

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Course Explorer', 'A set of pages for delivering an online course.',
        explorer_routes, [])
    return custom_module
示例#9
0
def register_module():
    """Registers this module in the registry."""

    global_routes = [
        ('/modules/nptel/assets/.*', tags.ResourcesHandler),
        ('/modules/nptel/generate_student_report',
         analytics.GenerateStudentReportHandler),
        ('/modules/nptel/dump_qualified_students',
         analytics.DumpQualifiedStudents),
        ('/modules/nptel/dump_student_profile', analytics.DumpProfilesHandler),
        ('/modules/nptel/reindex_student_profile',
         analytics.ReIndexStudentProfileHandler),
        ('/modules/nptel/reindex_pa',
         transform.ReFormatProgrammingAssignmentsHandler),
        ('/modules/nptel/save_course', analytics.SaveCourseSettingsHandler),
        ('/modules/nptel/all_courses_profile_data_dump',
         analytics.AllCoursesProfileDumpHandler),
    ]

    nptel_routes = [
        ('/student/progress', StudentProgressHandler),
    ]

    settings.NptelSettings.register()

    courses.DEFAULT_COURSE_YAML_DICT['reg_form']['welcome_email'] = ''
    courses.DEFAULT_COURSE_YAML_DICT['course'][
        'auto_subscribe_to_forum'] = False

    global custom_module
    custom_module = custom_modules.Module(
        MODULE_NAME, 'Provides library to register nptel related assets/code',
        global_routes, nptel_routes)
    return custom_module
示例#10
0
def register_module():
    """Registers this module in the registry."""
    def on_module_enabled():
        roles.Roles.register_permissions(custom_module,
                                         DashboardHandler.permissions_callback)
        ApplicationHandler.RIGHT_LINKS.append(
            DashboardHandler.generate_dashboard_link)
        DashboardHandler.add_nav_mapping('roles', 'Roles')
        DashboardHandler.add_nav_mapping('settings', 'Settings')
        DashboardHandler.add_custom_get_action('settings')

    global_routes = [
        (dashboard_utils.RESOURCES_PATH + '/material-design-icons/(.*)',
         sites.make_zip_handler(
             os.path.join(appengine_config.BUNDLE_ROOT, 'lib',
                          'material-design-iconic-font-1.1.1.zip'))),
        (dashboard_utils.RESOURCES_PATH + '/js/.*', tags.JQueryHandler),
        (dashboard_utils.RESOURCES_PATH + '/.*', tags.ResourcesHandler)
    ]

    dashboard_handlers = [
        ('/dashboard', DashboardHandler),
    ]
    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Course Dashboard',
        'A set of pages for managing Course Builder course.',
        global_routes,
        dashboard_handlers,
        notify_module_enabled=on_module_enabled)
    return custom_module
def register_module():
    def notify_module_enabled():
        lessons.UnitHandler.EXTRA_CONTENT.append(
            _build_completion_button_for_unit_lesson_page)
        lessons.CourseHandler.EXTRA_CONTENT.append(
            _build_completion_button_for_course_page)

    global_routes = [(os.path.join(RESOURCES_PATH, 'js',
                                   '.*'), tags.JQueryHandler),
                     (os.path.join(RESOURCES_PATH,
                                   '.*'), tags.ResourcesHandler)]
    namespaced_handlers = [
        (CourseProgressRESTHandler.URI, CourseProgressRESTHandler),
        (UnitProgressRESTHandler.URI, UnitProgressRESTHandler),
        (LessonProgressRESTHandler.URI, LessonProgressRESTHandler),
    ]

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        MODULE_NAME,
        'Manual marking of unit/lesson progress',
        global_routes,
        namespaced_handlers,
        notify_module_enabled=notify_module_enabled)
    return custom_module
示例#12
0
def register_module():
    """Registers this module in the registry."""
    def when_module_enabled():
        # Register custom tags.
        tags.Registry.add_tag_binding(QuestionTag.binding_name, QuestionTag)
        tags.Registry.add_tag_binding(QuestionGroupTag.binding_name,
                                      QuestionGroupTag)
        for binding_name in (QuestionTag.binding_name,
                             QuestionGroupTag.binding_name):
            for scope in (tags.EditorBlacklists.COURSE_SCOPE,
                          tags.EditorBlacklists.DESCRIPTIVE_SCOPE):
                tags.EditorBlacklists.register(binding_name, scope)

    def when_module_disabled():
        # Unregister custom tags.
        tags.Registry.remove_tag_binding(QuestionTag.binding_name)
        tags.Registry.remove_tag_binding(QuestionGroupTag.binding_name)
        for binding_name in (QuestionTag, binding_name,
                             QuestionGroupTag.binding_name):
            for scope in (tags.EditorBlacklists.COURSE_SCOPE,
                          tags.EditorBlacklists.DESCRIPTIVE_SCOPE):
                tags.EditorBlacklists.unregister(binding_name, scope)

    # Add a static handler for icons shown in the rich text editor.
    global_routes = [(os.path.join(RESOURCES_PATH,
                                   '.*'), tags.ResourcesHandler)]

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Question tags',
        'A set of tags for rendering questions within a lesson body.',
        global_routes, [],
        notify_module_enabled=when_module_enabled,
        notify_module_disabled=when_module_disabled)
    return custom_module
示例#13
0
def register_module():
    """Registers this module in the registry."""

    def notify_module_enabled():
        courses.Course.OPTIONS_SCHEMA_PROVIDERS[
            GUIDE_SETTINGS_SCHEMA_SECTION] += get_schema_fields()
        settings.CourseSettingsHandler.register_settings_section(
            GUIDE_SETTINGS_SCHEMA_SECTION, title='Guides')

    # we now register ZIP handler; here is a test URL:
    #   /modules/guide/resources/polymer/bower_components/bower.json
    polymer_js_handler = sites.make_zip_handler(os.path.join(
        appengine_config.BUNDLE_ROOT, 'lib', 'polymer-guide-1.2.0.zip'))

    global_routes = [
        ('/modules/guide/resources' + '/polymer/(.*)', polymer_js_handler),
        ('/modules/guides', GuideApplicationHandler),]
    namespaced_routes = [('/guide', GuideUnitHandler),]

    global guide_module  # pylint: disable=global-statement
    guide_module = custom_modules.Module(
        'Guide, a new learning experience module.',
        'An alternative to the default course explorer and course experience.',
        global_routes, namespaced_routes,
        notify_module_enabled=notify_module_enabled)

    return guide_module
示例#14
0
def register_module():

    schema_providers = [
        _get_provider_enabled_field, _get_security_field, _get_tool_field
    ]

    def on_module_enabled():
        courses.Course.OPTIONS_SCHEMA_PROVIDERS[
            courses.Course.SCHEMA_SECTION_COURSE] += schema_providers
        tags.Registry.add_tag_binding(LTIToolTag.binding_name, LTIToolTag)

    def on_module_disabled():
        for schema_provider in schema_providers:
            courses.Course.OPTIONS_SCHEMA_PROVIDERS[
                courses.Course.SCHEMA_SECTION_COURSE].remove(schema_provider)
        tags.Registry.remove_tag_binding(LTIToolTag.binding_name)

    global_handlers = [(os.path.join(_RESOURCES_URL,
                                     '.*'), tags.ResourcesHandler)]
    namespaced_handlers = [(_LAUNCH_URL, LaunchHandler),
                           (_LOGIN_URL, LoginHandler),
                           (_REDIRECT_URL, RedirectHandler),
                           (_VALIDATION_URL, ValidationHandler)]

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        MODULE_TITLE,
        'LTI module',
        global_handlers,
        namespaced_handlers,
        notify_module_disabled=on_module_disabled,
        notify_module_enabled=on_module_enabled)

    return custom_module
def register_module():
    """Registers this module in the registry."""
    def on_module_enabled():
        enable_graph_setting = schema_fields.SchemaField(
            SETTINGS_SCHEMA_SECTION_NAME + ':' + SETTING_LOCAL_GRAPH_ENABLED,
            'Skill Graph in Course Content',
            'boolean',
            optional=True,
            i18n=None,
            description=SKILLS_SHOW_SKILL_GRAPH_DESCRIPTION)
        course_settings_fields = (lambda c: enable_graph_setting, )
        courses.Course.OPTIONS_SCHEMA_PROVIDERS[
            skill_map.MODULE_NAME] += course_settings_fields

        # Add to header on unit pages
        skill_map.HEADER_CALLBACKS['skill-diagram'] = add_header_diagrams

    global custom_module  # pylint: disable=global-statement

    custom_module = custom_modules.Module(
        MODULE_TITLE,
        'A page to show student progress through the course skills map.',
        global_routes=[],
        namespaced_routes=[],
        notify_module_enabled=on_module_enabled)
    return custom_module
示例#16
0
def register_module():
    """Registers this module in the registry."""

    handlers = [(AdminDashboardHandler.URL, AdminDashboardHandler),
                (TeacherDashboardHandler.DASHBOARD_URL,
                 TeacherDashboardHandler)]

    # These are necessary to access the js and css resources.
    global_routes = [
        (RESOURCES_PATH + '/js/modal-window.js', tags.ResourcesHandler),
        (RESOURCES_PATH + '/js/tipped.js', tags.ResourcesHandler),
        (RESOURCES_PATH + '/css/question_preview.css', tags.ResourcesHandler),
        (RESOURCES_PATH + '/css/student_progress.css', tags.ResourcesHandler),
        (RESOURCES_PATH + '/css/tipped.css', tags.ResourcesHandler),
    ]

    dashboard.DashboardHandler.add_sub_nav_mapping(
        'analytics',
        MODULE_NAME,
        MODULE_TITLE,
        action=AdminDashboardHandler.ADMIN_LIST_ACTION,
        href=AdminDashboardHandler.ADMIN_LIST_URL,
        placement=1000,
        sub_group_name='pinned')

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        MODULE_TITLE,
        'A set of pages for managing course teachers.',
        global_routes,
        handlers,
        notify_module_enabled=notify_module_enabled)

    return custom_module
示例#17
0
def register_module():
    """Registers this module in the registry."""

    def on_module_enabled():
        register_analytic()
        settings.CourseSettingsRESTHandler.REQUIRED_MODULES.append(
            'inputex-list')
        courses.Course.OPTIONS_SCHEMA_PROVIDERS[
            courses.Course.SCHEMA_SECTION_COURSE].append(
                get_criteria_editor_schema)
        settings.CourseSettingsHandler.ADDITIONAL_DIRS.append(
            os.path.dirname(__file__))
        settings.CourseSettingsHandler.EXTRA_CSS_FILES.append(
            'course_settings.css')
        settings.CourseSettingsHandler.EXTRA_JS_FILES.append(
            'course_settings.js')
        utils.StudentProfileHandler.EXTRA_STUDENT_DATA_PROVIDERS.append(
            get_certificate_table_entry)
        student_aggregate.StudentAggregateComponentRegistry.register_component(
            CertificateAggregator)

    global_routes = [
        (os.path.join(RESOURCES_PATH, '.*'), tags.ResourcesHandler)]

    namespaced_routes = [
        ('/' + CERTIFICATE_HANDLER_PATH, ShowCertificateHandler),
        ('/' + CERTIFICATE_PDF_HANDLER_PATH, ShowCertificatePdfHandler)]

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Show Certificate',
        'A page to show student certificate.',
        global_routes, namespaced_routes,
        notify_module_enabled=on_module_enabled)
    return custom_module
示例#18
0
def register_module():
    """Registers this module for use."""
    def on_module_disable():
        tags.Registry.remove_tag_binding(Activity.binding_name)
        tags.EditorBlacklists.unregister(Activity.binding_name,
                                         tags.EditorBlacklists.COURSE_SCOPE)
        tags.EditorBlacklists.unregister(
            Activity.binding_name, tags.EditorBlacklists.ASSESSMENT_SCOPE)

    def on_module_enable():
        tags.Registry.add_tag_binding(Activity.binding_name, Activity)
        tags.EditorBlacklists.register(Activity.binding_name,
                                       tags.EditorBlacklists.COURSE_SCOPE)
        tags.EditorBlacklists.register(Activity.binding_name,
                                       tags.EditorBlacklists.ASSESSMENT_SCOPE)

    global custom_module

    # Add a static handler for icons shown in the rich text editor.
    global_routes = [(os.path.join(_RESOURCES_PATH,
                                   '.*'), tags.ResourcesHandler)]

    custom_module = custom_modules.Module(
        'Embedded Activity',
        'Adds a custom tag to embed an activity in a lesson.',
        global_routes,
        [],
        notify_module_disabled=on_module_disable,
        notify_module_enabled=on_module_enable,
    )

    return custom_module
示例#19
0
def register_module():
    """Registers this module in the registry."""

    # Avert circular dependency
    from modules.review import cron

    stats.register_analytic()

    # register this peer review implementation
    models.review.ReviewsProcessor.set_peer_matcher(Manager)

    # register cron handler
    cron_handlers = [('/cron/expire_old_assigned_reviews',
                      cron.ExpireOldAssignedReviewsHandler)]

    def notify_module_enabled():
        dashboard.DashboardHandler.add_nav_mapping('edit_assignment',
                                                   'Peer Review')
        dashboard.DashboardHandler.add_custom_get_action(
            'edit_assignment', review_dashboard.get_edit_assignment)
        dashboard.DashboardHandler.add_custom_post_action(
            'add_reviewer', review_dashboard.post_add_reviewer)
        dashboard.DashboardHandler.add_custom_post_action(
            'delete_reviewer', review_dashboard.post_delete_reviewer)

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Peer Review Engine',
        'A set of classes for managing peer review process.',
        cron_handlers, [],
        notify_module_enabled=notify_module_enabled)
    return custom_module
示例#20
0
def register_module():
    """Registers this module in the registry."""

    namespaced_routes = [(UnsubscribeHandler.URL, UnsubscribeHandler)]

    def notify_module_enabled():
        data_removal.Registry.register_indexed_by_email_remover(
            SubscriptionStateEntity.delete_by_email)

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Unsubscribe Module',
        'A module to enable unsubscription from emails.', [],
        namespaced_routes,
        notify_module_enabled=notify_module_enabled)

    class Service(services.Unsubscribe):
        def enabled(self):
            return custom_module.enabled

        def get_unsubscribe_url(self, handler, email):
            return get_unsubscribe_url(handler, email)

        def has_unsubscribed(self, email):
            return has_unsubscribed(email)

        def set_subscribed(self, email, is_subscribed):
            return set_subscribed(email, is_subscribed)

    services.unsubscribe = Service()
    return custom_module
示例#21
0
def register_module():
    def on_module_enabled():
        courses.Course.OPTIONS_SCHEMA_PROVIDERS.setdefault(
            courses.Course.SCHEMA_SECTION_HOMEPAGE,
            []).append(options_schema_provider)
        utils.CourseHandler.LEFT_LINKS.append(left_links)
        utils.CourseHandler.RIGHT_LINKS.append(right_links)

    def on_module_disabled():
        courses.Course.OPTIONS_SCHEMA_PROVIDERS.setdefault(
            courses.Course.SCHEMA_SECTION_HOMEPAGE,
            []).remove(options_schema_provider)
        utils.CourseHandler.LEFT_LINKS.remove(left_links)
        utils.CourseHandler.RIGHT_LINKS.remove(right_links)

    global_routes = []

    namespaced_routes = [('/' + ExtraTabHandler.URL, ExtraTabHandler)]

    global extra_tabs_module  # pylint: disable=global-statement
    extra_tabs_module = custom_modules.Module(
        'Extra Navbar Tabs',
        'Add tabs to the main navbar.',
        global_routes,
        namespaced_routes,
        notify_module_disabled=on_module_disabled,
        notify_module_enabled=on_module_enabled)
    return extra_tabs_module
def register_module():
    """Registers this module in the registry."""

    namespaced_routes = [
        (UnsubscribeHandler.URL, UnsubscribeHandler)]

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Unsubscribe Module',
        'A module to enable unsubscription from emails.',
        [], namespaced_routes)

    class Service(services.Unsubscribe):

        def enabled(self):
            return custom_module.enabled

        def get_unsubscribe_url(self, handler, email):
            return get_unsubscribe_url(handler, email)

        def  has_unsubscribed(self, email):
            return has_unsubscribed(email)

        def set_subscribed(self, email, is_subscribed):
            return set_subscribed(email, is_subscribed)

    services.unsubscribe = Service()
    return custom_module
示例#23
0
def register_module():
    def on_module_enabled():
        courses.Course.OPTIONS_SCHEMA_PROVIDERS[
            courses.Course.SCHEMA_SECTION_UNITS_AND_LESSONS].append(
                get_course_settings_fields)
        lessons.UnitHandler.EXTRA_CONTENT.append(extra_content)
        data_sources.Registry.register(RatingEventDataSource)
        data_removal.Registry.register_indexed_by_user_id_remover(
            StudentRatingProperty.delete_by_user_id_prefix)
        data_removal.Registry.register_unindexed_entity_class(
            StudentRatingEvent)

    global_routes = [(os.path.join(RESOURCES_PATH, 'js',
                                   '.*'), tags.JQueryHandler),
                     (os.path.join(RESOURCES_PATH,
                                   '.*'), tags.ResourcesHandler)]

    namespaced_routes = [(RatingHandler.URL, RatingHandler)]

    global rating_module  # pylint: disable=global-statement
    rating_module = custom_modules.Module(
        'Student rating widget',
        'Provide a widget to record user satisfaction with course content.',
        global_routes,
        namespaced_routes,
        notify_module_enabled=on_module_enabled)

    return rating_module
 def setUpClass(cls):
     super(PermissionsTests, cls).setUpClass()
     cls.custom_module = custom_modules.Module(
         cls.MODULE_NAME,
         'Permissions Tests', [], [],
         notify_module_enabled=cls.notify_module_enabled)
     cls.custom_module.enable()
def register_module():
    global custom_module
    custom_module = custom_modules.Module(
        MODULE_NAME,
        'Implementations of specific data sources.',
        [], [], _notify_module_enabled, _notify_module_disabled)
    return custom_module
def register_module():
    """Registers this module for use."""
    def on_module_enable():
        tags.Registry.add_tag_binding(CodeTag.binding_name, CodeTag)

    def on_module_disable():
        tags.Registry.remove_tag_binding(CodeTag.binding_name)

    global_routes = [(CODETAGS_RESOURCES_URI + '/.*', tags.ResourcesHandler),
                     (CODEMIRROR_URI + '/(.*)',
                      sites.make_zip_handler(
                          os.path.join(appengine_config.BUNDLE_ROOT,
                                       'lib/codemirror-4.5.0.zip')))]
    namespaced_routes = []

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Code Editor and Code Example Display',
        'Allow teacher to use a proper code editor and'
        'allow student to see a proper piece of code',
        global_routes,
        namespaced_routes,
        notify_module_enabled=on_module_enable,
        notify_module_disabled=on_module_disable)

    return custom_module
def register_module():
    def on_module_enabled():
        page_event_aggregator.register_base_course_matchers()
        student_aggregate.StudentAggregateComponentRegistry.register_component(
            location_aggregator.LocationAggregator)
        student_aggregate.StudentAggregateComponentRegistry.register_component(
            location_aggregator.LocaleAggregator)
        student_aggregate.StudentAggregateComponentRegistry.register_component(
            user_agent_aggregator.UserAgentAggregator)
        student_aggregate.StudentAggregateComponentRegistry.register_component(
            answers_aggregator.AnswersAggregator)
        student_aggregate.StudentAggregateComponentRegistry.register_component(
            page_event_aggregator.PageEventAggregator)
        student_aggregate.StudentAggregateComponentRegistry.register_component(
            youtube_event_aggregator.YouTubeEventAggregator)
        data_sources.Registry.register(
            student_aggregate.StudentAggregateComponentRegistry)
        data_sources.Registry.register(clustering.ClusterDataSource)
        data_sources.Registry.register(clustering.ClusterStatisticsDataSource)
        data_sources.Registry.register(
            clustering.TentpoleStudentVectorDataSource)
        register_tabs()
        add_actions()

    global custom_module  # pylint: disable=global-statement
    custom_module = custom_modules.Module(
        'Analytics',
        'Data sources and dashboard analytics pages', [],
        get_namespaced_handlers(),
        notify_module_enabled=on_module_enabled)
    return custom_module
示例#28
0
def register_module():
    """Registers this module for use."""

    def on_module_disable():
        tags.Registry.remove_tag_binding(MathTag.binding_name)

    def on_module_enable():
        tags.Registry.add_tag_binding(MathTag.binding_name, MathTag)

    global_routes = [
        (RESOURCES_URI + '/.*', tags.ResourcesHandler),
        (MATHJAX_URI + '/(fonts/.*)', sites.make_zip_handler(os.path.join(
            appengine_config.BUNDLE_ROOT, 'lib', 'mathjax-fonts-2.3.0.zip'))),
        (MATHJAX_URI + '/(.*)', sites.make_zip_handler(os.path.join(
            appengine_config.BUNDLE_ROOT, 'lib', 'mathjax-2.3.0.zip')))]
    namespaced_routes = []

    global custom_module
    custom_module = custom_modules.Module(
        'Mathematical Formula Display',
        'Provides a custom tag to embed mathematical formulas using TeX or MML.'
        , global_routes, namespaced_routes,
        notify_module_disabled=on_module_disable,
        notify_module_enabled=on_module_enable)
    return custom_module
示例#29
0
def register_module():
    """Registers this module in the registry."""

    data_sources.Registry.register(panalytics.WatchTimeStatsDataSource)

    tab_name = 'watch_time_stats'
    stats = analytics.Visualization(
        tab_name,
        MODULE_NAME,
        'templates/watch_time_stats.html',
        data_source_classes=[panalytics.WatchTimeStatsDataSource])
    tabs.Registry.register('analytics', tab_name, MODULE_NAME, [stats])

    global_routes = []
    watch_time_routes = [('/modules/watch_time/video_watchtime',
                          record_watchtime.RecordWatchTime),
                         ('/modules/nptel/video_watchtime',
                          record_watchtime.RecordWatchTime)]

    global custom_module
    custom_module = custom_modules.Module(
        MODULE_NAME,
        'Provides library to register video watch time related assets/code',
        global_routes, watch_time_routes)
    return custom_module
示例#30
0
def register_module():
    """Registers this module in the registry."""
    associated_js_files_handlers = [
        ('/modules/subjective/editor/(.*)',
         sites.make_zip_handler(
             os.path.join(appengine_config.BUNDLE_ROOT,
                          'modules/subjective_assignments/lib/ckeditor.zip'))),
    ]

    question_handlers = [(question.SubjectiveAssignmentBaseHandler.UNIT_URL,
                          SubjectiveAssignmentHandler),
                         (question.SubjectiveAssignmentRESTHandler.URI,
                          question.SubjectiveAssignmentRESTHandler)]

    # Course Staff Custom Handlers
    evaluate.EvaluationHandler.add_custom_get_action(
        (subjective_course_staff.SubjectiveAssignmentCourseStaffBase.
         LIST_ACTION),
        (subjective_course_staff.SubjectiveAssignmentCourseStaffHandler.
         get_list_subjective))

    evaluate.EvaluationHandler.add_custom_get_action(
        (subjective_course_staff.SubjectiveAssignmentCourseStaffBase.
         EVALUATE_ACTION),
        (subjective_course_staff.SubjectiveAssignmentCourseStaffHandler.
         get_evaluate_subjective))

    evaluate.EvaluationHandler.add_custom_post_action(
        (subjective_course_staff.SubjectiveAssignmentCourseStaffBase.
         POST_SCORE_ACTION),
        (subjective_course_staff.SubjectiveAssignmentCourseStaffHandler.
         post_submit_score))

    evaluate.EvaluationHandler.add_custom_post_action(
        (subjective_course_staff.SubjectiveAssignmentCourseStaffBase.
         POST_SAVE_ACTION),
        (subjective_course_staff.SubjectiveAssignmentCourseStaffHandler.
         post_save_comments))

    global custom_module
    custom_module = custom_modules.Module(
        question.SubjectiveAssignmentBaseHandler.NAME,
        question.SubjectiveAssignmentBaseHandler.DESCRIPTION,
        associated_js_files_handlers, question_handlers)

    custom_unit = custom_units.CustomUnit(
        question.SubjectiveAssignmentBaseHandler.UNIT_TYPE_ID,
        question.SubjectiveAssignmentBaseHandler.NAME,
        question.SubjectiveAssignmentRESTHandler,
        visible_url,
        cleanup_helper=delete_assignement,
        import_helper=import_assignment,
        is_graded=True)

    # Add custom unit details to course staff
    course_staff.CourseStaff.add_custom_unit(
        question.SubjectiveAssignmentBaseHandler.UNIT_TYPE_ID, 'list')

    return custom_module