예제 #1
0
	def post(self):
		self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
		roles=Role.all()
		if roles.count() == 0:
			# No roles were set up, set them up now
			adminRole = Role()
			adminRole.name=ROLE_ADMIN
			adminRole.put()
			role = Role()
			role.name=ROLE_DELIVERY_GUY
			role.put()
			role = Role()
			role.name=ROLE_COOK
			role.put()
			role = Role()
			role.name=ROLE_AGENT
			role.put()
			user = User()
			user.email = self.request.get("adminEmail")
			user.password = "******"
			m = hashlib.md5()
			encodedString = self.request.get("adminPassword").encode('ascii', errors='replace')
			m.update(encodedString)
			user.passwordHash = str(m.hexdigest())
			user.activated = True
			user.role = adminRole
			user.put();
			template = jinja_environment.get_template('templates/setup/setupSuccess.html')
			self.printPage("Sikeres inicializálás", template.render(), True, True)
		else:
			template = jinja_environment.get_template('templates/setup/alreadySetUp.html')
			self.printPage("Korábban inicializálva", template.render(), True, True)
예제 #2
0
	def get(self):
		roles=Role.all()
		if roles.count() == 0:
			template = jinja_environment.get_template('templates/setup/setup.html')
			self.printPage("Weboldal nicializálása", template.render(), True, True)
		else:
			template = jinja_environment.get_template('templates/setup/alreadySetUp.html')
			self.printPage("Korábban inicializálva", template.render(), True, True)
예제 #3
0
	def get(self):
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		template = jinja_environment.get_template('templates/admin/dataDownloadPage.html')
		self.response.out.write(template.render())
예제 #4
0
	def get(self):
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		rawCodes = ZipCodes.all().get()
		if (rawCodes == None):
			rawCodes = ZipCodes()
			zipCodeList = createZipCodeList()
			rawCodes.deliveryCosts = zipCodeList
			rawCodes.put()
		codes = []
		for code in rawCodes.deliveryCosts:
			parts=code.rsplit(" ")
			codes.append(
				{
					'code':parts[0],
					'cost':parts[1],
					'limit':parts[2]
				})
		template_values = {
			'codes':codes
		}
		template = jinja_environment.get_template('templates/admin/zipCodeEditor.html')
		self.printPage("dashboard", template.render(template_values), False, False)
예제 #5
0
	def post(self):
		self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		toReplace = self.request.get('toReplace')
		replaceWith = self.request.get('replaceWith')
		monday = self.request.get('monday')
		mondaysWeeks = UserWeekOrder.all().filter("monday = ", parseDate(monday))
		weeks = []
		for week in mondaysWeeks:
			newComposits = []
			modified = False
			for item in week.orderedComposits:
				if item.find(toReplace) != -1:
					modified = True
					newItem = item.replace(toReplace, replaceWith)
					newComposits.append(newItem)
				else:
					newComposits.append(item)
			if modified:
				week.orderedComposits = newComposits
				week.put()
				weeks.append(week)
		template_values = {
			'toReplace':toReplace,
			'replaceWith':replaceWith,
			'monday':monday,
			'weeks':weeks
		}
		template = jinja_environment.get_template('templates/admin/replaceComposit.html')
		self.printPage("Kompositok cseréje", template.render(template_values), False, False)
예제 #6
0
	def get(self):
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		
		orderedMaintenences = Maintenence.all().order('startDate')
		deadline = getDeadline()
		nowTime = datetime.datetime.now(timeZone)
		hour = nowTime.hour
		minute = nowTime.minute
		if minute < 10:
			minute = '0' + str(minute)
		deadlineHour = deadline.tm_hour
		deadlineMinute = deadline.tm_min
		if deadlineMinute < 10:
			deadlineMinute = '0' + str(deadlineMinute)
		template_values = {
			'maintenences':orderedMaintenences,
			ORDER_DEADLINE_KEY:getSiteParam(ORDER_DEADLINE_KEY),
			DELIVERY_START_KEY:getSiteParam(DELIVERY_START_KEY),
			DELIVERY_END_KEY:getSiteParam(DELIVERY_END_KEY),
			'currentTime':datetime.datetime.now(timeZone),
			'hour': hour,
			'minute':minute,
			'deadlineHour':deadlineHour,
			'deadlineMinute': deadlineMinute
		}
		template = jinja_environment.get_template('templates/admin/siteAdmin.html')
		self.printPage("dashboard", template.render(template_values), False, False)
예제 #7
0
	def get(self):
		self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		template = jinja_environment.get_template('templates/admin/replaceComposit.html')
		self.printPage("Kompositok cser&eacute;je", template.render(), False, False)
예제 #8
0
	def get(self):
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		users = User.all()
		template_values = {
			'users' : users
		}
		template = jinja_environment.get_template('templates/csv/userList.download')
		self.response.out.write(template.render(template_values))
예제 #9
0
	def get(self):
		if(not isUserAdmin(self)):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		template_values = {
			'date':'UNKNOWN',
			'features':''
		}
		maintenences = Maintenence.all().filter("active = ", True)
		if maintenences.count() > 0:
			m = maintenences.get()
			template_values['date'] = m.displayedDate
			template_values['features'] = m.features
		template = jinja_environment.get_template('templates/admin/siteDown.html')
		self.response.out.write(template.render(template_values))
