Exemplo n.º 1
0
def internal_server_error_err(e):
	print(f'Exception: {e}')
	try:
		if 'credentials' in session:
			userConfig = utils.getUserConfig(session['credentials'])
			return render_template('errors/500.html', theme=userConfig['appearance']['theme']), 500
		else:
			return render_template('errors/500.html', theme='light'), 500
	except Exception:
		return render_template('errors/500.html', theme='light'), 500
Exemplo n.º 2
0
def hello():
	if 'credentials' in session:
		user = buildUser(session['credentials'])
		if user is None:
			return render_template('landing.html', theme='light')
		userConfig = utils.getUserConfig(session['credentials'])

		return render_template('landing.html', user=user, theme=userConfig['appearance']['theme'])
	else:
		return render_template('landing.html', theme='light')
Exemplo n.º 3
0
def im_a_teapot_err(e):
	print(f'Exception: {e}')
	try:
		if 'credentials' in session:
			userConfig = utils.getUserConfig(session['credentials'])
			return render_template('errors/418.html', theme=userConfig['appearance']['theme']), 418
		else:
			return render_template('errors/418.html', theme='light'), 418
	except Exception:
		return render_template('errors/418.html', theme='light'), 418
Exemplo n.º 4
0
def method_not_allowed_err(e):
	print(f'Exception: {e}')
	try:
		if 'credentials' in session:
			userConfig = utils.getUserConfig(session['credentials'])
			return render_template('errors/405.html', theme=userConfig['appearance']['theme']), 405
		else:
			return render_template('errors/405.html', theme='light'), 405
	except Exception:
		return render_template('errors/405.html', theme='light'), 405
Exemplo n.º 5
0
def page_not_found_err(e):
	print(f'Exception: {e}')
	try:
		if 'credentials' in session:
			userConfig = utils.getUserConfig(session['credentials'])
			return render_template('errors/404.html', page=request.path, theme=userConfig['appearance']['theme']), 404
		else:
			return render_template('errors/404.html', page=request.path, theme='light'), 404
	except Exception:
		return render_template('errors/404.html', page=request.path, theme='light'), 404
Exemplo n.º 6
0
def classesPage(course_id=None, coursework_id=None, id=None):

	if course_id is None and coursework_id is None and id is None:
		# Viewing all classes
		user = buildUser(session['credentials'])

		userConfig = utils.getUserConfig(session['credentials'])
		return render_template("classes.html", user=user, theme=userConfig['appearance']['theme'])

	elif course_id is not None and coursework_id is None and id is None:
		# Viewing single class assignments
		user = buildUser(session['credentials'], course_id=course_id)
		userConfig = utils.getUserConfig(session['credentials'])
		return render_template("assignments.html", assignments=user['assignments'], user=user, theme=userConfig['appearance']['theme'])

	elif course_id is not None and coursework_id is not None and id is not None:
		# Viewing specific assignment
		assignment_details = googleclassroom.getAssignmentDetails(session['credentials'], course_id, coursework_id, id)

		user = buildUser(session['credentials'])
		userConfig = utils.getUserConfig(session['credentials'])

		return render_template('view-assignment.html', assignment_details=assignment_details, user=user, theme=userConfig['appearance']['theme'])
Exemplo n.º 7
0
def updatePreferences():
	userConfig = utils.getUserConfig(session['credentials'])

	if 'themeSelection' in request.form:
		theme = request.form['themeSelection']

		if theme not in ['light', 'dark']:
			return redirect(url_for('settings', errorMsg='Invalid Theme Name: ' + escape(theme)))

		userConfig['appearance']['theme'] = theme

	if 'timeZone' in request.form:
		tz = request.form['timeZone']

		if tz not in pytz.common_timezones:
			return redirect(url_for('settings', errorMsg='Invalid Timezone: ' + escape(tz)))

		userConfig['system']['timezone'] = tz

	utils.editUserConfig(session['credentials'], userConfig)

	return redirect('/settings')
Exemplo n.º 8
0
def assignmentsPage():
	user = buildUser(session['credentials'], addClasses=False)

	userConfig = utils.getUserConfig(session['credentials'])
	# assignments={'assignment1': {'name': 'Solve world hunger', 'description': 'Please solve world hunger by tuesday', 'due': time.time()+20000, 'class': 'Biowarfare II with Angela Stewart', 'done': False, 'link': 'https://www.abunchofcats.tk', 'platform':'Classroom'}, 'assignment2': {'name': 'Grow your own polyp', 'description': 'Grow your own polyp in the grower from your textbook', 'due': time.time()-1000, 'class': 'Medical Science 3.2 with Mr. Patty', 'done': False, 'link': 'https://www.abunchofcats.tk', 'platform':'TurnItIn'}, 'assignment3': {'name': 'Find the secret', 'description': 'Do it', 'due': time.time()+99999999, 'class': 'Intro to [redacted]', 'done': False, 'link': 'https://www.abunchofcats.tk', 'platform': 'Canvas'}, 'assignment4': {'name': "HEHE YOU'VE ALREADY DONE IT AND YOU DON'T EVEN KNOW WHAT IT IS YOU ABSOLUETE FOOL", 'description': 'HHOOO EHHEE', 'due': time.time()-32456, 'class': 'Head washing club', 'done': True, 'link': 'https://www.abunchofcats.tk', 'platform': 'Classroom'}}
	return render_template("assignments.html", assignments=user['assignments'], user=user, theme=userConfig['appearance']['theme'])
Exemplo n.º 9
0
def settings():

	user = buildUser(session['credentials'], addClasses=False)

	userConfig = utils.getUserConfig(session['credentials'])
	return render_template('settings.html', userConfig=userConfig, theme=userConfig['appearance']['theme'], errorMsg=request.args.get('errorMsg'), user=user, timezone_list=pytz.common_timezones)