Beispiel #1
0
def profResults():


    prof = Professor('', '', '', '', '', '', '', '')

    profid = request.args.get('profid')

    database = Database()
    database.connect()
    prof = database.profSearch(profid)
    database.disconnect()

    titles = prof.getTitles()
    links = prof.getLinks()
    pic = prof.getPicLink()

    html = render_template('profpage.html', profid = profid, prof = prof, pic = pic, titles = titles, links = links)
    response = make_response(html)
    return(response)
Beispiel #2
0
def backResults():
    prof = Professor('', '', '', '', '', '', '', '')

    profid = request.args.get('profid')

    database = Database()
    database.connect()
    prof = database.profSearch(profid)
    database.disconnect()

    html = '<div class="modal-header">'
    html += '<button type="button" class="close" data-dismiss="modal">&times;</button>'
    html += '<h4 class="modal-title">Advisor Email Builder</h4>'
    html += '</div>'
    html += '<div class="modal-body">'
    html += '<p>Enter the information then click generate to build a customized email to Professor ' + str(prof.getName()) + '</p>'
    html += '<form id="emailForm">'
    html += '<input type="hidden" id="profid" value=' + str(profid) + '>'
    html += '<h4>Select Class: </h4>'
    html += '<select name="year" id="year">'
    html += '<option value="Junior">Junior</option>'
    html += '<option value="Senior">Senior</option>'
    html += '</select>'
    html += '<h4>Select Project Type: </h4>'
    html += '<select name="type" id="type">'
    html += '<option value="Independent Work">Independent Work</option>'
    html += '<option value="Thesis">Thesis</option>'
    html += '</select>'
    html += '<h4>Area of Research that interests you most: </h4>'
    html += '<select name="areas" id="areas">'
    areaCount = 0
    for area in prof.getAreas():
        html += '<option value="' + str(areaCount) + '">' + str(area[0].strip('. ')) + '</option>'
        areaCount += 1
    html += '</select>'

    if (prof.getProjects() == 'No projects found.') and (prof.getLinks() == ""):
        html += '<input type="hidden" id="projs" value="none">'
    else:
        html += '<h4>Select the Project or Thesis that Interests you most: </h4>'
        html += '<select name="projs" id="projs" style="width: 500px;">'
        projCount = 0
        if prof.getProjects() != 'No projects found.':
            for proj in prof.getProjects():
                html += '<option value="' + str(projCount) + '">' + str(proj[0].strip('. ')) + '</option>'
                projCount += 1
        if prof.getLinks() != "":
            for title in prof.getTitles():
                html += '<option value="' + str(projCount) + '">' + str(title.strip(',. ')) + '</option>'
                projCount += 1
        html += '</select>'
    html += '</form>'
    html += '</div>'
    html += '<div class="modal-footer">'
    html += '<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>'
    html += '<input type="button" class="btn btn-primary" value="Generate" onclick="getEmailResults();"/>'
    html += '</div>'


    html.encode('utf-8')
    response = make_response(html)

    return(response)