Exemple #1
0
def getStudentList():
    if request.method == 'GET':
        studentList = mysql_dao.getStudentList(dbcon)        
        return render_template('studentList.html', studentList = studentList)
    elif request.method == 'POST':
        if request.form['submitButton'] == 'Logout':
            session['logged_in']=False
            return render_template('login.html')
        studentList = mysql_dao.getStudentList(dbcon)
        for row in studentList:
            if request.form['submitButton'] == row[0]:
                session['usernameProfile']=row[0]
                formDict=mysql_dao.getUser(dbcon,session['usernameProfile'])
                msg = ""
                if formDict['Transcript']:
                    msg = formDict['Transcript']
                else:
                    msg = "No transcript found"
                ref1 = ""
                ref2 = ""
                refDict=getRefPath(session['usernameProfile'])
                if refDict:
                    if refDict['ReferalFilePath1']:
                        ref1 = refDict['ReferalFilePath1']
                    else:
                        ref1 = "No document for Referral1 found"
                    if refDict['ReferalFilePath2']:
                        ref2 = refDict['ReferalFilePath2']
                    else:
                        ref2 = "No document for Referral2 found"   
                ReferencesDict = dict()
                ReferencesDict = mysql_dao.getReferences(dbcon, formDict)
                universityList = mysql_dao.getUniversityList(dbcon)
                mentorsList = mysql_dao.getMentorsList(dbcon)
                return render_template('profile.html',formDict=formDict,ref1=ref1,ref2=ref2,msg=msg,universityList=universityList,mentorsList=mentorsList,ReferencesDict=ReferencesDict)
Exemple #2
0
def main():

    if not session.get('logged_in'):
        return render_template('login.html')
    else:
        formDict = session['user']
        if formDict['UserType'] == UserType['Student']:
            if formDict['ApplicationStatus'] == ApplicationStatus[
                    'IncompleteApplication']:
                universityList = mysql_dao.getUniversityList(dbcon)
                return render_template('first.html',
                                       formDict=formDict,
                                       universityList=universityList)
            elif formDict['ApplicationStatus'] == ApplicationStatus[
                    'ReferencesRequired2'] or formDict[
                        'ApplicationStatus'] == ApplicationStatus[
                            'ReferencesRequired1']:
                ReferencesDict = dict()
                ReferencesDict = mysql_dao.getReferences(dbcon, formDict)
                return render_template('third.html',
                                       ReferencesDict=ReferencesDict)
            elif formDict['ApplicationStatus'] == ApplicationStatus[
                    'UnderReview']:
                return render_template('underReview.html')

        elif formDict['UserType'] == UserType['Admin']:
            studentList = mysql_dao.getStudentList(dbcon)
            return render_template('studentList.html', studentList=studentList)
Exemple #3
0
def checkUsername():
  
  global userSession
  name = str(request.form['username'])
  passwrd = str(request.form['passwrd'])

  formDict=mysql_dao.checkUser(dbcon, name, passwrd)
  
  if not formDict:
      return render_template('login.html',error="Username or password is incorrect. Please try again.")
  if not 'HowDidYouHear' in formDict:
      formDict['HowDidYouHear']=''
      
  session['logged_in'] = True
  session['user']=formDict

  if formDict['UserType'] == UserType['Student']: 
      if formDict['ApplicationStatus'] == ApplicationStatus['IncompleteApplication']:
          universityList = mysql_dao.getUniversityList(dbcon)          
          return render_template('first.html',formDict=formDict,universityList=universityList)
          
      elif formDict['ApplicationStatus'] == ApplicationStatus['ReferencesRequired2'] or formDict['ApplicationStatus'] == ApplicationStatus['ReferencesRequired1']:
          ReferencesDict = dict()
          ReferencesDict = mysql_dao.getReferences(dbcon, formDict)
          return render_template('third.html', ReferencesDict = ReferencesDict)  
      elif formDict['ApplicationStatus'] == ApplicationStatus['UnderReview']:
          return render_template('underReview.html')
  elif formDict['UserType'] == UserType['Admin']:
      studentList = mysql_dao.getStudentList(dbcon)
      return render_template('studentList.html',studentList=studentList)
  elif formDict['UserType'] == UserType['Referal']:
      studentList = mysql_dao.getStudentsByProf(dbcon,formDict['Username'])
      if not studentList:
          return render_template('referalStudentList.html',studentList=studentList,message="References no longer required")
      return render_template('referalStudentList.html',studentList=studentList)
