package controllers import ( "github.com/astaxie/beego" "wb/cc" "wb/lg" "wb/st" "wb/om" "wb/ii" "wb/ut" "wb/ctrl/uibuilder" "strings" "eps/models/etc" "wb/cfg" "eps/models/statusMgr" ) type ViewController struct { beego.Controller } func (this *ViewController)UiView(){ sn := strings.TrimSpace(this.GetString(cc.Col.Sn)) itemName := statusMgr.GetItemBySid(sn) oItemInfo, c:= ii.GetItemInfoByName(itemName) if sn == "" { lg.Error("ui.UiView", st.ParamSnIsNone) this.Ctx.WriteString(st.ParamSnIsNone) return } params := om.Params{etc.Sid: sn} c, oldValueMap := om.Table(itemName).Get(params) statusUrl := "/" +itemName + "/status?sn=" + sn this.Data["ItemName"] = itemName this.Data["StatusUrl"] = statusUrl showCate := strings.TrimSpace(this.GetString("cate")) if c == "success" { this.Data["Sn"] = ut.Maps.GetString(oldValueMap, cc.Col.Sn) this.Data["Sid"] = ut.Maps.GetString(oldValueMap, "sid") oldValueMap = oItemInfo.FormatMObject(oldValueMap) this.Data["ViewPanels"] = uibuilder.BuildViewPanelFromItemInfo(oItemInfo, oldValueMap, showCate) customTpl := cfg.WebConfig.ViewsPath + "/" + oItemInfo.Name + "/" + "view.tpl" if ut.IsPathExist(customTpl){ this.TplName = oItemInfo.Name + "/" + "view.tpl" }else{ this.TplName = "item/view.tpl" } } else { this.Ctx.WriteString(st.ItemNotFound) } }