Ejemplo n.º 1
0
def create_explorer_page_registry():
    """Create the registry for course properties."""

    reg = FieldRegistry(
        'Explorer Page', description='Explorer Page',
        extra_schema_dict_values={
            'className': 'inputEx-Group new-form-layout'})

    # Course level settings.
    course_opts = reg.add_sub_registry('top_half', 'Top Half')
    course_opts.add_property(SchemaField(
        'top_text', 'Top Text', 'html', optional=False,
        description=('Problem Statement and description of program, visible'
                     ' to student.'),
        extra_schema_dict_values={
            'supportCustomTags': tags.CAN_USE_DYNAMIC_TAGS.value,
            'className': 'inputEx-Field content'}))
    course_opts.add_property(SchemaField(
        'video_id', 'Right hand side video', 'string',
	optional=True))

    category_list_items = FieldRegistry('', '')
    category_list_items.add_property(SchemaField(
        'category', 'Category', 'string', optional=True,
        extra_schema_dict_values={}, select_data=[]))
    category_list_opts = FieldArray(
        'category_list', 'Category Order', item_type=category_list_items,
        extra_schema_dict_values={
            'sortable': True,
            'listAddLabel': 'Add Category',
            'listRemoveLabel': 'Delete Category'})
    cli = reg.add_sub_registry('category_list', 'Category List')
    cli.add_property(category_list_opts)
    return reg
