Exemple #1
0
func (self *NewNodeHandler) Get() {
	self.TplNames = "new_node.html"
	self.Layout = "layout.html"

	self.Data["categorys"] = models.GetAllCategory()
	self.Render()
}
Exemple #2
0
//用户等级划分:正数是普通用户,负数是管理员各种等级划分,为0则尚未注册
func (self *BaseHandler) Prepare() {
	sess_username, _ = self.GetSession("username").(string)
	sess_uid, _ = self.GetSession("userid").(int64)
	sess_role, _ = self.GetSession("userrole").(int64)
	sess_email, _ = self.GetSession("useremail").(string)

	if sess_role == 0 {
		self.Data["Userid"] = 0
		self.Data["Username"] = ""
		self.Data["Userrole"] = 0
		self.Data["Useremail"] = ""
	} else {
		self.Data["Userid"] = sess_uid
		self.Data["Username"] = sess_username
		self.Data["Userrole"] = sess_role
		self.Data["Useremail"] = sess_email
	}
	self.Data["categorys"] = models.GetAllCategory()
	self.Data["nodes"] = models.GetAllNode()
	self.Data["nodes_hotness_topbar"] = models.GetAllNodeByCid(0, 0, 16, 0, "hotness")
	self.Data["topics_5s"] = models.GetAllTopic(0, 5, "id")
	self.Data["topics_10s"] = models.GetAllTopic(0, 10, "id")
	self.Data["nodes_10s"] = models.GetAllNodeByCid(0, 0, 10, 0, "id")
	self.Data["replys_5s"] = models.GetReplyByPid(0, 0, 5, "id")
	self.Data["replys_10s"] = models.GetReplyByPid(0, 0, 10, "id")

	self.Data["author"] = models.GetKV("author")
	self.Data["title"] = models.GetKV("title")
	self.Data["title_en"] = models.GetKV("title_en")
	self.Data["keywords"] = models.GetKV("keywords")
	self.Data["description"] = models.GetKV("description")

	self.Data["company"] = models.GetKV("company")
	self.Data["copyright"] = models.GetKV("copyright")
	self.Data["site_email"] = models.GetKV("site_email")

	self.Data["tweibo"] = models.GetKV("tweibo")
	self.Data["sweibo"] = models.GetKV("sweibo")
	self.Data["timenow"] = time.Now()
	self.Data["statistics"] = models.GetKV("statistics")

}