mirror of
https://shylinux.com/x/education
synced 2025-04-25 10:08:05 +08:00
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package jiaowuxitong
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
kit "shylinux.com/x/toolkits"
|
|
|
|
"shylinux.com/x/community/src/gonganxitong"
|
|
"shylinux.com/x/education/src/jiaowuxitong/model"
|
|
)
|
|
|
|
type Table struct {
|
|
gonganxitong.Table
|
|
list string `name:"list class_uid uid auto" role:"void"`
|
|
}
|
|
|
|
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
|
switch arg[0] {
|
|
case model.CLASS_TYPE:
|
|
for k, v := range ClassTypeList {
|
|
m.Push(arg[0], k).Push(model.NAME, v)
|
|
}
|
|
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
|
|
case model.USER_CLASS_ROLE:
|
|
for k, v := range UserClassRoleList {
|
|
if k != UserClassCreator && k != UserClassVisitor {
|
|
m.Push(arg[0], k).Push(model.NAME, v)
|
|
}
|
|
}
|
|
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
|
|
default:
|
|
s.Table.Inputs(m, arg...)
|
|
}
|
|
}
|
|
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
|
m.RewriteAppend(func(value, key string, index int) string {
|
|
kit.If(key == model.CLASS_TYPE, func() { value = ClassType(kit.Int(value)).String() })
|
|
kit.If(key == model.USER_CLASS_ROLE, func() { value = UserClassRole(kit.Int(value)).String() })
|
|
return value
|
|
})
|
|
s.Table.RewriteAppend(m)
|
|
return m
|
|
}
|