You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1KB

  1. package main
  2. import (
  3. "fmt"
  4. "html/template"
  5. "io/ioutil"
  6. "log"
  7. "net/http"
  8. )
  9. func spaEditMeetingHandler(w http.ResponseWriter, r *http.Request) {
  10. //fmt.Fprintf(w, "ok meeting handled")
  11. e, err := crmGetEntity("Meeting", "595d064a6e372fc1f")
  12. log.Println(err)
  13. meeting, ok := e.(crmdMeeting)
  14. log.Println(ok)
  15. spaEditMeetingPopulateMeetingInfo(w, meeting)
  16. }
  17. func spaEditMeetingPopulateMeetingInfo(w http.ResponseWriter, meeting crmdMeeting) {
  18. tTest := template.New("spaEditMeeting")
  19. str, err := ioutil.ReadFile("spa/editmeeting.html")
  20. if err != nil {
  21. w.WriteHeader(http.StatusInternalServerError)
  22. fmt.Fprintf(w, "Formating information not available.")
  23. return
  24. }
  25. tTest, err = tTest.Parse(string(str))
  26. if err != nil {
  27. w.WriteHeader(http.StatusInternalServerError)
  28. fmt.Fprintf(w, "Formating instruction invalid")
  29. return
  30. }
  31. err = tTest.Execute(w, meeting)
  32. if err != nil {
  33. w.WriteHeader(http.StatusInternalServerError)
  34. fmt.Fprintf(w, "Monkey runs into our computer room...")
  35. log.Println("ERROR: Template execution on spa/Edit, failed \n" + err.Error())
  36. }
  37. }