Ejemplo n.º 2
0
def create_prog_assignment_registry():
    """Create the registry for course properties."""

    reg = FieldRegistry('Prog Assignment Entity',
                        description='Prog Assignment',
                        extra_schema_dict_values={
                            'className': 'inputEx-Group new-form-layout'
                        })

    # Course level settings.
    course_opts = reg.add_sub_registry('prog_assignment', 'Assignment Config')
    course_opts.add_property(
        SchemaField(
            'key',
            'ID',
            'string',
            editable=False,
            extra_schema_dict_values={'className': 'inputEx-Field keyHolder'},
            description='Unique Id of the Assignment'))
    course_opts.add_property(
        SchemaField(
            'pa_id',
            'PA_ID',
            'string',
            editable=False,
            extra_schema_dict_values={'className': 'inputEx-Field keyHolder'},
            description='Unique id of the test cases in this assignment.'))
    course_opts.add_property(
        SchemaField('parent_unit', 'Parent Unit', 'string', select_data=[]))
    course_opts.add_property(
        SchemaField('type', 'Type', 'string', editable=False))
    course_opts.add_property(
        SchemaField('title', 'Title', 'string', optional=False))
    course_opts.add_property(
        SchemaField('weight', 'Weight', 'number', optional=False))

    course_opts.add_property(
        SchemaField(content_key('question'),
                    'Problem Statement',
                    'html',
                    optional=False,
                    description=(
                        'Problem Statement and description of program, visible'
                        ' to student.'),
                    extra_schema_dict_values={
                        'supportCustomTags': tags.CAN_USE_DYNAMIC_TAGS.value,
                        'className': 'inputEx-Field content'
                    }))
    course_opts.add_property(
        SchemaField('html_check_answers',
                    'Allow "Compile & Run"',
                    'boolean',
                    optional=True,
                    extra_schema_dict_values={
                        'className':
                        'inputEx-Field assessment-editor-check-answers'
                    }))

    course_opts.add_property(
        SchemaField(
            content_key('evaluator'),
            'Program Evaluator',
            'string',
            optional=True,
            select_data=[
                (eid, eid)
                for eid in evaluator.ProgramEvaluatorRegistory.list_ids()
            ]))

    course_opts.add_property(
        SchemaField(content_key('ignore_presentation_errors'),
                    'Ignore Presentation Errors',
                    'boolean',
                    optional=True,
                    extra_schema_dict_values={
                        'className':
                        'inputEx-Field assessment-editor-check-answers'
                    }))

    course_opts.add_property(
        SchemaField(workflow_key(courses.SUBMISSION_DUE_DATE_KEY),
                    'Submission Due Date',
                    'string',
                    optional=True,
                    description=str(messages.DUE_DATE_FORMAT_DESCRIPTION)))
    course_opts.add_property(
        SchemaField(content_key('show_sample_solution'),
                    'Show sample solution after deadline',
                    'boolean',
                    optional=True,
                    extra_schema_dict_values={
                        'className':
                        'inputEx-Field assessment-editor-check-answers'
                    }))

    test_case_opts = FieldRegistry('', '')
    test_case_opts.add_property(
        SchemaField('input',
                    'Input',
                    'text',
                    optional=True,
                    extra_schema_dict_values={}))

    test_case_opts.add_property(
        SchemaField(
            'output',
            'Output',
            'text',
            optional=True,
            extra_schema_dict_values={'className': 'inputEx-Field content'}))

    test_case_opts.add_property(
        SchemaField('weight',
                    'Weight',
                    'number',
                    optional=False,
                    extra_schema_dict_values={
                        'className': 'inputEx-Field content',
                        'value': 1
                    }))

    public_test_cases = FieldArray(content_key('public_testcase'),
                                   '',
                                   item_type=test_case_opts,
                                   extra_schema_dict_values={
                                       'sortable': False,
                                       'listAddLabel': 'Add Public Test Case',
                                       'listRemoveLabel': 'Delete'
                                   })
    public_tests_reg = course_opts.add_sub_registry('public_testcase',
                                                    title='Public Test Cases')
    public_tests_reg.add_property(public_test_cases)

    private_test_cases = FieldArray(content_key('private_testcase'),
                                    '',
                                    item_type=test_case_opts,
                                    extra_schema_dict_values={
                                        'sortable': False,
                                        'listAddLabel':
                                        'Add Private Test Case',
                                        'listRemoveLabel': 'Delete'
                                    })
    private_tests_reg = course_opts.add_sub_registry(
        'private_testcase', title='Private Test Cases')
    private_tests_reg.add_property(private_test_cases)

    lang_reg = course_opts.add_sub_registry(
        'allowed_languages', title='Allowed Programming Languages')
    language_opts = FieldRegistry('', '')
    language_opts.add_property(
        SchemaField(
            'language',
            'Programming Language',
            'string',
            select_data=base.ProgAssignment.PROG_LANG_FILE_MAP.items()))
    language_opts.add_property(
        SchemaField(
            'prefixed_code',
            'Prefixed Fixed Code',
            'text',
            optional=True,
            description=('The uneditable code for the assignment. '
                         'This will be prepended at the start of user code'),
            extra_schema_dict_values={'className': 'inputEx-Field content'}))
    language_opts.add_property(
        SchemaField(
            'code_template',
            'Template Code',
            'text',
            optional=True,
            description=('The default code that is populated on opening ' +
                         'an assignment.'),
            extra_schema_dict_values={'className': 'inputEx-Field content'}))
    language_opts.add_property(
        SchemaField(
            'uneditable_code',
            'Suffixed Fixed Code',
            'text',
            optional=True,
            description=('The uneditable code for the assignment. '
                         'This will be appended at the end of user code'),
            extra_schema_dict_values={'className': 'inputEx-Field content'}))
    language_opts.add_property(
        SchemaField(
            'suffixed_invisible_code',
            'Invisible Code',
            'text',
            optional=True,
            description=(
                'This code will not be visible to the student and will be'
                ' appended at the very end.'),
            extra_schema_dict_values={'className': 'inputEx-Field content'}))
    language_opts.add_property(
        SchemaField('sample_solution',
                    'Sample Solution',
                    'text',
                    optional=True,
                    extra_schema_dict_values={'className': 'inputEx-Field'}))
    language_opts.add_property(
        SchemaField('filename',
                    'Sample Solution Filename',
                    'string',
                    optional=True,
                    extra_schema_dict_values={'className': 'inputEx-Field'}))
    allowed_languages = FieldArray(content_key('allowed_languages'),
                                   '',
                                   item_type=language_opts,
                                   extra_schema_dict_values={
                                       'sortable': False,
                                       'listAddLabel': 'Add Language',
                                       'listRemoveLabel': 'Delete',
                                       'minItems': 1
                                   })
    lang_reg.add_property(allowed_languages)

    course_opts.add_property(
        SchemaField(
            'is_draft',
            'Status',
            'boolean',
            select_data=[(True, DRAFT_TEXT), (False, PUBLISHED_TEXT)],
            extra_schema_dict_values={'className': 'split-from-main-group'}))
    return reg
