예제 #1
0
def create_email_settings_registry():
    """Create the registry for course properties."""

    reg = FieldRegistry('Email Settings',
                        description='Email Settings',
                        extra_schema_dict_values={
                            'className': 'inputEx-Group new-form-layout'
                        })
    reg.add_property(SchemaField('unique_name', 'Unique Name', 'string'))
    select_data = [('APP_ENGINE_EMAIL', 'App Engine Email'),
                   ('SEND_GRID', 'Send Grid')]
    reg.add_property(
        SchemaField('provider',
                    'Provider',
                    'string',
                    optional=False,
                    select_data=select_data,
                    extra_schema_dict_values={
                        'className': 'inputEx-Field assessment-dropdown'
                    }))
    reg.add_property(SchemaField('from_email', 'From Email', 'string'))
    reg.add_property(SchemaField('api_key', 'API Key', 'string',
                                 optional=True))

    return reg
예제 #2
0
def create_bulk_local_chapter_list_registry():
    """Create the registry for course properties."""

    reg = FieldRegistry('Local Chapter',
                        description='Bulk Local Chapters',
                        extra_schema_dict_values={
                            'className': 'inputEx-Group new-form-layout'
                        })
    reg.add_property(
        SchemaField('bulk_addition',
                    'Bulk Local Chapters (code,name,city,state)', 'text'))
    return reg
예제 #3
0
파일: admin.py 프로젝트: thejeshgn/seek
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
예제 #4
0
def create_bulk_offline_assignments_list_registry():
    """Create the registry for course properties."""

    reg = FieldRegistry(
        base.OfflineAssignmentBase.ADMIN_DESCRIPTION,
        description=base.OfflineAssignmentBase.ADMIN_DESCRIPTION,
        extra_schema_dict_values={
            'className': 'inputEx-Group new-form-layout'
        })
    reg.add_property(
        SchemaField(
            'csv_text',
            'Bulk Scores (course_namespace, student_id, assignment_id, score)',
            'text'))
    return reg
예제 #5
0
파일: admin.py 프로젝트: thejeshgn/seek
def create_course_featured_registry():
    """Create the registry for course properties."""

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

    # Course level settings.
    reg.add_property(SchemaField('id', 'Course id', 'string', editable=False))
    reg.add_property(SchemaField('title', 'Title', 'string', editable=False))
    reg.add_property(SchemaField('featured', 'Featured', 'boolean', optional=True))
    return reg
예제 #6
0
파일: admin.py 프로젝트: thejeshgn/seek
def create_category_list_registry():
    """Create the registry for course properties."""

    reg = FieldRegistry(
        'Course Category',
         description='Categories in which courses are divided.',
        extra_schema_dict_values={
            'className': 'inputEx-Group new-form-layout'})
    reg.add_property(SchemaField(
        'category', 'Category', 'string'))
    reg.add_property(SchemaField(
        'description', 'Visible Name', 'string'))
    reg.add_property(SchemaField(
        'visible', 'Visible', 'boolean'))
    return reg
예제 #7
0
class CourseThemeSettings(object):
    theme_opts = FieldRegistry('THEME', '')

    theme_opts_background_color = SchemaField(
    course_theme_key('background_color'), 'Header Background Color', 'string',
    optional=True,
    description='Color of the header background on the course homepage. Default is a90909')

    theme_opts_logo_url=SchemaField(
    course_theme_key('logo_url'), 'Header logo url', 'string',
    optional=True,
    description='URL of the logo in course page')

    theme_opts_logo_alt_text=SchemaField(
    course_theme_key('logo_alt_text'), 'Header logo alternate text', 'string',
    optional=True,
    description='Header logo alternate text')


    @classmethod
    def get_fields(cls):
        theme_fields = set()
        theme_fields.add(lambda c: cls.theme_opts_logo_alt_text)
        theme_fields.add(lambda c: cls.theme_opts_background_color)
        theme_fields.add(lambda c: cls.theme_opts_logo_url)
        return theme_fields


    @classmethod
    def register(cls):
        courses.DEFAULT_COURSE_YAML_DICT[THEME_SECTION] = dict()
        courses.DEFAULT_COURSE_YAML_DICT[THEME_SECTION]['background_color'] = 'a90909'
        courses.DEFAULT_COURSE_YAML_DICT[THEME_SECTION]['logo_url'] = ''
        courses.DEFAULT_COURSE_YAML_DICT[THEME_SECTION]['logo_alt_text'] = ''

        courses.DEFAULT_EXISTING_COURSE_YAML_DICT[THEME_SECTION] = { 
            'background_color': 'a90909' }
        courses.DEFAULT_EXISTING_COURSE_YAML_DICT[THEME_SECTION] = { 
            'logo_url': '' }
        courses.DEFAULT_EXISTING_COURSE_YAML_DICT[THEME_SECTION] = { 
            'logo_alt_text': '' }

        courses.Course.OPTIONS_SCHEMA_PROVIDERS[
            THEME_SECTION] += cls.get_fields()
        tabs.Registry.register('settings', 'course_theme', 'Theme', THEME_SECTION)

    @classmethod
    def unregister(cls):
        for field in cls.get_fields():
            courses.Course.OPTIONS_SCHEMA_PROVIDERS[
                THEME_SECTION].remove(field)
