Ejemplo n.º 1
0
def display_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('scholarships'),
        title='Scholarships & Awards',
        primaryList=create_scholarships_list(scholarships),
        primaryListHr=False,
        editable=True,
        editableUrl=url_for('web.display_admin_scholarships')
    )
Ejemplo n.º 2
0
 def read_units(cls):
     '''This method retrieves program data from CIT for all department
     programs and combines it in one list. It calls read_unit(), which
     actually reads more information than is required for the current
     list of academic programs (e.g., course lists and scholarships), but
     this allows us to add information to the list if we choose to do so
     later. The secondary education program is not currently stored at CIT.
     '''
     result = []
     # Read a master scholarships list to be used multiple times.
     scholarships = Scholarships.read_units()
     for programName in ['bcs', 'cs', 'is', 'ds', 'dc']:
         program = cls.read_unit(programName, scholarships=scholarships)
         if program is not None:
             result.append(program)
     return result
Ejemplo n.º 3
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
    )
Ejemplo n.º 4
0
 def read_unit(cls, name, scholarships=None):
     '''This method retrieves merges program data from the CIT
     and CS databases.
     '''
     result = Unit.merge_records(
         cls.get_cit_data(name),
         g.mongo.db.programs.find_one({'name': name})
     )
     if result:
         # Modify the course hyperlinks to link to our own pages.
         if 'majorCourses' in result:
             result['majorCourses'] = \
                 cls.fix_courses(result['majorCourses'])
         if 'minorCourses' in result:
             result['minorCourses'] = \
                 cls.fix_courses(result['minorCourses'])
         # Add scholarships regardless of where the program comes from.
         # Use the scholarships parameter if given, otherwise read them.
         if scholarships is None:
             scholarships = Scholarships.read_units()
         result['scholarships'] = \
             cls.get_scholarships(name, scholarships)
     return result