Esempio n. 1
0
    def me(self):
        if (request.method == "GET"):
            cookie = request.cookies.get("GFB_Cookie")
            if (cookie == None):
                return ''
            else:
                decode = Cookie.decryptCookie(cookie)
                return json.dumps(decode)
        else:  #open host site
            cookie = request.cookies.get("GFB_Cookie")
            if (cookie == None):
                return ''
            else:
                encode = {}
                decode = Cookie.decryptCookie(cookie)
                encode['role'] = decode['role']
                encode['user_name'] = decode['user_name']
                encode['email'] = decode['email']

                if (request.params['changed'] == 'true'):
                    encode['host_site'] = request.params['siteID']
                else:
                    encode['host_site'] = ''

                cookie = Cookie(encode['user_name'], encode['email'],
                                encode['role'], encode['host_site'])
                response.delete_cookie('GFB_Cookie')
                response.set_cookie("GFB_Cookie",
                                    cookie.encryptCookie(),
                                    max_age=180 * 24 * 3600)

                return render('/tools/distOrders.mako')
Esempio n. 2
0
	def me(self):
		if (request.method == "GET"):
			cookie = request.cookies.get("GFB_Cookie")	
			if(cookie == None):
				return ''
			else:
				decode = Cookie.decryptCookie(cookie)
				return json.dumps(decode)
		else: #open host site
			cookie = request.cookies.get("GFB_Cookie")	
			if(cookie == None):
				return ''
			else:
				encode = {}
				decode = Cookie.decryptCookie(cookie)
				encode['role'] = decode['role']
				encode['user_name'] = decode['user_name']
				encode['email'] = decode['email']
				
				if (request.params['changed'] == 'true'):
					encode['host_site'] = request.params['siteID']
				else:
					encode['host_site'] = ''
					
				cookie = Cookie(encode['user_name'],encode['email'], encode['role'], encode['host_site'])
				response.delete_cookie('GFB_Cookie')
				response.set_cookie("GFB_Cookie", cookie.encryptCookie(), max_age=180*24*3600)
									
				return render('/tools/distOrders.mako')
Esempio n. 3
0
	def me(self):
		cookie = request.cookies.get("FCS_GFB_Cookie")	
		if(cookie == None):
			return ''
		else:
			decode = Cookie.decryptCookie(cookie)
			return decode
Esempio n. 4
0
 def me(self):
     cookie = request.cookies.get("FCS_GFB_Cookie")
     if (cookie == None):
         return ''
     else:
         decode = Cookie.decryptCookie(cookie)
         return decode
Esempio n. 5
0
 def dashboard(self):
     cookie = request.cookies.get("GFB_Cookie")
     if (cookie == None):
         response.status_int = 404
         return
     else:
         creds = Cookie.decryptCookie(cookie)
         return render('/tools/dashboard.mako')
Esempio n. 6
0
	def dashboard(self):
		cookie = request.cookies.get("GFB_Cookie")
		if(cookie == None):
			response.status_int = 404
			return
		else:
			creds = Cookie.decryptCookie(cookie)
			return render('/tools/dashboard.mako')
Esempio n. 7
0
	def manageHS(self):
		#look at cookie
		cookie = request.cookies.get("FCS_GFB_Cookie")
		if(cookie == None):
			return "{\"success\":\"false\", \"message\":\"You must be logged in to see this page\"}"
		else:
			creds = Cookie.decryptCookie(cookie)
			if(creds.get('role') == '2') or (creds.get('role') == '1'):
				return render("/tools/manageHS.mako");
			else:
				return "{\"success\":\"false\", \"message\":\"You must be a coordinator or administrator to see this page\"}"
Esempio n. 8
0
 def manageHS(self):
     #look at cookie
     cookie = request.cookies.get("FCS_GFB_Cookie")
     if (cookie == None):
         return "{\"success\":\"false\", \"message\":\"You must be logged in to see this page\"}"
     else:
         creds = Cookie.decryptCookie(cookie)
         if (creds.get('role') == '2') or (creds.get('role') == '1'):
             return render("/tools/manageHS.mako")
         else:
             return "{\"success\":\"false\", \"message\":\"You must be a coordinator or administrator to see this page\"}"
Esempio n. 9
0
	def cashsales(self):
		cookie = request.cookies.get("GFB_Cookie")
		if(cookie == None):
			response.status_int = 404
			return
		else:
			creds = Cookie.decryptCookie(cookie)
			if (creds.get('role') == '1') or (creds.get('role') == '2') or (creds.get('role') == '3'):
				return render('/tools/cashSales.mako')
			else:
				response.status_int = 404
				return
Esempio n. 10
0
	def manageHS(self):
		cookie = request.cookies.get("GFB_Cookie")
		if(cookie == None):
			response.status_int = 404
			return
		else:
			creds = Cookie.decryptCookie(cookie)
			if(creds.get('role') == '3' or creds.get('role') == '2' or creds.get('role') == '1'):
				return render("/tools/manageHS.mako");
			else:
				response.status_int = 404
				return