예제 #8
0
def create_local_chapter_list_registry():
    """Create the registry for course properties."""

    reg = FieldRegistry('Local Chapter',
                        description='Local Chapters',
                        extra_schema_dict_values={
                            'className': 'inputEx-Group new-form-layout'
                        })
    reg.add_property(SchemaField('code', 'Local Chapter Code', 'string'))
    reg.add_property(SchemaField('name', 'Local Chapter Name', 'string'))
    reg.add_property(SchemaField('city', 'City', 'string'))

    select_data = [('ANDAMAN AND NICOBAR ISLANDS',
                    'Andaman_and_Nicobar_Islands'),
                   ('ANDHRA PRADESH', 'Andhra Pradesh'),
                   ('ARUNACHAL PRADESH', 'Arunachal Pradesh'),
                   ('ASSAM', 'Assam'), ('BIHAR', 'Bihar'),
                   ('CHANDIGARH', 'Chandigarh'),
                   ('CHHATTISGARH', 'Chhattisgarh'),
                   ('DADRA AND NAGAR HAVELI', 'Dadra and Nagar Haveli'),
                   ('DELHI', 'Delhi'), ('GOA', 'Goa'), ('GUJARAT', 'Gujarat'),
                   ('HARYANA', 'Haryana'),
                   ('HIMACHAL PRADESH', 'Himachal Pradesh'),
                   ('JAMMU AND KASHMIR', 'Jammu and Kashmir'),
                   ('JHARKHAND', 'Jharkhand'), ('KARNATAKA', 'Karnataka'),
                   ('KERALA', 'Kerala'), ('LAKSHADWEEP', 'Lakshadweep'),
                   ('MADHYA PRADESH', 'Madhya Pradesh'),
                   ('MAHARASHTRA', 'Maharashtra'), ('MANIPUR', 'Manipur'),
                   ('MEGHALAYA', 'Meghalaya'), ('MIZORAM', 'Mizoram'),
                   ('NAGALAND', 'Nagaland'), ('ODISHA', 'Odisha'),
                   ('PONDICHERRY', 'Pondicherry'), ('PUNJAB', 'Punjab'),
                   ('RAJASTHAN', 'Rajasthan'), ('SIKKIM', 'Sikkim'),
                   ('TAMIL NADU', 'Tamil Nadu'), ('TELANGANA', 'Telangana'),
                   ('TRIPURA', 'Tripura'), ('UTTARAKHAND', 'Uttarakhand'),
                   ('UTTAR PRADESH', 'Uttar Pradesh'),
                   ('WEST BENGAL', 'West Bengal')]

    reg.add_property(
        SchemaField('state',
                    'State',
                    'string',
                    optional=False,
                    select_data=select_data,
                    extra_schema_dict_values={
                        'className': 'inputEx-Field assessment-dropdown'
                    }))

    return reg
예제 #9
0
파일: admin.py 프로젝트: thejeshgn/seek
def create_course_category_registry():
    """Create the registry for course properties."""

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

    # Course level settings.
    reg.add_property(SchemaField(
	'id', 'Course id', 'string', editable=False))
    reg.add_property(SchemaField('title', 'Title', 'string', editable=False))

    reg.add_property(SchemaField(
        'category', 'Category', 'string', optional=True,
        extra_schema_dict_values={}, select_data=[('', '--')]))
    return reg
