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}))
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")
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}))
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}))
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}))
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}))
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}))
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}))
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}))
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}))
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}))
def textPage(response): response.write(TemplateAPI.render("game.py", response, {}))
def test(response): response.write(TemplateAPI.render( "test.html", response, {"title": "test"}))
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}))
def displayMapPage(response): response.write(TemplateAPI.render("displaymap.html", response, {}))
def aboutPage(response): response.write(TemplateAPI.render('About.html', response, {}))
def showAllDebugPage(response): data = getLocations(100) response.write(TemplateAPI.render('display.html', response, {'data': data})) print(data)
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}))
def homePage(response): response.write(TemplateAPI.render('homepage.html', response, {}))
def render_search_test(response): response.write(TemplateAPI.render('search_test.html', response, {}))
def inputPage(response): response.write(TemplateAPI.render('input.html', response, {}))
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}))
def booking(response): usertype = response.get_secure_cookie('user_type') response.write(TemplateAPI.render( "booking.html", response, {"title": "Booking", "usertype": usertype}))
def displayAllPage(response): response.write(TemplateAPI.render("displayall.html", response, {}))
def indexPage(response): response.write(TemplateAPI.render('Main_Page.html', response, {}))
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}))
def indexPage(response): response.write(TemplateAPI.render('../static/bootstrap-template-route.html', response, {}))
def indexPage(response): response.write(TemplateAPI.render("website.html", response, {}))