Merge pull request #4512 from Stanford-Online/dcadams/refactor_advanced_component_types
Refactor ADVANCED_COMPONENT_TYPES
This commit is contained in:
@@ -43,44 +43,22 @@ log = logging.getLogger(__name__)
|
||||
|
||||
# NOTE: unit_handler assumes this list is disjoint from ADVANCED_COMPONENT_TYPES
|
||||
COMPONENT_TYPES = ['discussion', 'html', 'problem', 'video']
|
||||
SPLIT_TEST_COMPONENT_TYPE = 'split_test'
|
||||
|
||||
# Constants for determining if these components should be enabled for this course
|
||||
SPLIT_TEST_COMPONENT_TYPE = 'split_test'
|
||||
OPEN_ENDED_COMPONENT_TYPES = ["combinedopenended", "peergrading"]
|
||||
NOTE_COMPONENT_TYPES = ['notes']
|
||||
|
||||
if settings.FEATURES.get('ALLOW_ALL_ADVANCED_COMPONENTS'):
|
||||
ADVANCED_COMPONENT_TYPES = sorted(set(name for name, class_ in XBlock.load_classes()) - set(COMPONENT_TYPES))
|
||||
else:
|
||||
|
||||
ADVANCED_COMPONENT_TYPES = [
|
||||
'annotatable',
|
||||
'textannotation', # module for annotating text (with annotation table)
|
||||
'videoannotation', # module for annotating video (with annotation table)
|
||||
'imageannotation', # module for annotating image (with annotation table)
|
||||
'word_cloud',
|
||||
'graphical_slider_tool',
|
||||
'lti',
|
||||
# XBlocks from pmitros repos are prototypes. They should not be used
|
||||
# except for edX Learning Sciences experiments on edge.edx.org without
|
||||
# further work to make them robust, maintainable, finalize data formats,
|
||||
# etc.
|
||||
'concept', # Concept mapper. See https://github.com/pmitros/ConceptXBlock
|
||||
'done', # Lets students mark things as done. See https://github.com/pmitros/DoneXBlock
|
||||
'audio', # Embed an audio file. See https://github.com/pmitros/AudioXBlock
|
||||
SPLIT_TEST_COMPONENT_TYPE, # Adds A/B test support
|
||||
'recommender' # Crowdsourced recommender. Prototype by dli&pmitros. Intended for roll-out in one place in one course.
|
||||
] + OPEN_ENDED_COMPONENT_TYPES + NOTE_COMPONENT_TYPES
|
||||
ADVANCED_COMPONENT_TYPES = settings.ADVANCED_COMPONENT_TYPES
|
||||
|
||||
ADVANCED_COMPONENT_CATEGORY = 'advanced'
|
||||
ADVANCED_COMPONENT_POLICY_KEY = 'advanced_modules'
|
||||
|
||||
# Specify xblocks that should be treated as advanced problems. Each entry is a tuple
|
||||
# specifying the xblock name and an optional YAML template to be used.
|
||||
ADVANCED_PROBLEM_TYPES = [
|
||||
{
|
||||
'component': 'openassessment',
|
||||
'boilerplate_name': None
|
||||
}
|
||||
]
|
||||
ADVANCED_PROBLEM_TYPES = settings.ADVANCED_PROBLEM_TYPES
|
||||
|
||||
|
||||
@require_GET
|
||||
@login_required
|
||||
@@ -358,7 +336,7 @@ def get_component_templates(course):
|
||||
"type": category,
|
||||
"templates": templates_for_category,
|
||||
"display_name": component_display_names[category]
|
||||
})
|
||||
})
|
||||
|
||||
# Check if there are any advanced modules specified in the course policy.
|
||||
# These modules should be specified as a list of strings, where the strings
|
||||
|
||||
@@ -52,6 +52,7 @@ from .component import (
|
||||
NOTE_COMPONENT_TYPES,
|
||||
ADVANCED_COMPONENT_POLICY_KEY,
|
||||
SPLIT_TEST_COMPONENT_TYPE,
|
||||
ADVANCED_COMPONENT_TYPES,
|
||||
)
|
||||
from .tasks import rerun_course
|
||||
|
||||
@@ -722,7 +723,7 @@ def _config_course_advanced_components(request, course_module):
|
||||
component_types = tab_component_map.get(tab_type)
|
||||
found_ac_type = False
|
||||
for ac_type in component_types:
|
||||
if ac_type in request.json[ADVANCED_COMPONENT_POLICY_KEY]["value"]:
|
||||
if ac_type in request.json[ADVANCED_COMPONENT_POLICY_KEY]["value"] and ac_type in ADVANCED_COMPONENT_TYPES:
|
||||
# Add tab to the course if needed
|
||||
changed, new_tabs = add_extra_panel_tab(tab_type, course_module)
|
||||
# If a tab has been added to the course, then send the
|
||||
@@ -1150,7 +1151,7 @@ def group_configurations_list_handler(request, course_key_string):
|
||||
if 'text/html' in request.META.get('HTTP_ACCEPT', 'text/html'):
|
||||
group_configuration_url = reverse_course_url('group_configurations_list_handler', course_key)
|
||||
course_outline_url = reverse_course_url('course_handler', course_key)
|
||||
split_test_enabled = SPLIT_TEST_COMPONENT_TYPE in course.advanced_modules
|
||||
split_test_enabled = SPLIT_TEST_COMPONENT_TYPE in ADVANCED_COMPONENT_TYPES and SPLIT_TEST_COMPONENT_TYPE in course.advanced_modules
|
||||
|
||||
configurations = GroupConfiguration.add_usage_info(course, store)
|
||||
|
||||
|
||||
@@ -284,3 +284,8 @@ X_FRAME_OPTIONS = ENV_TOKENS.get('X_FRAME_OPTIONS', X_FRAME_OPTIONS)
|
||||
|
||||
##### ADVANCED_SECURITY_CONFIG #####
|
||||
ADVANCED_SECURITY_CONFIG = ENV_TOKENS.get('ADVANCED_SECURITY_CONFIG', {})
|
||||
|
||||
################ ADVANCED COMPONENT/PROBLEM TYPES ###############
|
||||
|
||||
ADVANCED_COMPONENT_TYPES = ENV_TOKENS.get('ADVANCED_COMPONENT_TYPES', ADVANCED_COMPONENT_TYPES)
|
||||
ADVANCED_PROBLEM_TYPES = ENV_TOKENS.get('ADVANCED_PROBLEM_TYPES', ADVANCED_PROBLEM_TYPES)
|
||||
|
||||
@@ -645,3 +645,36 @@ ADVANCED_SECURITY_CONFIG = {}
|
||||
### External auth usage -- prefixes for ENROLLMENT_DOMAIN
|
||||
SHIBBOLETH_DOMAIN_PREFIX = 'shib:'
|
||||
OPENID_DOMAIN_PREFIX = 'openid:'
|
||||
|
||||
################ ADVANCED_COMPONENT_TYPES ###############
|
||||
|
||||
ADVANCED_COMPONENT_TYPES = [
|
||||
'annotatable',
|
||||
'textannotation', # module for annotating text (with annotation table)
|
||||
'videoannotation', # module for annotating video (with annotation table)
|
||||
'imageannotation', # module for annotating image (with annotation table)
|
||||
'word_cloud',
|
||||
'graphical_slider_tool',
|
||||
'lti',
|
||||
# XBlocks from pmitros repos are prototypes. They should not be used
|
||||
# except for edX Learning Sciences experiments on edge.edx.org without
|
||||
# further work to make them robust, maintainable, finalize data formats,
|
||||
# etc.
|
||||
'concept', # Concept mapper. See https://github.com/pmitros/ConceptXBlock
|
||||
'done', # Lets students mark things as done. See https://github.com/pmitros/DoneXBlock
|
||||
'audio', # Embed an audio file. See https://github.com/pmitros/AudioXBlock
|
||||
'recommender', # Crowdsourced recommender. Prototype by dli&pmitros. Intended for roll-out in one place in one course.
|
||||
'split_test',
|
||||
'combinedopenended',
|
||||
'peergrading',
|
||||
'notes',
|
||||
]
|
||||
|
||||
# Specify xblocks that should be treated as advanced problems. Each entry is a tuple
|
||||
# specifying the xblock name and an optional YAML template to be used.
|
||||
ADVANCED_PROBLEM_TYPES = [
|
||||
{
|
||||
'component': 'openassessment',
|
||||
'boilerplate_name': None,
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user