예제 #10
0
def create_queue_settings_registry():
    """Create the registry for course properties."""

    reg = FieldRegistry('Queue Settings',
                        description='Queue Settings',
                        extra_schema_dict_values={
                            'className': 'inputEx-Group new-form-layout'
                        })
    select_data = [
        (models.WELCOME_NOTIFICATION_INTENT, 'WELCOME_NOTIFICATION_INTENT'),
        (invitation.INVITATION_INTENT, 'INVITATION_INTENT'),
        (announcements.ANNOUNCEMENTS_INTENT, 'ANNOUNCEMENTS_INTENT'),
        (student_questions.FORUM_QUESTION_INTENT, 'FORUM_QUESTION_INTENT')
    ]

    reg.add_property(
        SchemaField('queue_id',
                    'Queue ID',
                    'string',
                    optional=False,
                    select_data=select_data,
                    extra_schema_dict_values={
                        'className': 'inputEx-Field assessment-dropdown'
                    }))

    reg.add_property(
        SchemaField('email_settings',
                    'Email Settings',
                    'string',
                    optional=False,
                    select_data=[],
                    extra_schema_dict_values={
                        'className': 'inputEx-Field assessment-dropdown'
                    }))

    return reg
예제 #11
0
 def SCHEMA(cls, title, announcement_email):
     schema = FieldRegistry(title)
     schema.add_property(SchemaField(
         'key', 'ID', 'string', editable=False,
         extra_schema_dict_values={'className': 'inputEx-Field keyHolder'}))
     schema.add_property(SchemaField(
         'title', 'Title', 'string', optional=True))
     schema.add_property(SchemaField(
         'html', 'Body', 'html', optional=True,
         extra_schema_dict_values={
             'supportCustomTags': tags.CAN_USE_DYNAMIC_TAGS.value,
             'excludedCustomTags': tags.EditorBlacklists.COURSE_SCOPE}))
     schema.add_property(SchemaField(
         'date', 'Date', 'date',
         optional=True, extra_schema_dict_values={
             '_type': 'date', 'dateFormat': 'Y-m-d',
             'valueFormat': 'Y-m-d'}))
     schema.add_property(FieldArray(
         'label_groups', 'Labels',
          item_type=LabelGroupsHelper.make_labels_group_schema_field(),
          extra_schema_dict_values={
              'className': 'inputEx-Field label-group-list'}))
     schema.add_property(SchemaField(
         'send_email', 'Send Email', 'boolean', optional=True,
         extra_schema_dict_values={
             'description':
                 AnnouncementsItemRESTHandler.get_send_email_description(
                     announcement_email)}))
     schema.add_property(SchemaField(
         'is_draft', 'Status', 'boolean',
         select_data=[
             (True, resources_display.DRAFT_TEXT),
             (False, resources_display.PUBLISHED_TEXT)],
         extra_schema_dict_values={'className': 'split-from-main-group'}))
     return schema
예제 #12
0
    def make_labels_group_schema_field(cls):
        label = FieldRegistry(None, description='label')
        label.add_property(
            SchemaField('id', 'ID', 'integer', hidden=True, editable=False))
        label.add_property(SchemaField('checked', None, 'boolean'))
        label.add_property(
            SchemaField('title', None, 'string', optional=True,
                        editable=False))
        label.add_property(
            SchemaField(
                'description',
                None,
                'string',
                optional=True,
                editable=False,
                extra_schema_dict_values={'className': 'label-description'}))
        label.add_property(
            SchemaField(
                'no_labels',
                None,
                'string',
                optional=True,
                editable=False,
                extra_schema_dict_values={'className': 'label-none-in-group'}))

        label_group = FieldRegistry('', description='label groups')
        label_group.add_property(
            SchemaField('title', None, 'string', editable=False))
        label_group.add_property(
            FieldArray('labels',
                       None,
                       item_type=label,
                       extra_schema_dict_values={'className': 'label-group'}))
        return label_group
예제 #13
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
    def make_labels_group_schema_field(cls):
        label = FieldRegistry(None, description='label')
        label.add_property(SchemaField('id', 'ID', 'integer',
                                       hidden=True,
                                       editable=False))
        label.add_property(SchemaField('checked', None, 'boolean'))
        label.add_property(SchemaField('title', None, 'string',
                                       optional=True,
                                       editable=False))
        label.add_property(SchemaField('description', None, 'string',
                                       optional=True,
                                       editable=False,
                                       extra_schema_dict_values={
                                           'className': 'label-description'}))
        label.add_property(SchemaField('no_labels', None, 'string',
                                       optional=True,
                                       editable=False,
                                       extra_schema_dict_values={
                                           'className': 'label-none-in-group'}))

        label_group = FieldRegistry('', description='label groups')
        label_group.add_property(SchemaField('title', None, 'string',
                                             editable=False))
        label_group.add_property(FieldArray('labels', None,
                                            item_type=label,
                                            extra_schema_dict_values={
                                                'className': 'label-group'}))
        return label_group
