Пример #1
0
def adView(response):
    adId = response.get_field('id', '')
    ads = db.viewAd(dbConn, adId)
    usertype = response.get_secure_cookie('user_type')
    userid = int(response.get_secure_cookie("user_id"))
    response.write(TemplateAPI.render(
        "advertisementView.html", response, {"title": "test", "ads": ads, "userid": userid, "usertype": usertype}))
Пример #2
0
def PhotoView(response):
    try:
        try:
            usrid = sessions.get_uid(response)
            photoid = int(response.get_field("photo"))
        except:
            usrid = sessions.get_uid(response)
            photoid = 1

        conn = database_engine.Get_DatabaseConnection()
        curs = conn.cursor()
        curs.execute("""SELECT userid FROM photos WHERE photoid=?""", (response.get_field("photo"),))
        if curs.fetchone()[0] == usrid:
            button = photoHTMLrenderer.RenderEditButton(photoid)
        else:
            button = ""
        comments = photoAPI._photo_GetPicComments(photoid)
        result = photoHTMLrenderer.PhotoPageRender(photoid, usrid)
        page = TemplateAPI.render(
            "photoview.tem",
            response,
            {
                "edit": button,
                "comments": comments,
                "photo": photoid,
                "usr": usrid,
                "imgtag": result[0],
                "title": result[1],
                "description": result[2],
            },
        )
        response.write(page)
    except:
        response.redirect("/internal_error")
Пример #3
0
def register(response):
    if response.get_secure_cookie('user_id'):
        response.redirect('/dashboard')
    else:
        fail = response.get_field('fail')
        response.write(TemplateAPI.render('register.html', response, {
                       "title": "Register", "fail": fail}))
Пример #4
0
def manageAccount(response):
    userid = response.get_secure_cookie('user_id')
    fail = response.get_field('fail', '') == '1'
    user = db.getUser(dbConn, userid)
    usertype = response.get_secure_cookie('user_type')
    response.write(TemplateAPI.render("manageAccount.html",
                                      response, {"title": "Account", "user": user, "fail":  fail, "usertype": usertype}))
Пример #5
0
def display14159265Page(response):
    name = response.get_field("name")
    password = response.get_field("password")
    if name == None or password == None:
        is_Valid = False
    else:
        is_Valid = get_user(name, password)
    response.write(TemplateAPI.render('14159265.html', response, {'name': name, 'password': password, 'is_Valid':is_Valid}))
Пример #6
0
def homePage(response):
    ads = db.getAds(dbConn, "%")
    userid = response.get_secure_cookie("user_id")
    if response.get_secure_cookie('user_id'):
        response.redirect('/dashboard')
    else:
        response.write(TemplateAPI.render(
            'homepage.html', response, {"title": "Homepage", "ads": ads, "userid": userid}))
Пример #7
0
def advertisement(response):
    search = response.get_field('search', '')
    print search
    usertype = response.get_secure_cookie('user_type')
    userid = int(response.get_secure_cookie("user_id"))
    ads = db.getAds(dbConn, '%')
    response.write(TemplateAPI.render("advertisement.html",
                                      response, {"title": "Advertisement", "ads": ads, "userid": userid, "usertype": usertype}))
Пример #8
0
def searchCharities(response):
    usertype = response.get_secure_cookie('user_type')
    sType = 0
    if int(usertype) == 1:
        sType = 2
    elif int(usertype) == 2:
        sType = 1

    if not response.get_field("charitySearch"):
        charities = db.getCharities(dbConn, sType)
        response.write(TemplateAPI.render("searchCharities.html",
                                          response, {"title": "Charities", "charities": charities, "usertype": usertype}))
    else:
        searchQuery = response.get_field("charitySearch")
        filteredCharities = db.getFilteredCharities(dbConn, searchQuery, sType)
        response.write(TemplateAPI.render("filterCharities.html",
                                          response, {"title": "Charities", "filteredCharities": filteredCharities, "usertype": usertype}))
Пример #9
0
def getAssignmentsPageHandler(response):
    assignments = getAssignments()
    name = response.get_field("name")
    password = response.get_field("password")
    if name == None or password == None:
        is_Valid = False
    else:
        is_Valid = get_high_user(name, password)
    response.write(TemplateAPI.render('Manage_Assignments.html', response, {'assignments': assignments, 'name': name, 'password': password, 'is_Valid':is_Valid}))
