示例#1
0
文件: main.go 项目: Laller/hypecms
// All front hooks must have the signature of func(*context.Uni, *bool) error
// All views are going to use this hook.
func execFrontViews(uni *context.Uni) {
	var err error
	i := func(hijacked bool, er error) bool {
		if er != nil {
			err = er
			return true
		}
		return hijacked
	}
	uni.Ev.Iterate("Front", i)
	if err == nil {
		display.D(uni)
	} else {
		display.DErr(uni, err)
	}
}
示例#2
0
文件: main.go 项目: Laller/hypecms
func execAdmin(uni *context.Uni) {
	l := len(uni.Paths)
	var err error
	if l > 2 && uni.Paths[2] == "b" {
		var action_name string
		if l > 3 {
			action_name = uni.Paths[3]
			uni.Dat["_action"] = action_name
			err = admin.AB(uni, action_name)
		} else {
			err = fmt.Errorf(no_admin_action)
		}
		actionResponse(uni, err, action_name)
	} else {
		err = admin.AD(uni)
		if err == nil {
			display.D(uni)
		} else {
			display.DErr(uni, err)
		}
	}
}
示例#3
0
文件: main.go 项目: Laller/hypecms
func terminal(uni *context.Uni) {
	shell.Terminal(uni)
	display.D(uni)
}