# Path: app/models/submissions.py
# def submit_application(resume, d, simple=False):
# def clean_up_data(d):
# def is_email_available(email):
# def save_resume(resume, first_name, last_name):
# def add_applicant(d):
# def submit_reference(applicant, d):
# def get_by_secret_md5(secret_md5):
# def add_reference(secret_md5, d):


import web
import config
from app.models import submissions
from config import view
from web import form
)

# This form is only used for applicant who are affiliated to the university.
# For those applicants the application is simple (no letter of reference and financial support).
application_form_simple = form.Form(
    form.Radio('affiliated', 
        ('University of Cambridge', 'Microsoft Research Cambridge', 'Other (explain below)'),
        form.notnull,
        description='Affiliation with Cambridge *'),
    
    form.Textbox('first_name', 
        form.notnull,
        description='First Name *'),
    form.Textbox('last_name', 
        form.notnull,
        description='Last Name *'),
    form.Radio('gender', 
        ('Male', 'Female'),
        form.notnull,
        description='Gender *'),
    form.Textbox('nationality', 
        form.notnull,
        description='Nationality *'),
    form.Textbox('country', 
        form.notnull,
        description='Country of Current Affiliation *'),
    
    form.Textbox('email', 
        form.notnull, vemail,
        form.Validator('This email address is already taken (Have you already submitted an application?)', 

# Path: app/models/submissions.py
# def submit_application(resume, d, simple=False):
# def clean_up_data(d):
# def is_email_available(email):
# def save_resume(resume, first_name, last_name):
# def add_applicant(d):
# def submit_reference(applicant, d):
# def get_by_secret_md5(secret_md5):
# def add_reference(secret_md5, d):


# Path: app/controllers/submit_application.py
import web
import config
from app.models import submissions
from config import view
from web import form

)

# This form is only used for applicant who are affiliated to the university.
# For those applicants the application is simple (no letter of reference and financial support).
application_form_simple = form.Form(
    form.Radio('affiliated', 
        ('University of Cambridge', 'Microsoft Research Cambridge', 'Other (explain below)'),
        form.notnull,
        description='Affiliation with Cambridge *'),
    
    form.Textbox('first_name', 
        form.notnull,
        description='First Name *'),
    form.Textbox('last_name', 
        form.notnull,
        description='Last Name *'),
    form.Radio('gender', 
        ('Male', 'Female'),
        form.notnull,
        description='Gender *'),
    form.Textbox('nationality', 
        form.notnull,
        description='Nationality *'),
    form.Textbox('country', 
        form.notnull,
        description='Country of Current Affiliation *'),
    
    form.Textbox('email', 
        form.notnull, vemail,
        form.Validator('This email address is already taken (Have you already submitted an application?)', 

        lambda x: submissions.is_email_available(x)),