Esempio n. 11
0
	def masterCustList(self):
		#look at cookie
		cookie = request.cookies.get("GFB_Cookie")
		if(cookie == None):
			response.status_int = 404
			return
		else:
			creds = Cookie.decryptCookie(cookie)
			if (creds.get('role') == '2') or (creds.get('role') == '1'):
				return render('/tools/masterCustList.mako')
			else:
				response.status_int = 404
				return
Esempio n. 12
0
 def masterCustList(self):
     #look at cookie
     cookie = request.cookies.get("GFB_Cookie")
     if (cookie == None):
         response.status_int = 404
         return
     else:
         creds = Cookie.decryptCookie(cookie)
         if (creds.get('role') == '2') or (creds.get('role') == '1'):
             return render('/tools/masterCustList.mako')
         else:
             response.status_int = 404
             return
Esempio n. 13
0
    def manageAccounts(self):
        cookie = request.cookies.get("GFB_Cookie")
        if (cookie == None):
            response.status_int = 404
            return
        else:
            creds = Cookie.decryptCookie(cookie)

            if (creds.get('role') == '2') or (creds.get('role') == '1'):
                return render('/tools/manageAccounts.mako')
            else:
                response.status_int = 404
                return
Esempio n. 14
0
 def manageHS(self):
     cookie = request.cookies.get("GFB_Cookie")
     if (cookie == None):
         response.status_int = 404
         return
     else:
         creds = Cookie.decryptCookie(cookie)
         if (creds.get('role') == '3' or creds.get('role') == '2'
                 or creds.get('role') == '1'):
             return render("/tools/manageHS.mako")
         else:
             response.status_int = 404
             return
Esempio n. 15
0
 def donors(self):
     cookie = request.cookies.get("GFB_Cookie")
     if cookie == None:
         response.status_int = 404
         return
     else:
         creds = Cookie.decryptCookie(cookie)
         if creds.get("role") == "1" or creds.get("role") == "2":
             db = DB()
             donorList = db.getDonationOrders()
             return Sale.toTableDonations(donorList)
         else:
             response.status_int = 404
             return
Esempio n. 16
0
 def customers(self):
     cookie = request.cookies.get("GFB_Cookie")
     if cookie == None:
         response.status_int = 404
         return
     else:
         creds = Cookie.decryptCookie(cookie)
         if (creds.get("role") == "2") or (creds.get("role") == "1"):
             db = DB()
             customerList = db.getAllCustomers()
             return Sale.toTableMasterCustomerList(customerList)
         else:
             response.status_int = 404
             return
Esempio n. 17
0
 def donors(self):
     cookie = request.cookies.get("GFB_Cookie")
     if (cookie == None):
         response.status_int = 404
         return
     else:
         creds = Cookie.decryptCookie(cookie)
         if (creds.get('role') == '1' or creds.get('role') == '2'):
             db = DB()
             donorList = db.getDonationOrders()
             return Sale.toTableDonations(donorList)
         else:
             response.status_int = 404
             return
Esempio n. 18
0
 def customers(self):
     cookie = request.cookies.get("GFB_Cookie")
     if (cookie == None):
         response.status_int = 404
         return
     else:
         creds = Cookie.decryptCookie(cookie)
         if (creds.get('role') == '2') or (creds.get('role') == '1'):
             db = DB()
             customerList = db.getAllCustomers()
             return Sale.toTableMasterCustomerList(customerList)
         else:
             response.status_int = 404
             return
Esempio n. 19
0
	def distribution(self):
		#look at cookie
		cookie = request.cookies.get("GFB_Cookie")
		if(cookie == None):
			response.status_int = 404
			return
		else:
			
			creds = Cookie.decryptCookie(cookie)
			if ((creds.get('role') == '3') or (creds.get('role') == '2') or (creds.get('role') == '1')) :
				return render('/tools/distOrders.mako')
			else:
				response.status_int = 404
				return
Esempio n. 20
0
	def sales(self):
		#look at cookie
		cookie = request.cookies.get("FCS_GFB_Cookie")
		if(cookie == None):
			print "There is no cookie for user"
			# return None
			return "list of cash sales in JSONO format";
		else:
			creds = Cookie.decryptCookie(cookie)		
			if(creds.get('role') == '2') or (creds.get('role') == '1'):
				#This will need to be updated when the front end knows what parms its using
				if (request.method == "GET"):
					order_list = None

					hostSiteID = request.params['hostSiteID']
					beginDate = request.parms['beginDate']
					endDate = request.parms['endDate']
					paid = request.parms['paid']#may need to change this
					cancel = request.parms['cancel']
					
					if cancel == True:
						#order_list = db.etAllCanceledOrdersByDistributionDate(beginDate,endDate)
						pass
					elif hostSiteID == None:
						if paid == True:
							# order_list = db.getAllPaidOrdersByDistributionDate(beginDate,endDate)
							pass
						elif paid == False:
							#order_list = db.getAllUnpaidOrdersByDistributionDate(beginDate, endDate)
							pass
						else:
							#order_list = db.getAllOrdersByDistributionDate(beginDate, endDate)
							pass
					else:
						if paid == True:
							# order_list = db.getPaidOrdersByDistributionDate(hostSiteID, beginDate, endDate)
							pass
						elif paid == False:
							#order_list = db.getUnpaidOrdersByDistributionDate(hostSiteID, beginDate, endDate)
							pass
						else:
							#order_list = db.getOrderByDistributionDate(hostSiteID, beginDate, endDate)
							pass

					#return json.dumps(order_list)
					return "order_list in json format"
		
			else:
				return None
