`, arg[0]))
- for _, l := range strings.Split(arg[1], "\n") {
- list = append(list, "
")
- switch arg[0] {
- case "shell":
- list = append(list, "
")
+ list := []string{kit.Format(`
`, arg[0])}
+ for _, l := range strings.Split(strings.Join(arg[1:], "\n"), "\n") {
+ switch list = append(list, "
"); arg[0] {
+ case kit.SSH_SHELL:
+ list = append(list, "")
default:
- list = append(list, "")
+ list = append(list, "")
}
- list = append(list, "")
- list = append(list, l)
- list = append(list, "")
+ list = append(list, "", l, "")
list = append(list, "
")
}
list = append(list, "
")
return strings.Join(list, "")
+ default:
+ return arg[0]
}
return ""
}
-func (m *Message) PushDownload(arg ...interface{}) { // [name] link
- m.Push("link", _render(m, RENDER_DOWNLOAD, arg...))
+func (m *Message) PushRender(key, view, name string, arg ...string) *Message {
+ return m.Push(key, _render(m, view, name, arg))
+}
+func (m *Message) PushDownload(arg ...interface{}) { // [name] file
+ m.Push(kit.MDB_LINK, _render(m, RENDER_DOWNLOAD, arg...))
}
func (m *Message) PushAnchor(arg ...interface{}) { // [name] link
- m.Push("link", _render(m, RENDER_ANCHOR, arg...))
+ m.Push(kit.MDB_LINK, _render(m, RENDER_ANCHOR, arg...))
}
func (m *Message) PushButton(arg ...string) {
- m.Push("action", _render(m, RENDER_BUTTON, strings.Join(arg, ",")))
+ m.Push(kit.MDB_ACTION, _render(m, RENDER_BUTTON, strings.Join(arg, ",")))
}
-func (m *Message) PushScript(text string, arg ...string) *Message {
- mime := "shell"
- if len(arg) > 0 {
- mime, text = text, strings.Join(arg, "\n")
- }
- return m.Push("script", _render(m, RENDER_SCRIPT, mime, text))
+func (m *Message) PushScript(arg ...string) *Message { // [type] text...
+ return m.Push(kit.MDB_SCRIPT, _render(m, RENDER_SCRIPT, arg))
}
-func (m *Message) PushImages(key, src string, arg ...string) { // src [size]
+func (m *Message) PushImages(key, src string, arg ...string) { // key src [size]
m.Push(key, _render(m, RENDER_IMAGES, src, arg))
}
-func (m *Message) PushQRCode(key string, text string, arg ...string) { // text [size]
+func (m *Message) PushVideos(key, src string, arg ...string) { // key src [size]
+ m.Push(key, _render(m, RENDER_VIDEOS, src, arg))
+}
+func (m *Message) PushQRCode(key string, text string, arg ...string) { // key text [size]
m.Push(key, _render(m, RENDER_QRCODE, text, arg))
}
func (m *Message) PushAction(list ...interface{}) {
@@ -212,51 +206,16 @@ func (m *Message) EchoAnchor(arg ...interface{}) *Message { // [name] link
func (m *Message) EchoButton(arg ...string) *Message {
return m.Echo(_render(m, RENDER_BUTTON, strings.Join(arg, ",")))
}
-func (m *Message) EchoScript(text string, arg ...string) *Message {
- mime := "shell"
- if len(arg) > 0 {
- mime, text = text, strings.Join(arg, "\n")
- }
- return m.Echo(_render(m, RENDER_SCRIPT, mime, text))
+func (m *Message) EchoScript(arg ...string) *Message {
+ return m.Echo(_render(m, RENDER_SCRIPT, arg))
}
func (m *Message) EchoQRCode(text string, arg ...string) *Message { // text [size]
return m.Echo(_render(m, RENDER_QRCODE, text, arg))
}
-func (m *Message) SortStr(key string) { m.Sort(key, "str") }
-func (m *Message) SortStrR(key string) { m.Sort(key, "str_r") }
func (m *Message) SortInt(key string) { m.Sort(key, "int") }
func (m *Message) SortIntR(key string) { m.Sort(key, "int_r") }
+func (m *Message) SortStr(key string) { m.Sort(key, "str") }
+func (m *Message) SortStrR(key string) { m.Sort(key, "str_r") }
func (m *Message) SortTime(key string) { m.Sort(key, "time") }
func (m *Message) SortTimeR(key string) { m.Sort(key, "time_r") }
-
-func (m *Message) PushRenderOld(key, view, name string, arg ...string) *Message {
- switch view {
- case "button":
- list := []string{}
- for _, k := range kit.Split(name) {
- list = append(list, fmt.Sprintf(`
`,
- k, kit.Select(k, kit.Value(m.cmd.Meta, kit.Keys("trans", k)))))
- }
- m.Push(key, strings.Join(list, ""))
- case "video":
- m.Push(key, fmt.Sprintf(`