Ejemplo n.º 3
0
def create_gdefier_module_registry():
    """Create the registry for course properties."""
    
    """Make schema with a list of all exercises by inspecting a zip file.
    zip_file = zipfile.ZipFile(khanex.ZIP_FILE)
    exercise_list = []
    for name in zip_file.namelist():
        if name.startswith(khanex.EXERCISE_BASE) and name != khanex.EXERCISE_BASE:
            exercise_list.append(name[len(khanex.EXERCISE_BASE):])
    khanex_exercises = []
    index = 1
    for url in sorted(exercise_list):
        name = url.replace('.html', '')
        if khanex._allowed(name):
            caption = name.replace('_', ' ')
            khanex_exercises.append((name, '#%s: %s' % (index, caption)))
            index += 1"""

    reg = FieldRegistry('G-Defier Module Settings', description='G-Defier Settings')

    # Module settings.
    module_opts = reg.add_sub_registry('module', 'Module Config')
    module_opts.add_property(SchemaField(
        'module:w_module', 'Module Weight', 'integer'))
    
    n_blocks_options = []
    n_blocks_options.append((1, 1))
    n_blocks_options.append((2, 2))
    n_blocks_options.append((3, 3))
    
    module_opts.add_property(SchemaField(
        'module:n_defies', 'Defies', 'integer',
        description='Number of defies to pass the blocks'))
    module_opts.add_property(SchemaField(
        'module:max_defies', 'Max Defies', 'integer',
        description='Maximum number of playble defies in a block to get its score'))
#    module_opts.add_property(SchemaField(
#        'module:rally_block', 'Make Rally block active', 'boolean'))
#    module_opts.add_property(SchemaField(
#        'module:w_rally', 'Rally Weight', 'integer'))    
#    module_opts.add_property(SchemaField(
#        'module:n_rally', 'Rally size', 'integer',
#         description='Number of questions in a row to get Rally block'))
#    module_opts.add_property(SchemaField(
#        'module:editor_block', 'Make Editor block active', 'boolean'))
#    module_opts.add_property(SchemaField(
#        'module:w_editor', 'Editor Weight', 'integer'))    
#    module_opts.add_property(SchemaField(
#        'module:n_editor', 'Exercises to upload', 'integer',
#        description='Minimum Number of exercises to upload necessary to get Editor block'))

    defy_type = module_opts.add_sub_registry('defy', 'Defy config')

    defy_type.add_property(SchemaField(
        'module:defy:n_round', 'Number of rounds', 'integer',
        description='Number of rounds into each defy')) 
    defy_type.add_property(SchemaField(
        'module:defy:time2accept', 'Time 2 accept', 'integer',
        description='Time in hours to accept a defy request'))
    defy_type.add_property(SchemaField(
        'module:defy:round_time', 'Round time', 'integer',
        description='Time in minutes to respond into each round'))
    
    block_type = schema_fields.FieldRegistry(
            'Question Block',
            extra_schema_dict_values={'className': 'sa-grader'})
    block_type.add_property(schema_fields.SchemaField(
        'block_title', 'Block Title', 'string',
        extra_schema_dict_values={'className': 'inputEx-Field content'}))
    block_type.add_property(schema_fields.SchemaField(
        'w_block', 'Block Weight', 'integer',
        extra_schema_dict_values={'className': 'inputEx-Field content'}))
    block_type.add_property(schema_fields.SchemaField(
        'gdf_start_date', 'Start date', 'string',
        extra_schema_dict_values={'className': 'inputEx-Field content'},
        description=str(DATE_FORMAT_DESCRIPTION)))
    block_type.add_property(schema_fields.SchemaField(
        'gdf_close_date', 'Deadline', 'string',
        extra_schema_dict_values={'className': 'inputEx-Field content'},
        description=str(DATE_FORMAT_DESCRIPTION)))
    block_type.add_property(schema_fields.SchemaField(
        'question_cast', 'Question cast', 'html', optional=True,
        extra_schema_dict_values={
            'supportCustomTags': tags.CAN_USE_DYNAMIC_TAGS.value,
            'excludedCustomTags': tags.EditorBlacklists.ASSESSMENT_SCOPE,
            'className': 'inputEx-Field html-content'}))

    blocks_array = schema_fields.FieldArray(
        'module:blocks', 'Blocks for the course', item_type=block_type,
        extra_schema_dict_values={
            'className': 'sa-grader-container',
            #'sortable': 'true',
            'listAddLabel': 'Add a block',
            'listRemoveLabel': 'Delete this block'})

    module_opts.add_property(blocks_array)
    
    return reg