Exemple #4
0
def updateProfileByAdmin():
    if request.form['submitButton'] == 'Back': 
        session.pop('usernameProfile')
        studentList = mysql_dao.getStudentList(dbcon)
        return render_template('studentList.html', studentList = studentList)
    elif request.form['submitButton'] == 'Logout':
        session.pop('usernameProfile')
        session['logged_in']=False
        return render_template('login.html')
        
    elif request.form['submitButton'] =='ViewTranscript':
        formDict = mysql_dao.getUser(dbcon,session['usernameProfile'])
        if formDict['Transcript']:
            filename = secure_filename(formDict['Transcript'])
            return upload_Transcript(filename)
            
    elif request.form['submitButton'] =='ViewReferral1':
        formDict = getRefPath(session['usernameProfile'])
        if formDict['ReferalFilePath1']:
            filename = secure_filename(formDict['ReferalFilePath1'])
            return upload_Referral(filename)
    elif request.form['submitButton'] =='ViewReferral2':
        formDict = getRefPath(session['usernameProfile'])
        if formDict['ReferalFilePath2']:
            filename = secure_filename(formDict['ReferalFilePath2'])
            return upload_Referral(filename)
        
    
    if request.form['submitButton'] == 'Save':
        l=list()
        formDict=dict()
        formDict=mysql_dao.getUser(dbcon,session['usernameProfile'])
        
        formDict['FirstName'] = str(request.form.get('FNAME'))
        formDict['LastName'] = str(request.form.get('LNAME'))
        formDict['DOB'] = str(request.form.get('DATEOFBIRTH'))
        formDict['Email'] = str(request.form.get('EMAIL'))
        formDict['AlternativeEmail'] = str(request.form.get('ALTERNATIVE_EMAIL'))
        formDict['Phone'] = str(request.form.get('PERMANENT_PHONE'))
        formDict['PermStreetAdr1'] = str(request.form.get('PERMANENT_ADDRESS1'))
        formDict['PermStreetAdr2'] = str(request.form.get('PERMANENT_ADDRESS2'))
        formDict['PermanentCity'] = str(request.form.get('PERMANENT_CITY'))
        formDict['PermanentState'] = str(request.form.get('PERMANENT_STATE'))
        formDict['PermanentZipCode'] = str(request.form.get('PERMANENT_ZIP'))
        formDict['CampusAdr1'] = str(request.form.get('SCHOOL_ADDRESS1'))
        formDict['CampusAdr2'] = str(request.form.get('SCHOOL_ADDRESS2'))
        formDict['CampusCity'] = str(request.form.get('CAMPUS_CITY'))
        formDict['CampusState'] = str(request.form.get('CAMPUS_STATE'))
        formDict['CampusZipCode'] = str(request.form.get('CAMPUS_ZIP'))
        formDict['HomeCity'] = str(request.form.get('HOMECITY'))
        formDict['HomeState'] = str(request.form.get('HOMESTATE'))
        formDict['Gender'] = str(request.form.get('GENDER'))      
        formDict['Ethnicity'] = str(request.form.get('ethinicity')) 
        if(formDict['Ethnicity']=='Other'):
          formDict["EthnicityOther"] = str(request.form.get('ethnicityother'))
        else:
          formDict["EthnicityOther"] = ""
        formDict['CitizenshipStatus'] = str(request.form.get('CITIZENSHIP'))
        if(formDict['CitizenshipStatus']=='resident'):
            formDict['PlaceOfBirth']=str(request.form.get('PLACEOFBIRTH'))
        formDict['MotherDegree'] = str(request.form.get('MOTHERDEGREE'))
        formDict['FatherDegree'] = str(request.form.get('FATHERDEGREE'))
        formDict['ClassCompletedSpring'] = str(request.form.get('CLASSCOMPLETE'))
        formDict['GraduationMonth'] = str(request.form.get('GRADUATION_DATE'))
        formDict['GraduationYear'] = str(request.form.get('BACHELORYEAR'))
        formDict['CumulativeGPA'] = str(request.form.get('CUMULATIVEGPA'))
        formDict['AdvancedDegreeObjective'] = str(request.form.get('ADVANCEDDEGREE'))
        if(formDict['AdvancedDegreeObjective']=='Other'):
            formDict['AdvancedDegreeObjectiveOther'] = str(request.form.get('ADVANCEDDEGREEOTHER'))
        formDict['IsUndergraduateResearchProgramOffered'] = str(request.form.get('RESEARCHOFFER'))
          
        if request.form.get('AMGENSITE'):
            l.append("Amgen National Website") 
        if request.form.get('UNIVERSITYSITE'):
            l.append("University website, University name")
            formDict['HowDidYouHearUniversityName'] = str(request.form.get('UNIVERSITYSITENAME'))
        else:
            formDict['HowDidYouHearUniversityName'] = ""
        if request.form.get('EMAILANNOUNCEMENT'):
            l.append("E-mail Announcement")
        if request.form.get('POSTER'):
            l.append("Poster")
        if request.form.get('CONFERENCE'):
            l.append("Conference, Conference Name")
            formDict['HowDidYouHearConferenceName'] = str(request.form.get('CONFERENCENAME'))
        else:
            formDict['HowDidYouHearConferenceName'] = ""
        if request.form.get('ACADEMICADVISOR'):
            l.append("Academic Advisor")
        if request.form.get('INTERNETSEARCH'):
            l.append("Internet Search")
        if request.form.get('HOMEUNIVERSITY'):
            l.append("Faculty/Staff from home university") 
        if request.form.get('OTHERUNIVERSITY'):
            l.append("Faculty/Staff from home university")
            formDict['HowDidYouHearOtherUniversityName'] = str(request.form.get('OTHERUNIVERSITYNAME'))
        else:
            formDict['HowDidYouHearOtherUniversityName'] = ""
        if request.form.get('AMGENOTHER'):
            l.append("Other")
            formDict['HowDidYouHearOther'] = str(request.form.get('AMGENOTHERNAME'))
        else:
            formDict['HowDidYouHearOther'] = ""
        formDict['HowDidYouHear'] = l
        
        formDict['AnyOtherAmgenScholarsSite'] = str(request.form.get('applicationLYINGOTHER'))
        formDict['YesOtherAmgenScholarsSite'] = str(request.form.get('applicationLYINGOTHERSPECIFY'))
        formDict['PastAmgenScholarParticipation'] = str(request.form.get('PARTICIPATED'))
        formDict['OriginalResearchPerformed'] = str(request.form.get('UG_RESEARCH'))
        formDict['CanArriveAtColumbiaMemorialDay'] = str(request.form.get('ARRIVEONFIRSTDAY'))
        formDict['ArriveAtColumbiaComments'] = str(request.form.get('ARRIVEONFIRSTDAYX'))
        formDict['CurrentlyAttendingUniversity'] = str(request.form.get('university'))
        formDict['Major'] = str(request.form.get('MAJOR'))
        formDict['DateSpringSemesterEnds'] = str(request.form.get('SEMESTER_END'))
        mysql_dao.insertFirstForm(dbcon,formDict)
        
        formDict['ScienceExperience'] = str(request.form.get('EXPERIENCE'))
        formDict['CareerPlans'] = str(request.form.get('CAREER_PLANS'))
        formDict['Mentor1'] = str(request.form.get('mentor0'))
        formDict['Mentor2'] = str(request.form.get('mentor1'))
        formDict['Mentor3'] = str(request.form.get('mentor2'))
        formDict['Mentor4'] = str(request.form.get('mentor3'))
        formDict['Mentor5'] = str(request.form.get('mentor4'))
        formDict['Mentor6'] = str(request.form.get('mentor5'))
        formDict['Mentor7'] = str(request.form.get('mentor6'))
        formDict['Mentor8'] = str(request.form.get('mentor7'))
        formDict['ApplicationStatus'] = str(request.form.get('ApplicationStatus'))
        for i in range(0,26):
            if request.form['stitle'+''+str(i)] != '':
                formDict['stitle'+''+str(i)] = request.form['stitle'+''+str(i)]
                formDict['scredits'+''+str(i)] = request.form['scredits'+''+str(i)]
                formDict['sgrade'+''+str(i)] = request.form['sgrade'+''+str(i)]
            else:
                break;
        
                
           
        transcript = request.files.get('fileupload')
        formDict['Transcript']=saveFile(transcript,session['usernameProfile'],'Transcript')
    
        mysql_dao.insertSecondForm(dbcon,formDict)
        
        
        for i in range(1,3):       
            formDict['RefName'+str(i)] = str(request.form.get('REFERENCE_'+str(i)))
            formDict['RefEmail'+str(i)] = str(request.form.get('ref'+str(i)+'email'))
            formDict['RefFilePath'+str(i)] = session['usernameProfile']+' '+formDict['RefName'+str(i)] +'.pdf'
          
        
        formDict['ReviewWaiver'] = str(request.form.get('REFERENCE_WAIVER'))
        session['user'] = formDict
        mysql_dao.insertThirdForm(dbcon,formDict)
        mysql_dao.insertReviewWaiver(dbcon, formDict)

        #formDict['Transcript'] = request.files['fileupload'].read()
              
        
        mentorsList = mysql_dao.getMentorsList(dbcon)
        universityList = mysql_dao.getUniversityList(dbcon)

        ReferencesDict = dict()
        ReferencesDict = mysql_dao.getReferences(dbcon, formDict)
        
        ref1 = request.files.get('fileupload1')
        temp = saveFile(ref1,session['usernameProfile'],'Referal',formDict['RefEmail1'])
        if temp:
            formDict['RefFilePath1']=temp
        
        
        ref2 = request.files.get('fileupload2')
        temp = saveFile(ref2,session['usernameProfile'],'Referal',formDict['RefEmail2'])
        if temp:
            formDict['RefFilePath2']=temp
        
        return render_template('profile.html',formDict=formDict,universityList=universityList,mentorsList=mentorsList,ReferencesDict=ReferencesDict)