Beispiel #1
0
//列出所有的比赛 url:/admin/contest/list/type/<contest,exercise>
func (this *ContestController) List(w http.ResponseWriter, r *http.Request) {
	class.Logger.Debug("Contest List")
	this.Init(w, r)

	args := this.ParseURL(r.URL.String())
	Type := args["type"]

	qry := make(map[string]string)
	qry["type"] = Type
	contestModel := model.ContestModel{}
	contestList, err := contestModel.List(args)
	if err != nil {
		http.Error(w, err.Error(), 400)
	}

	this.Data["Contest"] = contestList
	this.Data["Title"] = "Admin - " + strings.Title(Type) + " List"
	this.Data["Is"+strings.Title(Type)] = true
	this.Data["IsList"] = true
	err = this.Execute(w, "view/admin/layout.tpl", "view/admin/contest_list.tpl")
	if err != nil {
		http.Error(w, "tpl error", 500)
		return
	}

}
Beispiel #2
0
func (this *ContestController) List(w http.ResponseWriter, r *http.Request) {
	class.Logger.Debug("Contest List")
	this.Init(w, r)

	args := this.ParseURL(r.URL.String())

	Type := args["type"]
	CModel := model.ContestModel{}
	conetestList, err := CModel.List(args)
	if err != nil {
		http.Error(w, err.Error(), 500)
		return
	}

	this.Data["Contest"] = conetestList
	this.Data["Time"] = this.GetTime()
	this.Data["Type"] = Type
	this.Data["Title"] = strings.Title(Type) + " List"
	this.Data["Is"+strings.Title(Type)] = true
	this.Data["Privilege"] = this.Privilege
	err = this.Execute(w, "view/layout.tpl", "view/contest_list.tpl")
	if err != nil {
		class.Logger.Debug(err)
		http.Error(w, "tpl error", 500)
		return
	}
}
Beispiel #3
0
//列出所有的比赛
//@URL: /admin/contests/ @method:GET
func (cc *AdminContest) List() {
	restweb.Logger.Debug("Contest List")

	qry := make(map[string]string)
	contestModel := model.ContestModel{}
	contestList, err := contestModel.List(qry)
	if err != nil {
		cc.Error(err.Error(), 400)
	}

	cc.Output["Contest"] = contestList
	cc.Output["Title"] = "Admin - Contest List"
	cc.Output["IsContest"] = true
	cc.Output["IsList"] = true
	cc.RenderTemplate("view/admin/layout.tpl", "view/admin/contest_list.tpl")
}
Beispiel #4
0
//@URL: /contests @method: GET
func (c *ContestController) Index() {
	restweb.Logger.Debug("Contest List")

	CModel := model.ContestModel{}
	conetestList, err := CModel.List(nil)
	if err != nil {
		c.Error(err.Error(), 500)
		return
	}

	c.Output["Contest"] = conetestList
	c.Output["Time"] = restweb.GetTime()
	c.Output["Title"] = "Contest List"
	c.Output["IsContest"] = true
	c.Output["Privilege"] = c.Privilege
	c.RenderTemplate("view/layout.tpl", "view/contest_list.tpl")
}