예제 #10
0
	def get(self):
		
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		users = getUsers()
		allUsers = []
		today=datetime.date.today()
		monday = getMonday(today)
		maxWeeks = 20
		weekTotals = []
		for i in range(0, maxWeeks):
			weekTotalITem = {
					'total' : 0,
					'monday' : monday + datetime.timedelta(days = (i - maxWeeks + 2) * 7)
				}
			weekTotals.append(weekTotalITem)
		for user in users:
			orderTotal = 0
			computedWeeks = []
			for i in range(0, maxWeeks):
				actualMonday = monday + datetime.timedelta(days = (i - maxWeeks + 2) * 7)
				week = getUserWeekForDay(user['key'], actualMonday)
				if week != None:
					weekTotals[i]['total'] = weekTotals[i]['total'] + week['weekTotal']
					computedWeek = {
						'itemPrice': week['weekTotal'],
						'userKey':user['key'],
						'monday': actualMonday,
					}
					orderTotal = orderTotal + week['weekTotal']
				else:
					computedWeek = {'itemPrice': 0}
				computedWeeks.append(computedWeek)
			user['computedWeeks'] = computedWeeks
			user['orderTotal'] = orderTotal
			allUsers.append(user)
		orderedUsers = sorted(allUsers, key=lambda item:item['orderTotal'], reverse=True)
		template_values = {
			'users':orderedUsers,
			'weekTotals':weekTotals
		}
		template = jinja_environment.get_template('templates/admin/users.html')
		self.printPage("Rendel&eacute;sek", template.render(template_values), False, False)
예제 #11
0
	def get(self):
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		users = User.all()
		allUsers = []
		today=datetime.date.today()
		monday = getMonday(today)
		maxWeeks = 20
		weekTotals = []
		for i in range(0, maxWeeks):
			weekTotalITem = {
					'total' : 0,
					'monday' : monday + datetime.timedelta(days = (i - maxWeeks + 1) * 7)
				}
			weekTotals.append(weekTotalITem)
		for user in users:
			orderTotal = 0
			computedWeeks = []
			for i in range(0, maxWeeks):
				actualMonday = monday + datetime.timedelta(days = (i - maxWeeks + 1) * 7)
				weeks = user.weeks.filter("monday = ", actualMonday)
				if (weeks.count() > 0):
					weekTotal = getOrderTotal(weeks)
					weekTotals[i]['total'] = weekTotals[i]['total'] + weekTotal
					computedWeek = {
						'itemPrice': weekTotal,
						'userKey':user.key(),
						'monday': actualMonday,
					}
					orderTotal = orderTotal + weekTotal
				else:
					computedWeek = {'itemPrice': 0}
				computedWeeks.append(computedWeek)
			user.computedWeeks = computedWeeks
			user.orderTotal = orderTotal
			allUsers.append(user)
		orderedUsers = sorted(allUsers, key=lambda item:item.orderTotal, reverse=True)
		template_values = {
			'users':orderedUsers,
			'weekTotals':weekTotals
		}
		template = jinja_environment.get_template('templates/admin/everyUsersOrder.html')
		self.printPage("Rendel&eacute;sek", template.render(template_values), False, False)
예제 #12
0
	def get(self):
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		menuItems = MenuItem.all()
		newMenuItems = []
		for menuItem in menuItems:
			try:
				menuItem.dish.key()
			except:
				menuItem.dish = None
			newMenuItems.append(menuItem)
		template_values = {
			'menuItems' : menuItems
		}
		template = jinja_environment.get_template('templates/csv/menuItemList.download')
		self.response.out.write(template.render(template_values))
예제 #13
0
	def get(self):
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		weeks = UserWeekOrder.all()
		newWeeks = []
		for week in weeks:
			try:
				week.user.key()
			except:
				week.user = None
			newWeeks.append(week)
		template_values = {
			'weeks' : newWeeks
		}
		template = jinja_environment.get_template('templates/csv/userOrders.download')
		self.response.out.write(template.render(template_values))
예제 #14
0
	def get(self):
		if not isUserAdmin(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL		
			self.redirect("/")
			return
		addresses = Address.all()
		address = Address()
		for address in addresses:
			address.active = True
			try:
				code = int(address.zipCode)
				if isProperZipCode(code):
					address.zipNumCode = code
				else:
					address.zipNumCode = 1111
			except:
				address.zipNumCode = 1111
			address.put()
		template_values = {
			'addresses':addresses
		}
		template = jinja_environment.get_template('templates/admin/siteAdmin.html')
		self.printPage("dashboard", template.render(template_values), False, False)
예제 #15
0
	def get(self):
		template = jinja_environment.get_template('templates/userForms/privacy.html')
		self.printPage("Adatv&eacute;delmi nyilatkozat", template.render(), True, True)
예제 #16
0
	def get(self):
		template = jinja_environment.get_template('templates/newYear.html')
		self.printPage("Boldog &Uacute; &Eacute;vet!", template.render(), True, True)
예제 #17
0
	def get(self):
		template = jinja_environment.get_template('templates/about/about.html')
		self.printPage("R&oacute;lunk", template.render(), True, True)
예제 #18
0
	def get(self):
		template = jinja_environment.get_template('templates/google24f0feb13afae7e0.html')
		self.response.out.write(template.render())
예제 #19
0
	def get(self):
		template = jinja_environment.get_template('templates/caloryCalculator.html')
		self.printPage("Kaloria szamito", template.render(), True, True)
예제 #20
0
	def get(self):
		template = jinja_environment.get_template('templates/contacts.html')
		self.printPage("Kapcsolat", template.render(), True, True)
예제 #21
0
	def get(self):
		template = jinja_environment.get_template('templates/about/gluten.html')
		self.printPage("GY.I.K", template.render(), True, True)
예제 #22
0
	def get(self):
		template = jinja_environment.get_template('templates/about/services.html')
		self.printPage("Szolg&aacute;ltat&aacute;sok", template.render(), True, True)