hlfw.ca

webbing

Download patch

ref: 203ece8c2e6bc6cccd303473c30a31d74526976c
parent: f1dc6b7292bbe80feb1fe32506af60ea5b93a5ee
author: Michael Misch <michaelmisch1985@gmail.com>
date: Thu Nov 7 01:21:38 PST 2019

This will be replaced with a plugin lookup based on a map of key to plugin function, much like pages are ran now

--- a/router/forms.go
+++ b/router/forms.go
@@ -87,30 +87,31 @@
 			return nil, errs
 		}
 	}
-	if form.After&ValidateCountry != 0 {
-		c := r.PostFormValue("country")
-		if e = validateCountry(p.printer, c); e != "" {
-			errors = append(errors, e)
+	/*
+		if form.After&ValidateCountry != 0 {
+			c := r.PostFormValue("country")
+			if e = validateCountry(p.printer, c); e != "" {
+				errors = append(errors, e)
+			}
 		}
-	}
-	if form.After&ValidateSpecialty != 0 {
-		s := r.PostFormValue("specialty")
-		if e = validateSpecialty(p.printer, s); e != "" {
-			errors = append(errors, e)
+		if form.After&ValidateSpecialty != 0 {
+			s := r.PostFormValue("specialty")
+			if e = validateSpecialty(p.printer, s); e != "" {
+				errors = append(errors, e)
+			}
 		}
-	}
-	if form.After&ValidateCountries != 0 {
-		c := r.Form["country"]
-		if e = validateCountries(p.printer, c); e != "" {
-			errors = append(errors, e)
+		if form.After&ValidateCountries != 0 {
+			c := r.Form["country"]
+			if e = validateCountries(p.printer, c); e != "" {
+				errors = append(errors, e)
+			}
 		}
-	}
-	if form.After&ValidateSpecialties != 0 {
-		s := r.Form["specialty"]
-		if e = validateSpecialties(p.printer, s); e != "" {
-			errors = append(errors, e)
-		}
-	}
+		if form.After&ValidateSpecialties != 0 {
+			s := r.Form["specialty"]
+			if e = validateSpecialties(p.printer, s); e != "" {
+				errors = append(errors, e)
+			}
+		}*/
 	if form.After&SetPassword != 0 {
 		if errs = setPassword(p.printer, p.session, r); len(errs) > 0 {
 			errors = append(errors, errs...)
--- a/router/pages.go
+++ b/router/pages.go
@@ -17,7 +17,7 @@
 
 func init() {
 	pagecache = make(map[string]*Page)
-	countrylist = listcountries()
+	//countrylist = listcountries()
 }
 
 // Access defines the access rights for a specific page
@@ -100,41 +100,43 @@
 	i["header"] = header(p.printer, p.status)
 	i["footer"] = footer(p.printer)
 	i["basedir"] = getBaseDir(cache.Path)
-	if cache.Extra&ListDoctors != 0 {
-		i["doctors"] = listdoctors()
-	}
-	if cache.Extra&ListServices != 0 {
-		i["specialties"] = specialties(p.printer)
-	}
-	if cache.Extra&ListCountries != 0 {
-		i["countrylist"] = countrylist
-	}
-	if p.session != nil && cache.Extra&FormErrors != 0 {
-		i["errors"] = p.session.Get("errors")
-	}
-	if p.session != nil && cache.Extra&SessionToken != 0 {
-		// TODO(halfwit) once database is live
-		// session token is a temporary db entry
-		// keyed by token which returns the current session data at this point
-		// useful for things like offers while a patient fills out symptoms
-		//i["sessiontoken"] = db.SetData("offer", p.sessionsomething)
-	}
-	//if cache.Extra&ClientName != 0 {
-	//	i["firstname"] = db.ClientName(p.session)
-	//}
-	//if cache.Extra&ClientSurname != 0 {
-	//	i["surname"] = db.ClientSurname(p.session)
-	//}
-	//if cache.Extra&ClientUsername != 0 {
-	//	i["username"] = db.ClientUsername(p.session)
-	//}
-	if cache.Extra&FormErrors != 0 && p.session != nil {
-		i["errors"] = p.session.Get("errors")
-	}
-	if cache.Extra&FormToken != 0 {
-		// generate token and put it in the form!
-		i["token"] = newToken()
-	}
+	/*
+		if cache.Extra&ListDoctors != 0 {
+			i["doctors"] = listdoctors()
+		}
+		if cache.Extra&ListServices != 0 {
+			i["specialties"] = specialties(p.printer)
+		}
+		if cache.Extra&ListCountries != 0 {
+			i["countrylist"] = countrylist
+		}
+		if p.session != nil && cache.Extra&FormErrors != 0 {
+			i["errors"] = p.session.Get("errors")
+		}
+		if p.session != nil && cache.Extra&SessionToken != 0 {
+			// TODO(halfwit) once database is live
+			// session token is a temporary db entry
+			// keyed by token which returns the current session data at this point
+			// useful for things like offers while a patient fills out symptoms
+			//i["sessiontoken"] = db.SetData("offer", p.sessionsomething)
+		}
+		//if cache.Extra&ClientName != 0 {
+		//	i["firstname"] = db.ClientName(p.session)
+		//}
+		//if cache.Extra&ClientSurname != 0 {
+		//	i["surname"] = db.ClientSurname(p.session)
+		//}
+		//if cache.Extra&ClientUsername != 0 {
+		//	i["username"] = db.ClientUsername(p.session)
+		//}
+		if cache.Extra&FormErrors != 0 && p.session != nil {
+			i["errors"] = p.session.Get("errors")
+		}
+		if cache.Extra&FormToken != 0 {
+			// generate token and put it in the form!
+			i["token"] = newToken()
+		}
+	*/
 	if p.session != nil {
 		i["username"] = p.session.Get("username")
 	}