ictgj-voting/admin_games.go

33 lines
655 B
Go
Raw Normal View History

2017-06-08 17:20:43 +00:00
package main
2017-06-08 20:43:11 +00:00
import (
"net/http"
"strings"
"github.com/gorilla/mux"
)
2017-06-08 17:20:43 +00:00
func handleAdminGames(w http.ResponseWriter, req *http.Request, page *pageData) {
2017-06-08 20:43:11 +00:00
vars := mux.Vars(req)
page.SubTitle = "Games"
gameId := vars["id"]
teamId := req.FormValue("teamid")
if strings.TrimSpace(teamId) != "" {
page.session.setStringValue("teamid", teamId)
page.TeamID = teamId
}
if gameId == "new" {
switch vars["function"] {
case "save":
name := req.FormValue("gamename")
if dbIsValidTeam(teamId) {
if dbEditTeamGame(teamId, name) != nil {
}
}
default:
page.SubTitle = "Add New Game"
page.show("admin-addgame.html", w)
}
}
2017-06-08 17:20:43 +00:00
}