package webcmd import ( "fmt" "log" "net/http" ) func (this *App) Serve_Homepage(w http.ResponseWriter) { w.Header().Set("Content-Type", "text/html;charset=UTF-8") w.WriteHeader(200) this.ServePartial_Header(w, "/") for i, t := range this.cfg.Commands { fmt.Fprint(w, `

`+hesc(t.Title)+`

`) for i, param := range t.Execution { switch param.ParamType { case PARAMTYPE_CONST: // not configurable parameter case PARAMTYPE_STRING: fmt.Fprintf(w, `
`, i, hesc(param.Description), hesc(param.Description), hesc(param.Value)) case PARAMTYPE_OPTIONAL: fmt.Fprintf(w, `
`, i, i, hesc(param.Description)) default: log.Fatalf("Unknown PARAMTYPE(%d)", param.ParamType) } } fmt.Fprint(w, `
`) } this.ServePartial_Footer(w) }