示例#1
0
def chat_with_profs():
    user = get_user()
    if user != "DLI":
        if request.method == "GET":
            if get_account_type() == "stu":
                prof = request.args["name"]
                try:
                    create_table("Chat" + str(user), "Prof" + prof)
                    print("i")
                    return render_template('chatwithprof_sec.html',
                                           data="data",
                                           user=str(user))
                except:
                    db_name = "Prof" + prof + ".db"
                    db = get_db(db_name)
                    query = "SELECT * FROM {}".format("Chat" + str(user))
                    cursor = db.execute(query)
                    data = cursor.fetchall()
                    db.close()
                    return render_template('chatwithprof_sec.html',
                                           data=data,
                                           user=str(user),
                                           db_name=db_name,
                                           choice=prof,
                                           stu="")
            elif get_account_type() == "prof":
                stu = request.args["name"]
                try:
                    create_table("Chat" + stu, "Prof" + user)
                    return render_template('chatwithprof_sec.html',
                                           data="data",
                                           user=user)
                except:
                    db_name = "Prof" + user + ".db"
                    db = get_db(db_name)
                    query = "SELECT * FROM {}".format("Chat" + stu)
                    cursor = db.execute(query)
                    data = cursor.fetchall()
                    db.close()
                    return render_template('chatwithprof_sec.html',
                                           data=data,
                                           user=user,
                                           db_name=db_name,
                                           choice=stu,
                                           stu=stu)
        else:
            name = request.form["Name"]
            message = request.form["Message"]
            db = request.form["db"]
            choice = request.form["choice"]
            stu = request.form["stu"]
            new(name, message, db, stu)
            return redirect(url_for("chat_with_profs", name=choice))

    else:
        return render_template('chatwithprof_sec.html', user=user)
示例#2
0
def chat_with_prof_menu():
    user = get_user()
    print(user)
    if user != "DLI":
        if get_account_type() == "stu":
            prof_names = list_of_prof()
            print(prof_names)
            return render_template("chatwithprof_menu.html", names=prof_names)
        elif get_account_type() == "prof":
            stu_names = list_of_stu()
            return render_template("chatwithprof_menu.html", names=stu_names)
    else:
        return render_template('chatwithprof_sec.html', user=user)
示例#3
0
def ECG():
    if get_user() == "DLI":
        return render_template('ECG.html', status="DLI")
    elif get_user() != "DLI":
        return render_template('ECG.html', status=get_user())
示例#4
0
def contact_us():
    if get_user() == "DLI":
        return render_template('contact_us.html', status="DLI")
    elif get_user() != "DLI":
        return render_template('contact_us.html', status=get_user())
示例#5
0
def about():
    if get_user() == "DLI":
        return render_template('about_page.html', status="DLI")
    elif get_user() != "DLI":
        return render_template('about_page.html', status=get_user())
示例#6
0
def index():
    if get_user() == "DLI":
        return render_template('home.html', status="DLI")
    elif get_user() != "DLI":
        return render_template('home.html', status=get_user())