예제 #15
0
class ProgrammingAssignmentSettings(base.ProgAssignment):
    language_opts = FieldRegistry('Programming Language', '')
    language_opts.add_property(
        SchemaField(
            'language',
            'Programming Language',
            'string',
            select_data=base.ProgAssignment.PROG_LANG_FILE_MAP.items()))
    language_opts.add_property(
        SchemaField('build', 'Build extra args', 'string', optional=True))
    language_opts.add_property(
        SchemaField('exec', 'Execution extra args', 'string', optional=True))
    language_opts.add_property(
        SchemaField('time_limit', 'Time Limit', 'integer', optional=True))
    language_opts.add_property(
        SchemaField('memory_limit', 'Memory Limit', 'integer', optional=True))
    language_opts.add_property(
        SchemaField('process_limit', 'process Limit', 'integer',
                    optional=True))
    language_opts.add_property(
        SchemaField('compilation_time_limit',
                    'Compilation Time Limit',
                    'integer',
                    optional=True))
    language_opts.add_property(
        SchemaField('compilation_memory_limit',
                    'Compilation Memory Limit',
                    'integer',
                    optional=True))
    language_opts.add_property(
        SchemaField('compilation_process_limit',
                    'Compilation process Limit',
                    'integer',
                    optional=True))
    allowed_languages = FieldArray(
        programming_assignment_key('allowed_languages'),
        'Programming Languages for this Course',
        item_type=language_opts,
        extra_schema_dict_values={
            'sortable': False,
            'listAddLabel': 'Add Language',
            'listRemoveLabel': 'Delete',
            'minItems': 1
        })

    @classmethod
    def register(cls):
        programming_settings_fields = set()
        programming_settings_fields.add(lambda c: cls.allowed_languages)
        courses.Course.OPTIONS_SCHEMA_PROVIDERS[
            cls.SETTINGS_SECTION] += programming_settings_fields
        tabs.Registry.register('settings', cls.DASHBOARD_NAV, cls.NAME,
                               cls.SETTINGS_SECTION)

    @classmethod
    def unregister(cls):
        programming_settings_fields = set()
        programming_settings_fields.add(lambda c: cls.allowed_languages)
        for field in programming_settings_fields:
            courses.Course.OPTIONS_SCHEMA_PROVIDERS[
                cls.SETTINGS_SECTION].remove(field)
예제 #16
0
파일: question.py 프로젝트: thejeshgn/seek
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
 def SCHEMA(cls):
     schema = FieldRegistry('Announcement',
         extra_schema_dict_values={
             'className': 'inputEx-Group new-form-layout'})
     schema.add_property(SchemaField(
         'key', 'ID', 'string', editable=False, hidden=True))
     schema.add_property(SchemaField(
         'title', 'Title', 'string', optional=True))
     schema.add_property(SchemaField(
         'html', 'Body', 'html', optional=True,
         extra_schema_dict_values={
             'supportCustomTags': tags.CAN_USE_DYNAMIC_TAGS.value,
             'excludedCustomTags': tags.EditorBlacklists.COURSE_SCOPE}))
     schema.add_property(SchemaField(
         'date', 'Date', 'string',
         optional=True, extra_schema_dict_values={
             '_type': 'datetime',
             'className': 'inputEx-CombineField gcb-datetime '
             'inputEx-fieldWrapper date-only'}))
     schema.add_property(FieldArray(
         'label_groups', 'Labels',
          item_type=LabelGroupsHelper.make_labels_group_schema_field(),
          extra_schema_dict_values={
              'className': 'inputEx-Field label-group-list'}))
     schema.add_property(SchemaField(
         'is_draft', 'Status', 'boolean',
         select_data=[
             (True, resources_display.DRAFT_TEXT),
             (False, resources_display.PUBLISHED_TEXT)],
         extra_schema_dict_values={'className': 'split-from-main-group'}))
     return schema
예제 #18
0
def create_assignment_registry():
    """Create the registry for course properties."""

    reg = FieldRegistry(
        base.OfflineAssignmentBase.NAME,
        description=base.OfflineAssignmentBase.DESCRIPTION)

    # Course level settings.
    reg.add_property(SchemaField(
        'key', 'ID', 'string', editable=False,
        extra_schema_dict_values={'className': 'inputEx-Field keyHolder'}))
    reg.add_property(
        SchemaField('type', 'Type', 'string', editable=False))
    reg.add_property(
        SchemaField('title', 'Title', 'string', optional=False))
    reg.add_property(
        SchemaField('weight', 'Weight', 'number', optional=False))
    reg.add_property(SchemaField('parent_unit', 'Parent Unit', 'string', select_data=[]))

    reg.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'}))

    reg.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
