Exemplo n.º 1
0
func (this *NArticleController) Edit() {
	id, err := this.GetInt("id")
	if err != nil {
		this.Ctx.WriteString("get param id fail")
		return
	}

	b := blog.NOneById(int64(id))
	if b == nil {
		this.Ctx.WriteString("no such article")
		return
	}
	if this.UserName != b.Creator && !this.IsAdmin {
		this.Ctx.WriteString("you are not author or admin")
		return
	}
	this.Data["Content"] = blog.NReadBlogContent(b).Content
	this.Data["Blog"] = b
	tmp := catalog.NAll()
	this.Data["Catalogs"] = tmp
	p := ""
	for _, v := range tmp {
		if b.CatalogId == v.Id {
			p = v.Ident
		}
	}
	if p != "" {
		this.Data["RedirectPath"] = "/newemployee/catalog/" + p
	} else {
		this.Data["RedirectPath"] = "/newemployee"
	}
	this.Data["ReturnPath"] = this.Data["RedirectPath"]
	this.Layout = "main_newemployee/layout/admin.html"
	this.TplNames = "main_newemployee/article/edit.html"
}
Exemplo n.º 2
0
func (this *CommunicateController) Get() {
	this.Data["Catalogs"] = catalog.NAll()
	this.Data["PageTitle"] = "新员工培养"
	this.Data["Addblog"] = ""
	this.Layout = "main_newemployee/layout/default.html"
	this.TplNames = "main_newemployee/index.html"
}
Exemplo n.º 3
0
func (this *NArticleController) Add() {
	cident := this.GetString("cident")
	if cident != "" {
		this.Data["RedirectPath"] = "/newemployee/catalog/" + cident
	} else {
		this.Data["RedirectPath"] = "/newemployee"
	}
	this.Data["ReturnPath"] = this.Data["RedirectPath"]
	this.Data["Catalogs"] = catalog.NAll()
	this.Data["IsPost"] = true
	this.Layout = "main_newemployee/layout/admin.html"
	this.TplNames = "main_newemployee/article/add.html"
	this.JsStorage("deleteKey", "post/new")
}