def display_program(name=None): '''Configure and display a program page.''' program = check_unit(Programs.read_unit(name)) return display_content( breadcrumbs=get_breadcrumbs('academics', program.get('name')), image=Images.read_tagged_unit(name), title=program.get('title'), primary=program.get('majorDescription'), tabList=create_program_tab_list(program), editable=True, editableUrl=url_for('web.update_program', name=name) )
def display_admin_programs(): '''This routine displays the administration tools for program units. It is password protected because the listing page allows administrative features. Only the model schedules can be edited; the rest of the data comes from CIT. ''' return display_content( breadcrumbs=get_breadcrumbs('admin', 'programs'), title='Administration: Programs', primaryList=create_admin_programs_list(Programs.read_units()), primaryListHr=True, editable=False )
def display_programs(): '''Configure and display the academics overview page.''' return display_content( breadcrumbs=get_breadcrumbs('academics'), image=Images.read_tagged_unit('about'), title='Academics', primary='''The Department of Computer Science offers the following academic programs. To learn more about our academics goals, see our <a href="/administration/assessment/plan">program outcomes</a>.''', primaryList=create_programs_list(Programs.read_units()), primaryListHr=False, editable=False )
def update_program(name): '''Configure the editing for the program pages. Because all of the program data except the model schedule comes from CIT, this routine will only support updates to the model schedule. The administrator cannot edit the name of the program. ''' form = Programs() if form.is_submitted(): if form.validate() and request.form.get('submit'): Programs.update_unit(form) else: program = Programs.read_unit(name) if program: form.initialize(name=name, action='update', document=program) return display_content( form=form, title='Edit: ' + name, breadcrumbs=get_breadcrumbs('academics', name, 'edit') ) return redirect(url_for('web.display_program', name=name))