Esempio n. 1
0
	def GET(self):
		dbase=Database()
		ath=Auth(dbase)
		if ath.checkAuth():
			raise web.seeother('/map')
		tkn,new=dbase.user_exists(ath.getUserid())
		if new == True:
			raise web.seeother("/onboard")
		env = Environment(loader=PackageLoader('html', ''))
		template = env.get_template('landing.html')
		
		return template.render()
Esempio n. 2
0
	def POST(self):
		dbase=Database()
		ath=Auth(dbase)
		if not ath.checkAuth():
			raise web.seeother('/')
		inp=web.input(quest="")
		if inp["quest"] != "":
			q=Quest(dbase)
			q.getSched(inp["quest"],ath.getUserid())
			dbase.user_setold(ath.getUserid())
			raise web.seeother('/map')
		else:
			return "Please go back and actually submit something."
		# redirect(CASLoginURL)
Esempio n. 3
0
	def GET(self):
		dbase=Database()
		ath=Auth(dbase)
		if not ath.checkAuth():
			raise web.seeother('/login')
		tkn,new=dbase.user_exists(ath.getUserid())
		if new == True:
			raise web.seeother("/onboard")
		user_data = web.input(node="2016012246")
		nd1=user_data.node
		
		pt = Paths(dbase)
		env = Environment(loader=PackageLoader('html', ''))
		template = env.get_template('maptest.html')
		
		classes=dbase.getDayClasses(ath.getUserid())
		for cls in classes:
			x=classes.index(cls)
			if x ==0:
				classes[x].lastClassLoc="b-E3"
			else:
				classes[x].lastClassLoc=classes[x-1].build
			classes[x].class_name=classes[x].class_name.split(" - ")[0]
			classes[x].build="b-"+cls.where.split(" ")[0]
			classes[x].timestamp=classes[x].timestamp.strftime("%I:%M %p")
			classes[x].timeend=classes[x].timeend.strftime("%I:%M %p")
			if cls.type=="LEC":
				classes[x].col="warning"
			elif cls.type=="TST":
				classes[x].col="danger"
			elif cls.type=="TUT":
				classes[x].col="info"
			elif cls.type=="LAB":
				classes[x].col="success"
			elif cls.type=="SEM":
				classes[x].col="warning"




		xs=[]
		pth=[]
		for el in pt.getPath(nd1,"b-E3"):
			node=dbase.getNode(el)
			pth.append([node.x,node.y])
			xs.append(node)
		return template.render(vertices=xs,path=pth,classes=classes,qr_data=ath.getUserid()+":"+ath.getUserToken())