예제 #1
0
파일: views.py 프로젝트: Calvin-CS/csweb
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
    )
예제 #2
0
파일: views.py 프로젝트: Calvin-CS/csweb
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')
    )
예제 #3
0
파일: views.py 프로젝트: Calvin-CS/csweb
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')
    )
예제 #4
0
파일: views.py 프로젝트: Calvin-CS/csweb
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
    )
예제 #5
0
파일: views.py 프로젝트: Calvin-CS/csweb
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')
    )
예제 #6
0
파일: views.py 프로젝트: Calvin-CS/csweb
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)
    )
예제 #7
0
파일: views.py 프로젝트: Calvin-CS/csweb
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
    )
예제 #8
0
파일: views.py 프로젝트: Calvin-CS/csweb
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')
    )
예제 #9
0
파일: views.py 프로젝트: Calvin-CS/csweb
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)
    )
예제 #10
0
파일: views.py 프로젝트: Calvin-CS/csweb
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
    )
예제 #11
0
파일: views.py 프로젝트: Calvin-CS/csweb
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')
        )
예제 #12
0
파일: views.py 프로젝트: Calvin-CS/csweb
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')
    )
예제 #13
0
파일: views.py 프로젝트: Calvin-CS/csweb
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'))
예제 #14
0
파일: views.py 프로젝트: Calvin-CS/csweb
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'))