예제 #19
0
 def SCHEMA(cls, title, announcement_email):
     schema = FieldRegistry(title)
     schema.add_property(
         SchemaField('key',
                     'ID',
                     'string',
                     editable=False,
                     extra_schema_dict_values={
                         'className': 'inputEx-Field keyHolder'
                     }))
     schema.add_property(
         SchemaField('title', 'Title', 'string', optional=True))
     schema.add_property(
         SchemaField('html',
                     'Body',
                     'html',
                     optional=True,
                     extra_schema_dict_values={
                         'supportCustomTags':
                         tags.CAN_USE_DYNAMIC_TAGS.value,
                         'excludedCustomTags':
                         tags.EditorBlacklists.COURSE_SCOPE
                     }))
     schema.add_property(
         SchemaField('date',
                     'Date',
                     'date',
                     optional=True,
                     extra_schema_dict_values={
                         '_type': 'date',
                         'dateFormat': 'Y-m-d',
                         'valueFormat': 'Y-m-d'
                     }))
     schema.add_property(
         FieldArray(
             'label_groups',
             'Labels',
             item_type=LabelGroupsHelper.make_labels_group_schema_field(),
             extra_schema_dict_values={
                 'className': 'inputEx-Field label-group-list'
             }))
     schema.add_property(
         SchemaField(
             'send_email',
             'Send Email',
             'boolean',
             optional=True,
             extra_schema_dict_values={
                 'description':
                 AnnouncementsItemRESTHandler.get_send_email_description(
                     announcement_email)
             }))
     schema.add_property(
         SchemaField('is_draft',
                     'Status',
                     'boolean',
                     select_data=[(True, resources_display.DRAFT_TEXT),
                                  (False, resources_display.PUBLISHED_TEXT)
                                  ],
                     extra_schema_dict_values={
                         'className': 'split-from-main-group'
                     }))
     return schema
예제 #20
0
파일: settings.py 프로젝트: thejeshgn/seek
    def create_service_account_registry(cls):
        """Create the registry for course properties."""

        reg = FieldRegistry('Google Service Account',
                            description='Google Service Accounts',
                            extra_schema_dict_values={
                                'className': 'inputEx-Group new-form-layout'
                            })
        reg.add_property(SchemaField('id', 'ID', 'string', editable=False))

        credential_type_tuple_list = (
            service_account_models.GoogleServiceAccountTypes.to_dict(
            ).iteritems())

        select_data = []
        for a, b in credential_type_tuple_list:
            select_data.append((b, a))

        # Making select_data read only for now since it will get auto populated
        # depending on which one of the three links to add/edit the user
        # clicks on. This will avoid overriding wrong data by mistake.
        reg.add_property(
            SchemaField('credential_type',
                        'Credential Type',
                        'string',
                        select_data=select_data,
                        editable=False))
        reg.add_property(
            SchemaField('client_email',
                        'Client Email',
                        'string',
                        description='Email ID '
                        'of the account with which to use this credential'))
        reg.add_property(
            SchemaField('sub_user_email',
                        'Sub User Email',
                        'string',
                        optional=True,
                        description='Optional for service account'))
        reg.add_property(
            SchemaField('scope',
                        'Scopes',
                        'list',
                        description='List of scopes you want '
                        'to use with this credential'))
        reg.add_property(
            SchemaField('client_id',
                        'Client ID',
                        'string',
                        optional=True,
                        description='Required for Oauth2 Client ID'))
        reg.add_property(
            SchemaField('api_key',
                        'API Key',
                        'string',
                        optional=True,
                        description='Required for type API KEY, optional for '
                        'service account'))
        reg.add_property(
            SchemaField('project_id',
                        'Project ID',
                        'string',
                        optional=True,
                        description='Optional for service account'))
        reg.add_property(
            SchemaField('project_key_id',
                        'Project ID Key',
                        'string',
                        optional=True,
                        description='Optional for service account'))
        reg.add_property(
            SchemaField('private_key',
                        'Private Key',
                        'text',
                        optional=True,
                        description='Required for service account'))
        reg.add_property(
            SchemaField('auth_uri',
                        'auth_uri',
                        'string',
                        optional=True,
                        description='Optional for service account'))
        reg.add_property(
            SchemaField('token_uri',
                        'token_uri',
                        'string',
                        optional=True,
                        description='Optional for service account'))
        reg.add_property(
            SchemaField('auth_provider_x509_cert_url',
                        'auth_provider_x509_cert_url',
                        'string',
                        optional=True,
                        description='Optional for service account'))
        reg.add_property(
            SchemaField('client_x509_cert_url',
                        'client_x509_cert_url',
                        'string',
                        optional=True,
                        description='Optional for service account'))

        return reg