Пример #10
0
def loginPage(response):
    name = response.get_field("name")
    password = response.get_field("password")
    if name == None or password == None:
        is_Valid = False
    else:
        is_Valid = get_user(name, password)
    response.write(
        TemplateAPI.render("login.html", response, {"name": name, "password": password, "is_Valid": is_Valid})
    )
def render_search(response):
    query = response.get_field("query")
    search_type = response.get_field("search_type")
    results = []
    if search_type == "user":
        results = searchAPI.search_users(query)
    elif search_type == "event":
        results = searchAPI.search_events(query)
    elif search_type == "photo":
        results = searchAPI.search_photos(query)
    response.write(TemplateAPI.render('search_page.html', response, {'results':results}))
Пример #12
0
def dashboard(response):
    active = response.get_secure_cookie('active')
    print active
    name = response.get_secure_cookie('name')
    usertype = response.get_secure_cookie('user_type')
    userid = int(response.get_secure_cookie("user_id"))
    search = response.get_field('charitySearch', '')
    print search
    if search:
        search = "%" + search + "%"
    else:
        search = '%'
    ads = db.getAds(dbConn, search)

    response.write(TemplateAPI.render(
        'dashboard.html', response, {"title": "Dashboard", "usertype": usertype, "ads": ads, "userid": userid, "active": active, "name": name}))
Пример #13
0
def textPage(response):
    response.write(TemplateAPI.render("game.py", response, {}))
Пример #14
0
def test(response):
    response.write(TemplateAPI.render(
        "test.html", response, {"title": "test"}))
Пример #15
0
def viewAppointments(response):
    usertype = response.get_secure_cookie('user_type')
    apps = db.getAppointments(dbConn, response.get_secure_cookie('user_id'))
    response.write(TemplateAPI.render(
        "myappointments.html", response, {"title": "My Appointments", "apps":apps, "usertype": usertype}))
Пример #16
0
def displayMapPage(response):
    response.write(TemplateAPI.render("displaymap.html", response, {}))
Пример #17
0
def aboutPage(response):    
    response.write(TemplateAPI.render('About.html', response, {}))
Пример #18
0
def showAllDebugPage(response):
    data = getLocations(100)
    response.write(TemplateAPI.render('display.html', response, {'data': data}))
    print(data)
Пример #19
0
def signupPage(response):
    name = response.get_field("name")
    password = response.get_field("password")
    if name != None and password != None:
        make_user(name, password)
    response.write(TemplateAPI.render("signup.html", response, {"name": name, "password": password}))
Пример #20
0
def homePage(response):
    response.write(TemplateAPI.render('homepage.html', response, {}))
def render_search_test(response):
    response.write(TemplateAPI.render('search_test.html', response, {}))
Пример #22
0
def inputPage(response):    
    response.write(TemplateAPI.render('input.html', response, {}))
Пример #23
0
def aboutPage(response):
    # response.write("HELLO WORLD")
    array = [str(randint(0, 10)) for x in range(0, 10)]
    name = response.get_field("input_name")
    response.write(TemplateAPI.render("about.html", response, {"randoms": array, "lol": "kek", "name": name}))
Пример #24
0
def booking(response):
    usertype = response.get_secure_cookie('user_type')
    response.write(TemplateAPI.render(
        "booking.html", response, {"title": "Booking", "usertype": usertype}))
Пример #25
0
def displayAllPage(response):
    response.write(TemplateAPI.render("displayall.html", response, {}))
Пример #26
0
def indexPage(response):
    response.write(TemplateAPI.render('Main_Page.html', response, {}))
Пример #27
0
def userAds(response):
    ads = db.getUserAds(dbConn, response.get_secure_cookie('user_id'))
    usertype = response.get_secure_cookie('user_type')
    print ads
    response.write(TemplateAPI.render(
        "userAds.html", response, {"title": "My Ads", "usertype": usertype, "ads": ads}))
Пример #28
0
def indexPage(response):
    response.write(TemplateAPI.render('../static/bootstrap-template-route.html', response, {}))
Пример #29
0
def indexPage(response):
    response.write(TemplateAPI.render("website.html", response, {}))