Ejemplo n.º 1
0
def display_people():
    '''Configure and display a list of faculty members.'''
    return display_content(
        breadcrumbs=get_breadcrumbs('people'),
        image=Images.read_tagged_unit('people'),
        title='Faculty and Staff',
        primaryList=create_people_list(People.read_units()),
        primaryListHr=True,
        editable=False
    )
Ejemplo n.º 2
0
def display_research():
    '''Configure and display the research overview page.'''
    department = check_unit(Departments.read_unit('cs'))
    return display_content(
        breadcrumbs=get_breadcrumbs('research'),
        image=Images.read_tagged_unit('research'),
        title='Research',
        primary=department.get('research'),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 3
0
def display_honors():
    '''Display information on the honors program.'''
    department = check_unit(Departments.read_unit('cs'))
    return display_content(
        breadcrumbs=get_breadcrumbs('academics', 'honors'),
        image=Images.read_tagged_unit('academics.honors'),
        title='Graduating with Honors',
        primary=department.get('honors'),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 4
0
def display_resources():
    '''Configure and display the resources overview page.'''
    return display_content(
        breadcrumbs=get_breadcrumbs('resources'),
        image=Images.read_tagged_unit('resources'),
        title='Department Resources',
        primary='''The Department of Computer Science offers the following
                   resources.''',
        primaryList=create_resources_list(Resources.read_units()),
        primaryListHr=False,
        editable=False
    )
Ejemplo n.º 5
0
def display_courses():
    '''Configure and display the courses list page.'''
    department = check_unit(Departments.read_unit('cs'))
    courses = check_unit(Courses.read_units())
    return display_content(
        breadcrumbs=get_breadcrumbs('academics', 'courses'),
        image=Images.read_tagged_unit('courses'),
        title='Courses & Materials',
        tabList=create_course_tab_list(courses, department),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 6
0
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)
    )
Ejemplo n.º 7
0
def display_admin_images():
    '''This routine displays the administration tools for images. It maps both
    web routes to support certain unused breadcrumb trails.
    '''
    return display_content(
        breadcrumbs=get_breadcrumbs('admin', 'images'),
        title='Administration: Images',
        primary=create_hyperlink(url_for('web.create_image'),
                                 'Create a new image'),
        primaryList=create_image_list(Images.read_units()),
        primaryListHr=True,
        editable=False
    )
Ejemplo n.º 8
0
def display_about():
    '''Configure and display the about page, with an appropriate image and the
    department long description.
    '''
    department = check_unit(Departments.read_unit('cs'))
    return display_content(
        breadcrumbs=get_breadcrumbs('about'),
        image=Images.read_tagged_unit('about'),
        title='About Us',
        primary=department.get('longDescription'),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 9
0
def display_image(name):
    '''This routine displays a given image. We included only to support
    generally unused breadcrumb trails. It is password protected at the
    moment to ensure that users access raw images as part of actual pages.
    '''
    image = check_unit(Images.read_unit(name))
    return display_content(
        breadcrumbs=get_breadcrumbs('images', name),
        title=image.get('name'),
        primary='<img src="/static/images/' + image.get('filename') + '">',
        primaryListHr=False,
        editable=True,
        editableUrl=url_for('web.update_image', name=name)
    )
Ejemplo n.º 10
0
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
    )
Ejemplo n.º 11
0
def create_image():
    '''This routine displays an editing page for creating an image.'''
    form = Images()
    if form.is_submitted():
        if form.validate() and request.form.get('submit'):
            Images.create_unit(form)
            return redirect(url_for('web.display_image',
                            name=form.getName()))
        else:
            return redirect(url_for('web.display_admin_images'))
    else:
        form.initialize(action='create')
        return display_content(
            form=form,
            title='Create Image',
            breadcrumbs=get_breadcrumbs('images', 'create')
        )
Ejemplo n.º 12
0
def display_index():
    '''Configure and display the main index page, with an appropriate image,
    the department short description and a list of current news articles.
    '''
    department = check_unit(Departments.read_unit('cs'))
    return display_content(
        image=Images.read_tagged_unit('departments.cs'),
        title=department.get('title'),
        subtitle=department.get('tagline'),
        primary=department.get('shortDescription'),
        sideTitle='Computing News',
        sideList=create_brief_news_list(News.read_units(limit=2 + TechNews.TECH_NEWS_LIMIT)),
        editable=True,
        editableUrl=url_for('web.update_department', name='cs')
    )
Ejemplo n.º 13
0
def update_image(name):
    '''For GET requests, this method allows the administrator to edit the named
       image. For POST requests, this method saves the edits made by the
       administrator and then reloads/redisplays the image admin page.
       Non-authenticated users are redirected to the login page. Images that
       don't exist can't be edited. Because we don't show individual images,
       all redirects go to the images admin page.
    '''
    form = Images()
    if form.is_submitted():
        if form.validate() and request.form.get('submit'):
            Images.update_unit(form)
            return redirect(url_for('web.display_image',
                            name=form.getName()))
    else:
        image = Images.read_unit(name)
        if image:
            form.initialize(name=name, action='update', image=image)
            return display_content(
                form=form,
                title='Edit: ' + name,
                breadcrumbs=get_breadcrumbs('images', name, 'edit')
            )
    return redirect(url_for('web.display_admin_images'))
Ejemplo n.º 14
0
def delete_image(name):
    '''This routine deletes the given image entry, but it leaves the actual
    image in place.
    '''
    Images.delete_unit(name)
    return redirect(url_for('web.display_admin_images'))