Ejemplo n.º 1
0
 def get_scholarships(cls, programName, scholarships):
     '''This method creates a list of scholarships applicable to the given
     program. It could use utilities/create_scholarships_list(), but that
     method must create formatted text, not lists, and it filters entries
     based on the given program name.
     The method receives a list of scholarships so that it doesn't have to
     keep re-reading the same list for each program in a long program list.
     '''
     formatedText = '''<p>Students in this program are eligible for the
     following scholarships and awards:</p><ul>'''
     # Only read the scholarship units if we haven't already done so.
     for scholarship in scholarships:
         if scholarship.get('programs') is None or \
                         programName not in scholarship.get('programs'):
             continue
         formatedText += '<li>'
         if scholarship.get('url'):
             url = scholarship.get('url')
         else:
             url = '/scholarships/' + scholarship.get('name')
         formatedText += '<strong>' + \
                         create_hyperlink(url, scholarship.get('title')) + \
                         '</strong>'
         formatedText += ' &ndash; '
         if scholarship.get('shortDescription') is not None:
             formatedText += scholarship.get('shortDescription')
         formatedText += '</li>'
     formatedText += '</ul>'
     return formatedText
Ejemplo n.º 2
0
def display_admin_news():
    '''This routine displays the administration tools for news.
    We'll eventually use CIT's news tools.
    '''
    return display_content(
        breadcrumbs=get_breadcrumbs('admin', 'news'),
        title='Administration: News Articles',
        primary=create_hyperlink(url_for('web.create_news_article'),
                                 'Create a news article'),
        primaryList=create_newsarticle_list(News.read_units()),
        primaryListHr=True,
        editable=False
    )
Ejemplo n.º 3
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.º 4
0
def display_admin_documents():
    '''This routine displays the administration tools for user documents. It is
    password protected because the listing page allows administrative features.
    Documents should be accessed as linked from existing pages.
    '''
    return display_content(
        breadcrumbs=get_breadcrumbs('admin', 'documents'),
        title='Administration: Documents',
        primary=create_hyperlink(url_for('web.create_document'),
                                 'Create a new document'),
        primaryList=create_document_list(Documents.read_units()),
        primaryListHr=True,
        editable=False
    )
Ejemplo n.º 5
0
def display_admin_scholarships():
    '''This routine displays the administration tools for user documents. It is
    password protected because the listing page allows administrative features.
    Documents should be accessed as linked from existing pages.
    '''
    scholarships = Scholarships.read_units()
    return display_content(
        breadcrumbs=get_breadcrumbs('admin', 'scholarships'),
        title='Administration: Scholarships',
        primary=create_hyperlink(url_for('web.create_scholarship'),
                                 '''Create a new scholarship
                                    (in the CS database only)'''),
        primaryList=create_admin_scholarships_list(scholarships),
        primaryListHr=True,
        editable=True
    )