예제 #1
0
파일: file.go 프로젝트: Laller/nocrud
func (c *C) Init(ctx iface.Context) {
	c.Basics.Hooks = ctx.Conducting().Hooks()
	c.Basics.Db = ctx.Db()
	c.fileSys = ctx.FileSys()
	c.opt = ctx.Options().Document().All().(map[string]interface{})
	c.fileBiz = map[string][]iface.ReadableFile{}
}
예제 #2
0
파일: meeting.go 프로젝트: crufter/nocrud
func (e *Entries) Init(ctx iface.Context) {
	e.db = ctx.Db()
	e.userId = ctx.User().Id()
	e.userIsProfessional = isProfessional(ctx.User())
	e.optDoc = ctx.Options().Document()
	e.timeTableColl = "timeTables"
	e.intervalColl = "intervals"
}
예제 #3
0
파일: meeting.go 프로젝트: crufter/nocrud
func (tt *TimeTable) Init(ctx iface.Context) {
	tt.db = ctx.Db()
	tt.userId = ctx.User().Id()
	tt.userIsProfessional = isProfessional(ctx.User())
	tt.optDoc = ctx.Options().Document()
	tt.timeTableColl = "timeTables"
	tt.intervalColl = "intervals"
}
예제 #4
0
파일: builtins.go 프로젝트: Laller/nocrud
func getList(ctx iface.Context, noun string, params ...interface{}) []interface{} {
	nouns, ok := ctx.Options().Document().GetM("nouns")
	if !ok {
		panic("Can't find nouns.")
	}
	inp := convert.ListToMap(params...)
	hl, err := highlev.New(ctx.Conducting().Hooks(), "/"+noun, nouns, inp)
	if err != nil {
		panic(err)
	}
	deflev_i, _ := ctx.Options().Document().Get("default_level")
	deflev, _ := numcon.Int(deflev_i)
	ret, err := hl.Run(ctx.Db(), ctx.User(), deflev)
	if err != nil {
		panic(err)
	}
	return ret
}
예제 #5
0
파일: builtins.go 프로젝트: crufter/nocrud
// Works from Get or GetSingle only.
func getSub(ctx iface.Context, noun string, params ...interface{}) []interface{} {
	nouns, ok := ctx.Options().Document().GetM("nouns")
	if !ok {
		panic("Can't find nouns.")
	}
	np := ctx.NonPortable()
	hl, err := highlev.New(ctx.Conducting().Hooks(), np.Resource(), nouns, np.Params())
	if err != nil {
		panic(err)
	}
	inp := convert.ListToMap(params...)
	subhl, err := hl.Sub(noun, inp)
	if err != nil {
		panic(err)
	}
	deflev_i, _ := ctx.Options().Document().Get("defaultLevel")
	deflev, _ := numcon.Int(deflev_i)
	ret, err := subhl.Run(ctx.Db(), ctx.User(), deflev)
	if err != nil {
		panic(err)
	}
	return ret
}
예제 #6
0
파일: skeleton.go 프로젝트: crufter/nocrud
func (c *C) Init(ctx iface.Context) {
	c.Basics.Hooks = ctx.Conducting().Hooks()
	c.Basics.Db = ctx.Db()
	c.opt = ctx.Options().Document().All().(map[string]interface{})
}
예제 #7
0
파일: users.go 프로젝트: crufter/nocrud
func (c *C) Init(ctx iface.Context) {
	c.client = ctx.Client()
	c.db = ctx.Db()
}
예제 #8
0
파일: jsonedit.go 프로젝트: crufter/nocrud
func (c *C) Init(ctx iface.Context) {
	c.Basics.Hooks = ctx.Conducting().Hooks()
	c.Basics.Db = ctx.Db()
}