diff --git a/core/chat/chat.go b/core/chat/chat.go
index 1f3a3767..6c3be0c5 100644
--- a/core/chat/chat.go
+++ b/core/chat/chat.go
@@ -13,24 +13,30 @@ const CHAT = "chat"
var Index = &ice.Context{Name: CHAT, Help: "聊天中心",
Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
+ m.Cmd(web.SERVE, aaa.WHITE, HEADER, RIVER, ACTION, FOOTER)
m.Cmd(mdb.SEARCH, mdb.CREATE, P_SEARCH, m.Prefix(P_SEARCH))
m.Cmd(mdb.SEARCH, mdb.CREATE, EMAIL, m.Prefix(EMAIL))
+ m.Watch(web.SPACE_START, m.Prefix(NODE))
+ m.Watch(web.SPACE_STOP, m.Prefix(NODE))
m.Load()
- m.Cmd(web.SERVE, aaa.WHITE, "header", "river", "action", "footer")
- m.Conf(ACTION, "meta.domain.web.chat.meet.miss", "true")
- m.Conf(ACTION, "meta.domain.web.chat.meet.mate", "true")
- m.Conf(ACTION, "meta.domain.web.chat.location", "true")
- m.Conf(ACTION, "meta.domain.web.chat.paste", "true")
- m.Conf(ACTION, "meta.domain.web.chat.scan", "true")
- m.Conf(ACTION, "meta.domain.web.wiki.feel", "true")
- m.Conf(ACTION, "meta.domain.web.wiki.draw", "true")
- m.Conf(ACTION, "meta.domain.web.wiki.data", "true")
- m.Conf(ACTION, "meta.domain.web.wiki.word", "true")
- m.Conf(ACTION, "meta.domain.web.team.task", "true")
- m.Conf(ACTION, "meta.domain.web.team.plan", "true")
- m.Conf(ACTION, "meta.domain.web.mall.asset", "true")
- m.Conf(ACTION, "meta.domain.web.mall.salary", "true")
+ for _, cmd := range []string{
+ "web.chat.meet.miss",
+ "web.chat.meet.mate",
+ "web.chat.location",
+ "web.chat.paste",
+ "web.chat.scan",
+ "web.wiki.feel",
+ "web.wiki.draw",
+ "web.wiki.data",
+ "web.wiki.word",
+ "web.team.task",
+ "web.team.plan",
+ "web.mall.asset",
+ "web.mall.salary",
+ } {
+ m.Conf(ACTION, kit.Keym("domain", cmd), "true")
+ }
m.Conf(RIVER, "meta.template", kit.Dict(
"base", kit.Dict(
@@ -62,8 +68,6 @@ var Index = &ice.Context{Name: CHAT, Help: "聊天中心",
},
),
))
- m.Watch(web.SPACE_START, m.Prefix(NODE))
- m.Watch(web.SPACE_STOP, m.Prefix(NODE))
}},
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }},
},
@@ -72,6 +76,6 @@ var Index = &ice.Context{Name: CHAT, Help: "聊天中心",
func init() {
web.Index.Register(Index, &web.Frame{},
HEADER, RIVER, STORM, ACTION, FOOTER,
- LOCATION, PASTE, SCAN, FILES,
+ SCAN, PASTE, FILES, LOCATION,
)
}
diff --git a/core/chat/chat.shy b/core/chat/chat.shy
index 041f408a..0682d0f1 100644
--- a/core/chat/chat.shy
+++ b/core/chat/chat.shy
@@ -1,2 +1,19 @@
chapter "组织"
+chat.go
+chat.shy
+
+header.go
+search.go
+river.go
+action.go
+footer.go
+
+scan.go
+paste.go
+files.go
+location.go
+study.go
+email.go
+meet.go
+
diff --git a/core/chat/file.go b/core/chat/file.go
deleted file mode 100644
index 7fe505cd..00000000
--- a/core/chat/file.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package chat
-
-import (
- ice "github.com/shylinux/icebergs"
- "github.com/shylinux/icebergs/base/mdb"
- "github.com/shylinux/icebergs/base/web"
- kit "github.com/shylinux/toolkits"
-)
-
-const FILES = "files"
-
-func init() {
- Index.Merge(&ice.Context{
- Configs: map[string]*ice.Config{
- FILES: {Name: FILES, Help: "文件", Value: kit.Data(kit.MDB_SHORT, "data")},
- },
- Commands: map[string]*ice.Command{
- FILES: {Name: "files hash auto upload", Help: "扫码", Action: map[string]*ice.Action{
- web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
- up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
- m.Cmdy(mdb.INSERT, FILES, "", mdb.HASH, "data", up[0], kit.MDB_NAME, up[1])
- }},
- mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
- m.Cmdy(mdb.DELETE, FILES, "", mdb.HASH, kit.MDB_HASH, m.Option(kit.MDB_HASH))
- }},
- }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
- m.Option(mdb.FIELDS, kit.Select("time,hash,name,data", mdb.DETAIL, len(arg) > 0))
- m.Cmdy(mdb.SELECT, FILES, "", mdb.HASH, "hash", arg)
- m.Table(func(index int, value map[string]string, head []string) {
- m.PushDownload(value[kit.MDB_NAME], "/share/cache/"+value["data"])
- })
- if len(arg) == 0 {
- m.SortTimeR(kit.MDB_TIME)
- }
- m.PushAction(mdb.REMOVE)
- }},
- },
- })
-}
diff --git a/core/chat/header.go b/core/chat/header.go
index 34b64733..baf8ef9c 100644
--- a/core/chat/header.go
+++ b/core/chat/header.go
@@ -3,7 +3,9 @@ package chat
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/aaa"
+ "github.com/shylinux/icebergs/base/mdb"
"github.com/shylinux/icebergs/base/web"
+ "github.com/shylinux/icebergs/core/code"
kit "github.com/shylinux/toolkits"
)
@@ -11,6 +13,8 @@ const (
TITLE = "title"
LOGIN = "login"
CHECK = "check"
+
+ BACKGROUND = "background"
)
const HEADER = "header"
@@ -46,18 +50,17 @@ func init() {
aaa.USERROLE: {Name: "userrole", Help: "用户角色", Hand: func(m *ice.Message, arg ...string) {
m.Echo(aaa.UserRole(m, m.Option("who")))
}},
-
- "background": {Name: "background", Help: "背景图片", Hand: func(m *ice.Message, arg ...string) {
- m.Option("background", m.Conf(HEADER, "background", arg[0]))
+ BACKGROUND: {Name: "background", Help: "背景图片", Hand: func(m *ice.Message, arg ...string) {
+ m.Option(BACKGROUND, m.Conf(HEADER, BACKGROUND, arg[0]))
}},
- "pack": {Name: "pack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
- m.Cmdy("web.code.webpack", "create")
+ code.WEBPACK: {Name: "webpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
+ m.Cmdy(code.WEBPACK, mdb.CREATE)
}},
"wx": {Name: "wx", Help: "微信", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy("web.chat.wx.access", "config")
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
- m.Option("background", m.Conf(HEADER, "background"))
+ m.Option(BACKGROUND, m.Conf(HEADER, BACKGROUND))
m.Echo(m.Conf(HEADER, TITLE))
}},
},
diff --git a/core/wiki/draw.go b/core/wiki/draw.go
index d186c7e6..c75aa56e 100644
--- a/core/wiki/draw.go
+++ b/core/wiki/draw.go
@@ -17,7 +17,7 @@ func init() {
},
Commands: map[string]*ice.Command{
DRAW: {Name: "draw path=src/ file=main.svg 刷新:button=auto 编辑 save 项目 参数", Help: "思维导图", Meta: kit.Dict(
- "display", "/plugin/local/wiki/draw.js", "style", "drawer",
+ "display", "/plugin/local/wiki/draw.js",
), Action: map[string]*ice.Action{
nfs.SAVE: {Name: "save", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
_wiki_save(m, DRAW, path.Join(arg...), m.Option("content"))
diff --git a/core/wiki/template.go b/core/wiki/template.go
index 37facdb7..d931f2f9 100644
--- a/core/wiki/template.go
+++ b/core/wiki/template.go
@@ -9,18 +9,42 @@ var title = `<{{.Option "level"}} class="story"
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
data-type="{{.Option "type"}}"
>{{.Option "prefix"}} {{.Option "content"}}{{.Option "level"}}>`
-
var brief = `
{{.Option "text"}}
`
-
var refer = `
{{range $index, $value := .Optionv "list"}}- {{index $value 0}}: {{index $value 1}}
{{end}}
`
var spark = `{{.Option "text"}}
`
+var order = `
+{{range $index, $value := .Optionv "list"}}- {{$value}}
{{end}}
`
+var table = `
+{{range $i, $v := .Optionv "head"}}{{$v}} | {{end}}
+{{range $index, $value := .Optionv "list"}}
+{{range $i, $v := $value}}{{$v}} | {{end}}
+{{end}}
+
`
+var shell = `$ {{.Option "input"}} # {{.Option "name"}}
+{{.Option "output"}}
`
+var local = `{{range $index, $value := .Optionv "input"}}{{$value}}{{end}}
`
+
+var image = `
`
var chart = ``)},
IMAGE: {Name: IMAGE, Help: "图片", Value: kit.Data("template", image)},
+ CHART: {Name: CHART, Help: "图表", Value: kit.Data("template", chart, "suffix", ``)},
+ FIELD: {Name: FIELD, Help: "插件", Value: kit.Data("template", field)},
+ OTHER: {Name: FIELD, Help: "网页", Value: kit.Data("template", other)},
WORD: {Name: WORD, Help: "语言文字", Value: kit.Data(
kit.MDB_PATH, "", "regs", ".*\\.shy", "alias", map[string]interface{}{
@@ -359,11 +361,6 @@ func init() {
_title_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
BRIEF: {Name: "brief [name] text", Help: "摘要", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
- if len(arg) == 0 {
- m.Echo(`
`)
- return
- }
-
arg = _name(m, arg)
_brief_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
@@ -371,7 +368,7 @@ func init() {
arg = _name(m, arg)
_refer_show(m, arg[0], arg[1], arg[2:]...)
}},
- SPARK: {Name: "spark [name] text", Help: "灵感", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
+ SPARK: {Name: "spark [name] text", Help: "段落", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) == 0 {
m.Echo(`
`)
return
@@ -386,11 +383,6 @@ func init() {
_order_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
TABLE: {Name: "table [name] `[item item\n]...`", Help: "表格", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
- if arg[0] == "cmd" {
- msg := m.Cmd(kit.Split(arg[1])).Table()
- arg[1] = msg.Result()
- }
-
arg = _name(m, arg)
_table_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
@@ -403,25 +395,7 @@ func init() {
_local_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
- FIELD: {Name: "field [name] cmd", Help: "插件", Action: map[string]*ice.Action{
- "run": {Name: "run", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
- if !m.Warn(!m.Right(arg[1:]), ice.ErrNotRight, arg[1:]) {
- m.Cmdy(arg[1:])
- }
- }},
- }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
- arg = _name(m, arg)
- _field_show(m, strings.ReplaceAll(kit.Select(path.Base(arg[1]), arg[0]), " ", "_"), arg[1], arg[2:]...)
- }},
IMAGE: {Name: "image [name] url", Help: "图片", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
- if arg[0] == "qrcode" {
- buf := bytes.NewBuffer(make([]byte, 0, 4096))
- if qr, e := qrcode.New(arg[1], qrcode.Medium); m.Assert(e) {
- m.Assert(qr.Write(kit.Int(kit.Select("256")), buf))
- }
- arg[1] = "data:image/png;base64," + base64.StdEncoding.EncodeToString(buf.Bytes())
- }
-
arg = _name(m, arg)
_image_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
m.Render("")
@@ -432,6 +406,21 @@ func init() {
}
_chart_show(m, arg[0], arg[1], arg[2], arg[3:]...)
}},
+ FIELD: {Name: "field [name] cmd", Help: "插件", Action: map[string]*ice.Action{
+ "run": {Name: "run", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
+ if !m.Warn(!m.Right(arg[1:]), ice.ErrNotRight, arg[1:]) {
+ m.Cmdy(arg[1:])
+ }
+ }},
+ }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
+ arg = _name(m, arg)
+ _field_show(m, strings.ReplaceAll(kit.Select(path.Base(arg[1]), arg[0]), " ", "_"), arg[1], arg[2:]...)
+ }},
+ OTHER: {Name: "other [name] url", Help: "网页", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
+ arg = _name(m, arg)
+ _other_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
+ }},
+
PARSE: {Name: "parse type=auto,json,http,form,list auto text:textarea", Help: "结构", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if arg[0] == "auto" && (strings.HasPrefix(arg[1], "{") || strings.HasPrefix(arg[1], "[")) {
arg[0] = "json"
@@ -469,10 +458,6 @@ func init() {
}
}
}},
- OTHER: {Name: "other [name] url", Help: "网页", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
- arg = _name(m, arg)
- _other_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
- }},
WORD: {Name: "word path=src/main.shy auto 演示", Help: "语言文字", Meta: kit.Dict(
"display", "/plugin/local/wiki/word.js", "style", "word",