mirror of
https://shylinux.com/x/icebergs
synced 2025-05-06 13:17:03 +08:00
opt draw.js
This commit is contained in:
parent
6ed14de57c
commit
7d388597eb
@ -86,13 +86,13 @@ func UserLogin(m *ice.Message, username, password string) bool {
|
||||
}
|
||||
|
||||
const (
|
||||
BACKGROUND = "background"
|
||||
|
||||
AVATAR = "avatar"
|
||||
GENDER = "gender"
|
||||
MOBILE = "mobile"
|
||||
EMAIL = "email"
|
||||
|
||||
BACKGROUND = "background"
|
||||
|
||||
CITY = "city"
|
||||
COUNTRY = "country"
|
||||
LANGUAGE = "language"
|
||||
|
@ -144,6 +144,7 @@ const (
|
||||
GO = ice.GO
|
||||
SH = ice.SH
|
||||
SHY = ice.SHY
|
||||
SVG = ice.SVG
|
||||
CSV = ice.CSV
|
||||
JSON = ice.JSON
|
||||
|
||||
@ -153,7 +154,6 @@ const (
|
||||
XML = "xml"
|
||||
YML = "yml"
|
||||
ZML = "zml"
|
||||
SVG = "svg"
|
||||
|
||||
PWD = "./"
|
||||
)
|
||||
|
1
conf.go
1
conf.go
@ -91,6 +91,7 @@ const ( // DIR
|
||||
JS = "js"
|
||||
GO = "go"
|
||||
SH = "sh"
|
||||
SVG = "svg"
|
||||
CSV = "csv"
|
||||
JSON = "json"
|
||||
|
||||
|
@ -31,16 +31,6 @@ func _header_check(m *ice.Message, arg ...string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
func _header_grant(m *ice.Message, arg ...string) {
|
||||
m.Cmd(GRANT, mdb.INSERT, kit.SimpleKV("space,grant,userrole,username",
|
||||
m.Option(ice.POD), m.Option(web.SPACE), m.Option(ice.MSG_USERROLE), m.Option(ice.MSG_USERNAME)))
|
||||
if m.PodCmd(m.PrefixKey(), ctx.ACTION, GRANT, arg) {
|
||||
return // 下发命令
|
||||
}
|
||||
|
||||
// 授权登录
|
||||
m.Cmd(web.SPACE, m.Option(web.SPACE), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
|
||||
}
|
||||
func _header_share(m *ice.Message, arg ...string) {
|
||||
if m.Option(mdb.LINK) == "" {
|
||||
m.Cmdy(web.SHARE, mdb.CREATE, mdb.TYPE, web.LOGIN, arg)
|
||||
@ -74,15 +64,14 @@ func init() {
|
||||
}, Commands: map[string]*ice.Command{
|
||||
web.WEB_LOGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case "/sso":
|
||||
return
|
||||
case "/pod/", "/cmd/":
|
||||
return // 免登录
|
||||
case "/header":
|
||||
switch kit.Select("", arg, 1) {
|
||||
case "":
|
||||
if kit.Select("", arg, 1) == "" {
|
||||
return // 免登录
|
||||
}
|
||||
case "/pod/", "/cmd/":
|
||||
return // 免登录
|
||||
case "/sso":
|
||||
return // 免登录
|
||||
}
|
||||
m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg)
|
||||
}},
|
||||
@ -93,13 +82,9 @@ func init() {
|
||||
CHECK: {Name: "check", Help: "登录检查", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_check(m, arg...)
|
||||
}},
|
||||
GRANT: {Name: "grant space", Help: "授权", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_grant(m, arg...)
|
||||
}},
|
||||
SHARE: {Name: "share type", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_share(m, arg...)
|
||||
}},
|
||||
|
||||
aaa.LOGIN: {Name: "login", Help: "密码登录", Hand: func(m *ice.Message, arg ...string) {
|
||||
if aaa.UserLogin(m, arg[0], arg[1]) {
|
||||
web.RenderCookie(m, aaa.SessCreate(m, arg[0]))
|
||||
@ -108,30 +93,24 @@ func init() {
|
||||
aaa.LOGOUT: {Name: "logout", Help: "退出登录", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(aaa.SESS, mdb.REMOVE, kit.Dict(mdb.HASH, m.Option(ice.MSG_SESSID)))
|
||||
}},
|
||||
aaa.USERNICK: {Name: "usernick", Help: "用户昵称", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_users(m, m.ActionKey(), arg...)
|
||||
}},
|
||||
aaa.PASSWORD: {Name: "password", Help: "修改密码", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_users(m, m.ActionKey(), arg...)
|
||||
}},
|
||||
aaa.LANGUAGE: {Name: "language", Help: "语言地区", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_users(m, m.ActionKey(), arg...)
|
||||
}},
|
||||
aaa.BACKGROUND: {Name: "background", Help: "用户壁纸", Hand: func(m *ice.Message, arg ...string) {
|
||||
aaa.USERNICK: {Name: "usernick", Help: "用户昵称", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_users(m, m.ActionKey(), arg...)
|
||||
}},
|
||||
aaa.AVATAR: {Name: "avatar", Help: "用户头像", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_users(m, m.ActionKey(), arg...)
|
||||
}},
|
||||
|
||||
aaa.BACKGROUND: {Name: "background", Help: "用户壁纸", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_users(m, m.ActionKey(), arg...)
|
||||
}},
|
||||
aaa.LANGUAGE: {Name: "language", Help: "语言地区", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_users(m, m.ActionKey(), arg...)
|
||||
}},
|
||||
ctx.CONFIG: {Name: "config scope", Help: "拉取配置", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(web.SPACE, m.Option(ice.MSG_USERPOD), m.Prefix("oauth.oauth"), CHECK, arg)
|
||||
}},
|
||||
code.PUBLISH: {Name: "publish", Help: "发布", Hand: func(m *ice.Message, arg ...string) {
|
||||
if !m.PodCmd(code.PUBLISH, ice.CONTEXTS) {
|
||||
m.Cmdy(code.PUBLISH, ice.CONTEXTS)
|
||||
}
|
||||
}},
|
||||
code.WEBPACK: {Name: "webpack", Help: "打包页面", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.WEBPACK, cli.BUILD, m.OptionSimple(mdb.NAME))
|
||||
}},
|
||||
@ -142,29 +121,20 @@ func init() {
|
||||
_header_agent(m, arg...)
|
||||
|
||||
msg := m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME))
|
||||
for _, k := range []string{aaa.LANGUAGE, aaa.BACKGROUND, aaa.AVATAR, aaa.USERNICK} {
|
||||
for _, k := range []string{aaa.USERNICK, aaa.LANGUAGE} {
|
||||
m.Option(k, msg.Append(k))
|
||||
}
|
||||
for _, k := range []string{aaa.AVATAR, aaa.BACKGROUND} {
|
||||
m.Option(k, kit.Select(web.SHARE_LOCAL+k, kit.Select("void", msg.Append(k)), m.Right(msg.Append(k))))
|
||||
}
|
||||
if m.Option(aaa.AVATAR) == "" && m.R.Header.Get("Staffname") != "" {
|
||||
m.Option(aaa.AVATAR, kit.Format("https://dayu.oa.com/avatars/%s/profile.jpg", m.R.Header.Get("Staffname")))
|
||||
}
|
||||
|
||||
if m.Option(GRANT) != "" {
|
||||
if m.Cmd(GRANT, m.Option(ice.POD), 1).Length() > 0 {
|
||||
_header_grant(m, web.SPACE, m.Option(GRANT))
|
||||
}
|
||||
m.Option(GRANT, ice.TRUE)
|
||||
}
|
||||
|
||||
m.Option(TRANS, kit.Format(kit.Value(m.Target().Commands[web.P(m.CommandKey())].Meta, "_trans")))
|
||||
m.Option(MENUS, m.Config(MENUS))
|
||||
m.Echo(m.Config(TITLE))
|
||||
// m.Cmdy(WEBSITE)
|
||||
}},
|
||||
HEADER: {Name: "header", Help: "标题栏", Action: map[string]*ice.Action{
|
||||
GRANT: {Name: "grant space", Help: "授权", Hand: func(m *ice.Message, arg ...string) {
|
||||
_header_grant(m, arg...)
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, arg ...string) {}},
|
||||
}})
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ func init() {
|
||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
||||
DRAW: {Name: DRAW, Help: "思维导图", Value: kit.Data(lex.REGEXP, ".*\\.svg")},
|
||||
}, Commands: map[string]*ice.Command{
|
||||
DRAW: {Name: "draw path=src/main.svg pid refresh:button=auto edit save actions", Help: "思维导图", Meta: kit.Dict(ice.DisplayLocal("")), Action: ice.MergeAction(map[string]*ice.Action{
|
||||
DRAW: {Name: "draw path=src/main.svg pid refresh:button=auto save edit actions", Help: "思维导图", Meta: kit.Dict(ice.DisplayLocal("")), Action: ice.MergeAction(map[string]*ice.Action{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, mdb.TYPE, "svg", mdb.NAME, m.PrefixKey())
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, mdb.TYPE, nfs.SVG, mdb.NAME, m.PrefixKey())
|
||||
}},
|
||||
mdb.RENDER: {Name: "render", Help: "渲染", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo("<html><body>")
|
||||
@ -27,7 +27,7 @@ func init() {
|
||||
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
|
||||
}},
|
||||
nfs.SAVE: {Name: "save", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
||||
_wiki_save(m, DRAW, arg[0], m.Option("content"))
|
||||
_wiki_save(m, DRAW, arg[0], m.Option(nfs.CONTENT))
|
||||
}},
|
||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if !_wiki_list(m, DRAW, kit.Select(nfs.PWD, arg, 0)) {
|
||||
|
@ -1,12 +1,10 @@
|
||||
package wiki
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/lex"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
@ -18,14 +16,12 @@ func init() {
|
||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
||||
FEEL: {Name: FEEL, Help: "影音媒体", Value: kit.Data(nfs.PATH, ice.USR_LOCAL_IMAGE, lex.REGEXP, ".*.(png|PNG|jpg|JPG|jpeg|mp4|m4v|MOV)")},
|
||||
}, Commands: map[string]*ice.Command{
|
||||
FEEL: {Name: "feel path auto upload 上一页 下一页 actions", Help: "影音媒体", Meta: kit.Dict(ice.DisplayLocal("")), Action: map[string]*ice.Action{
|
||||
FEEL: {Name: "feel path auto upload prev next actions", Help: "影音媒体", Meta: kit.Dict(ice.DisplayLocal("")), Action: map[string]*ice.Action{
|
||||
web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
||||
_wiki_upload(m, m.CommandKey(), m.Option(nfs.PATH))
|
||||
}},
|
||||
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||
p := path.Join(m.Config(nfs.PATH), path.Join(arg...))
|
||||
m.Debug("remove %v", p)
|
||||
os.Remove(p)
|
||||
nfs.TRASH: {Name: "trash", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(nfs.TRASH, path.Join(m.Config(nfs.PATH), path.Join(arg...)))
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, arg ...string) {
|
||||
_wiki_list(m, m.CommandKey(), kit.Select(nfs.PWD, arg, 0))
|
||||
|
1
misc.go
1
misc.go
@ -320,7 +320,6 @@ func SplitCmd(name string) (list []Any) {
|
||||
item, button := kit.Dict(), false
|
||||
ls := kit.Split(name, SP, ":=@")
|
||||
for i := 1; i < len(ls); i++ {
|
||||
Pulse.Debug("what %v %v", ls[i], kit.Formats(item))
|
||||
switch ls[i] {
|
||||
case RUN:
|
||||
list = append(list, kit.Dict(TYPE, BUTTON, NAME, RUN))
|
||||
|
Loading…
x
Reference in New Issue
Block a user