Esempio n. 21
0
    def sales(self):
        #look at cookie
        cookie = request.cookies.get("FCS_GFB_Cookie")
        if (cookie == None):
            print "There is no cookie for user"
            # return None
            return "list of cash sales in JSONO format"
        else:
            creds = Cookie.decryptCookie(cookie)
            if (creds.get('role') == '2') or (creds.get('role') == '1'):
                #This will need to be updated when the front end knows what parms its using
                if (request.method == "GET"):
                    order_list = None

                    hostSiteID = request.params['hostSiteID']
                    beginDate = request.parms['beginDate']
                    endDate = request.parms['endDate']
                    paid = request.parms['paid']  #may need to change this
                    cancel = request.parms['cancel']

                    if cancel == True:
                        #order_list = db.etAllCanceledOrdersByDistributionDate(beginDate,endDate)
                        pass
                    elif hostSiteID == None:
                        if paid == True:
                            # order_list = db.getAllPaidOrdersByDistributionDate(beginDate,endDate)
                            pass
                        elif paid == False:
                            #order_list = db.getAllUnpaidOrdersByDistributionDate(beginDate, endDate)
                            pass
                        else:
                            #order_list = db.getAllOrdersByDistributionDate(beginDate, endDate)
                            pass
                    else:
                        if paid == True:
                            # order_list = db.getPaidOrdersByDistributionDate(hostSiteID, beginDate, endDate)
                            pass
                        elif paid == False:
                            #order_list = db.getUnpaidOrdersByDistributionDate(hostSiteID, beginDate, endDate)
                            pass
                        else:
                            #order_list = db.getOrderByDistributionDate(hostSiteID, beginDate, endDate)
                            pass

                    #return json.dumps(order_list)
                    return "order_list in json format"

            else:
                return None
Esempio n. 22
0
    def distribution(self):
        #look at cookie
        cookie = request.cookies.get("GFB_Cookie")
        if (cookie == None):
            response.status_int = 404
            return
        else:

            creds = Cookie.decryptCookie(cookie)
            if ((creds.get('role') == '3') or (creds.get('role') == '2')
                    or (creds.get('role') == '1')):
                return render('/tools/distOrders.mako')
            else:
                response.status_int = 404
                return
Esempio n. 23
0
	def donors(self):
		#look at cookie
		cookie = request.cookies.get("FCS_GFB_Cookie")
		if(cookie == None):
			print "There is no cookie for user"
			# return None
			return "list of donors in JSON format";
		else:
			#analyze the cookie
			creds = Cookie.decryptCookie(cookie)
			if(creds.get('role') == '2'):
				return None
			elif (creds.get('role') == '1'):
				return "list of donors in JSON format";
			else:
				return None
Esempio n. 24
0
 def donors(self):
     #look at cookie
     cookie = request.cookies.get("FCS_GFB_Cookie")
     if (cookie == None):
         print "There is no cookie for user"
         # return None
         return "list of donors in JSON format"
     else:
         #analyze the cookie
         creds = Cookie.decryptCookie(cookie)
         if (creds.get('role') == '2'):
             return None
         elif (creds.get('role') == '1'):
             return "list of donors in JSON format"
         else:
             return None
Esempio n. 25
0
	def customers(self):
		#look at cookie
		cookie = request.cookies.get("FCS_GFB_Cookie")
		if(cookie == None):
			print "There is no cookie for user"
			# return None
			return "customer list in JSON format"
		else:
			#List is based on C or A status
			creds = Cookie.decryptCookie(cookie)	
			if(creds.get('role') == '2') or (creds.get('role') == '1'):

				customer_list = None
				#\this is a weird one. You need to get an order and filter out the customer

				return "customer list in JSON format"
			else:
				return None
Esempio n. 26
0
    def customers(self):
        #look at cookie
        cookie = request.cookies.get("FCS_GFB_Cookie")
        if (cookie == None):
            print "There is no cookie for user"
            # return None
            return "customer list in JSON format"
        else:
            #List is based on C or A status
            creds = Cookie.decryptCookie(cookie)
            if (creds.get('role') == '2') or (creds.get('role') == '1'):

                customer_list = None
                #\this is a weird one. You need to get an order and filter out the customer

                return "customer list in JSON format"
            else:
                return None