1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

mac opt something

This commit is contained in:
shaoying 2018-08-23 23:24:51 +08:00
parent 76cd7bf6c0
commit 7bd4822a82
4 changed files with 223 additions and 284 deletions

View File

@ -660,42 +660,43 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
}},
"lark": &ctx.Command{Name: "lark who message", Help: "散列",
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
if m.Option("username") == "" {
m.Option("username", m.Sess("aaa", false).Cap("username"))
}
if aaa, ok := c.Server.(*AAA); m.Assert(ok) && aaa.lark != nil { // {{{
m.Travel(func(m *ctx.Message, n int) bool {
if n == 0 {
if n == 0 || m.Cap("username") != m.Option("username") {
return true
}
if m.Cap("username") == m.Option("username") {
switch len(arg) {
case 0:
for k, v := range m.Confv("lark").(map[string]interface{}) {
for _, x := range v.([]interface{}) {
val := x.(map[string]interface{})
m.Add("append", "friend", k)
m.Add("append", "time", val["time"])
m.Add("append", "type", val["type"])
if val["type"].(string) == "send" {
m.Add("append", "text", fmt.Sprintf("<< %v", val["text"]))
} else {
m.Add("append", "text", fmt.Sprintf(">> %v", val["text"]))
}
switch len(arg) {
case 0:
for k, v := range m.Confv("lark").(map[string]interface{}) {
for _, x := range v.([]interface{}) {
val := x.(map[string]interface{})
m.Add("append", "friend", k)
m.Add("append", "time", val["time"])
m.Add("append", "type", val["type"])
if val["type"].(string) == "send" {
m.Add("append", "text", fmt.Sprintf("<< %v", val["text"]))
} else {
m.Add("append", "text", fmt.Sprintf(">> %v", val["text"]))
}
}
case 1:
for _, v := range m.Confv("lark", arg[0]).([]interface{}) {
val := v.(map[string]interface{})
m.Add("append", "time", val["time"])
m.Add("append", "text", val["text"])
}
case 2:
m.Confv("lark", strings.Join([]string{arg[0], "-2"}, "."),
map[string]interface{}{"time": m.Time(), "type": "send", "text": arg[1]})
aaa.lark <- m
m.Echo("%s send done", m.Time())
}
return false
case 1:
for _, v := range m.Confv("lark", arg[0]).([]interface{}) {
val := v.(map[string]interface{})
m.Add("append", "time", val["time"])
m.Add("append", "text", val["text"])
}
case 2:
m.Confv("lark", strings.Join([]string{arg[0], "-2"}, "."),
map[string]interface{}{"time": m.Time(), "type": "send", "text": arg[1]})
aaa.lark <- m
m.Echo("%s send done", m.Time())
}
return true
return false
}, c)
}
// }}}

View File

@ -1161,6 +1161,10 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
"pwd": &ctx.Command{Name: "pwd", Help: "查看当前路径", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
if m.Options("dir") { // {{{
m.Echo(m.Option("dir"))
m.Add("append", "hi", "hello")
m.Add("append", "he", "hello")
m.Add("append", "hi", "world")
m.Add("append", "he", "world")
return
}
if len(arg) > 0 {
@ -1169,6 +1173,7 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
wd, e := os.Getwd()
m.Assert(e)
m.Echo(wd) // }}}
m.Append("hi", "hello")
}},
"dir": &ctx.Command{
Name: "dir dir [dir_deep yes|no] [dir_info info] [dir_name name|tree|path|full] [dir_type file|dir] [sort_field name] [sort_order type]",

View File

@ -2,10 +2,7 @@ package web // {{{
// }}}
import ( // {{{
"contexts"
"regexp"
"runtime"
"strconv"
"toolkit"
"encoding/json"
"html/template"
@ -112,7 +109,7 @@ func (web *WEB) Trans(m *ctx.Message, key string, hand func(*ctx.Message, *ctx.C
case msg.Has("template"):
msg.Spawn().Cmd("/render", msg.Meta["template"])
case msg.Has("append"):
msg.Spawn().Copy(msg, "append").Cmd("/json")
msg.Spawn().Copy(msg, "result").Copy(msg, "append").Cmd("/json")
default:
for _, v := range msg.Meta["result"] {
w.Write([]byte(v))
@ -277,11 +274,12 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
"nroute": &ctx.Cache{Name: "nroute", Value: "0", Help: "路由数量"},
},
Configs: map[string]*ctx.Config{
"cmd": &ctx.Config{Name: "cmd", Value: "tmux", Help: "路由数量"},
"cert": &ctx.Config{Name: "cert", Value: "etc/cert.pem", Help: "路由数量"},
"key": &ctx.Config{Name: "key", Value: "etc/key.pem", Help: "路由数量"},
"root_index": &ctx.Config{Name: "root_index(true/false)", Value: "true", Help: "路由数量"},
"auto_create": &ctx.Config{Name: "auto_create(true/false)", Value: "true", Help: "路由数量"},
"cmd": &ctx.Config{Name: "cmd", Value: "tmux", Help: "路由数量"},
"cert": &ctx.Config{Name: "cert", Value: "etc/cert.pem", Help: "路由数量"},
"key": &ctx.Config{Name: "key", Value: "etc/key.pem", Help: "路由数量"},
"root_index": &ctx.Config{Name: "root_index(true/false)", Value: "true", Help: "路由数量"},
"auto_create": &ctx.Config{Name: "auto_create(true/false)", Value: "true", Help: "路由数量"},
"refresh_time": &ctx.Config{Name: "refresh_time(ms)", Value: "1000", Help: "路由数量"},
"check": &ctx.Config{Name: "check", Value: map[string]interface{}{
"login": []interface{}{
map[string]interface{}{
@ -338,14 +336,15 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
},
"shy": []interface{}{
map[string]interface{}{
"from": "root", "to": []interface{}{"duyu", "haojie"},
"from": "root", "to": []interface{}{},
"template": "userinfo", "title": "userinfo",
},
//聊天服务
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "aaa", "command": "lark",
"argument": []interface{}{},
"template": "append", "title": "lark_friend",
"module": "aaa", "detail": []interface{}{"lark"},
"template": "detail", "title": "list_lark",
// "option": map[string]interface{}{"auto_refresh": true},
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
@ -353,6 +352,46 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
"template": "detail", "title": "send_lark",
"option": map[string]interface{}{"ninput": 2},
},
//文件服务
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "nfs", "command": "dir",
"argument": []interface{}{"dir_type", "all", "dir_deep", "false", "dir_field", "time size line filename", "sort_field", "time", "sort_order", "time_r"},
"template": "append", "title": "",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"template": "upload", "title": "upload",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"template": "create", "title": "create",
},
//格式转换
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "cli", "detail": []interface{}{"time"},
"template": "detail", "title": "time",
"option": map[string]interface{}{"refresh": true, "ninput": 1},
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "nfs", "detail": []interface{}{"pwd"},
"template": "detail", "title": "pwd",
"option": map[string]interface{}{"refresh": true},
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "nfs", "detail": []interface{}{"json"},
"template": "detail", "title": "json",
"option": map[string]interface{}{"ninput": 1},
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "cli", "command": "system",
"argument": []interface{}{"tmux", "show-buffer"},
"template": "result", "title": "buffer",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "web", "command": "/share",
@ -371,62 +410,17 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
"argument": []interface{}{"tmux", "list-sessions"},
"template": "result", "title": "session",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "cli", "command": "system",
"argument": []interface{}{"tmux", "show-buffer"},
"template": "result", "title": "buffer",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "nfs", "command": "git",
"argument": []interface{}{},
"template": "result", "title": "git",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "nfs", "command": "dir",
"argument": []interface{}{"dir_type", "all", "dir_deep", "false", "dir_field", "time size line filename", "sort_field", "time", "sort_order", "time_r"},
"template": "append", "title": "",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"template": "upload", "title": "upload",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"template": "create", "title": "create",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "nfs", "detail": []interface{}{"pwd"},
"template": "detail", "title": "pwd",
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "cli", "detail": []interface{}{"time"},
"template": "detail", "title": "time",
"option": map[string]interface{}{"ninput": 1},
},
map[string]interface{}{
"from": "root", "to": []interface{}{},
"module": "nfs", "detail": []interface{}{"json"},
"template": "detail", "title": "json",
"option": map[string]interface{}{"ninput": 1},
},
},
"xujianing": []interface{}{
map[string]interface{}{
"module": "nfs", "detail": []interface{}{"pwd"},
"template": "detail", "title": "detail",
},
map[string]interface{}{
"module": "nfs", "command": "dir",
"argument": []interface{}{"dir_type", "all", "dir_deep", "false", "dir_field", "time size line filename", "sort_field", "time", "sort_order", "time_r"},
"template": "append", "title": "",
},
},
"notice": []interface{}{
map[string]interface{}{
"template": "userinfo", "title": "userinfo",
},
map[string]interface{}{
"template": "notice", "title": "notice",
},
@ -650,6 +644,21 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
msg := m.Spawn().Cmd("get", "method", "POST", arg)
m.Copy(msg, "result").Copy(msg, "append")
}},
"brow": &ctx.Command{Name: "brow url", Help: "浏览器网页", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
url := fmt.Sprintf("http://localhost:9094") //{{{
if len(arg) > 0 {
url = arg[0]
}
switch runtime.GOOS {
case "windows":
m.Find("cli").Cmd("system", "explorer", url)
case "darwin":
m.Find("cli").Cmd("system", "open", url)
case "linux":
m.Spawn().Cmd("open", url)
}
// }}}
}},
"serve": &ctx.Command{
Name: "serve [directory [address [protocol]]]",
Help: "启动服务, directory: 服务路径, address: 服务地址, protocol: 服务协议(https/http)",
@ -703,57 +712,13 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
// }}}
}},
"/library/": &ctx.Command{Name: "/library", Help: "网页门户", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
r := m.Optionv("request").(*http.Request)
r := m.Optionv("request").(*http.Request) // {{{
w := m.Optionv("response").(http.ResponseWriter)
dir := path.Join(m.Conf("library_dir"), m.Option("path"))
if s, e := os.Stat(dir); e == nil && !s.IsDir() {
http.ServeFile(w, r, dir)
return
}
}},
"/index/": &ctx.Command{Name: "/index", Help: "网页门户", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
r := m.Optionv("request").(*http.Request) // {{{
w := m.Optionv("response").(http.ResponseWriter)
if login := m.Spawn().Cmd("/login"); login.Has("template") {
m.Echo("no").Copy(login, "append")
return
}
m.Option("username", m.Append("username"))
//权限检查
dir := m.Option("dir", path.Join(m.Cap("directory"), m.Option("username"), m.Option("dir", strings.TrimPrefix(m.Option("path"), "/index"))))
if check := m.Spawn(c).Cmd("/check", "command", "/index/", "dir", dir); !check.Results(0) {
m.Copy(check, "append")
return
}
//执行命令
if m.Has("details") {
if m.Confs("check_right") {
if check := m.Spawn().Cmd("/check", "target", m.Option("module"), "command", m.Option("details")); !check.Results(0) {
m.Copy(check, "append")
return
}
}
msg := m.Find(m.Option("module")).Cmd(m.Optionv("details"))
m.Copy(msg, "result").Copy(msg, "append")
return
}
//下载文件
if s, e := os.Stat(dir); e == nil && !s.IsDir() {
http.ServeFile(w, r, dir)
return
}
if !m.Options("module") {
m.Option("module", "web")
}
//浏览目录
m.Append("template", m.Append("username"))
m.Option("title", "index")
// }}}
}},
"/travel": &ctx.Command{Name: "/travel", Help: "文件上传", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
@ -850,131 +815,49 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
m.Append("template", m.Conf("travel_main"), m.Conf("travel_tmpl"))
// }}}
}},
"/upload": &ctx.Command{Name: "/upload", Help: "文件上传", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
"/index/": &ctx.Command{Name: "/index", Help: "网页门户", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
r := m.Optionv("request").(*http.Request) // {{{
w := m.Optionv("response").(http.ResponseWriter)
if !m.Options("dir") {
m.Option("dir", m.Cap("directory"))
if login := m.Spawn().Cmd("/login"); login.Has("template") {
m.Echo("no").Copy(login, "append")
return
}
m.Option("username", m.Append("username"))
check := m.Spawn().Cmd("/share", "/upload", "dir", m.Option("dir"))
if !check.Results(0) {
//权限检查
dir := m.Option("dir", path.Join(m.Cap("directory"), m.Option("username"), m.Option("dir", strings.TrimPrefix(m.Option("path"), "/index"))))
if check := m.Spawn(c).Cmd("/check", "command", "/index/", "dir", dir); !check.Results(0) {
m.Copy(check, "append")
return
}
aaa := check.Appendv("aaa").(*ctx.Message)
// 输出文件
s, e := os.Stat(m.Option("dir"))
if m.Assert(e); !s.IsDir() {
http.ServeFile(w, r, m.Option("dir"))
//执行命令
if m.Has("details") {
if m.Confs("check_right") {
if check := m.Spawn().Cmd("/check", "target", m.Option("module"), "command", m.Option("details")); !check.Results(0) {
m.Copy(check, "append")
return
}
}
msg := m.Find(m.Option("module")).Cmd(m.Optionv("details"))
m.Copy(msg, "result").Copy(msg, "append")
return
}
// 共享列表
share := m.Sess("share", m.Target())
index := share.Target().Index
if index != nil && index[aaa.Cap("username")] != nil {
for k, v := range index[aaa.Cap("username")].Index {
for _, j := range v.Commands {
for _, n := range j.Shares {
for _, nn := range n {
if match, e := regexp.MatchString(nn, m.Option("dir")); m.Assert(e) && match {
share.Add("append", "group", k)
share.Add("append", "value", nn)
share.Add("append", "delete", "delete")
}
}
}
}
}
}
share.Sort("value", "string")
share.Sort("argument", "string")
if false {
//下载文件
if s, e := os.Stat(dir); e == nil && !s.IsDir() {
http.ServeFile(w, r, dir)
return
}
// 输出目录
fs, e := ioutil.ReadDir(m.Option("dir"))
m.Assert(e)
fs = append(fs, s)
list := m.Sess("list", m.Target())
list.Option("dir", m.Option("dir"))
for _, v := range fs {
name := v.Name()
if v == s {
if name == m.Option("dir") {
continue
}
name = ".."
} else if name[0] == '.' {
continue
}
list.Add("append", "time_i", fmt.Sprintf("%d", v.ModTime().Unix()))
list.Add("append", "size_i", fmt.Sprintf("%d", v.Size()))
list.Add("append", "time", v.ModTime().Format("2006-01-02 15:04:05"))
list.Add("append", "size", kit.FmtSize(v.Size()))
if v.IsDir() {
name += "/"
list.Add("append", "type", "dir")
} else {
list.Add("append", "type", "file")
}
list.Add("append", "name", name)
list.Add("append", "path", path.Join(m.Option("dir"), name))
if !m.Options("module") {
m.Option("module", "web")
}
// 目录排序
max := true
if i, e := strconv.Atoi(m.Option("sort_order")); e == nil {
max = i%2 == 1
}
switch m.Option("list") {
case "name":
if max {
list.Sort(m.Option("list"), "string")
} else {
list.Sort(m.Option("list"), "string_r")
}
case "size", "time":
if max {
list.Sort(m.Option("list")+"_i", "int")
} else {
list.Sort(m.Option("list")+"_i", "int_r")
}
}
list.Meta["append"] = list.Meta["append"][2:]
delete(list.Meta, "time_i")
delete(list.Meta, "size_i")
// 执行命令
switch m.Confx("cmd") {
case "git":
git := m.Sess("git", m.Target())
branch := m.Find("nfs").Cmd("git", "-C", m.Option("dir"), "branch")
git.Option("branch", branch.Result(0))
status := m.Find("nfs").Cmd("git", "-C", m.Option("dir"), "status")
git.Option("status", status.Result(0))
case "tmux":
tmux := m.Sess("tmux", m.Target())
buffer := m.Sess("cli").Cmd("system", "tmux", "show-buffer", "-b", "0")
tmux.Option("buffer", buffer.Result(0))
sessions := m.Sess("cli").Cmd("system", "tmux", "list-sessions")
// sessions := m.Sess("cli").Cmd("system", "tmux", "list-sessions", "-F", "#S")
tmux.Option("sessions", sessions.Result(0))
}
m.Append("title", "upload")
m.Append("tmpl", "userinfo", "share", "list", "git", "tmux", "upload", "create")
m.Append("template", m.Conf("upload_main"), m.Conf("upload_tmpl"))
//浏览目录
m.Append("template", m.Append("username"))
m.Option("page_title", "index")
// }}}
}},
"/create": &ctx.Command{Name: "/create", Help: "创建目录或文件", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
@ -1223,6 +1106,9 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
w := m.Optionv("response").(http.ResponseWriter) // {{{
meta := map[string][]string{}
if len(m.Meta["result"]) > 0 {
meta["result"] = m.Meta["result"]
}
if len(m.Meta["append"]) > 0 {
meta["append"] = m.Meta["append"]
for _, v := range m.Meta["append"] {
@ -1252,20 +1138,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
msg.Cmd("get", "method", "POST", "evaluating_add/", "questions", qs)
m.Add("append", "hi", "hello")
}},
"brow": &ctx.Command{Name: "brow url", Help: "浏览器网页", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
url := fmt.Sprintf("http://localhost:9094")
if len(arg) > 0 {
url = arg[0]
}
switch runtime.GOOS {
case "windows":
m.Find("cli").Cmd("system", "explorer", url)
case "darwin":
m.Find("cli").Cmd("system", "open", url)
case "linux":
m.Spawn().Cmd("open", url)
}
}},
},
}

View File

@ -2,11 +2,15 @@
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>{{option .Meta "title"}}</title>
<title>{{option .Meta "page_title"}}</title>
<style>
fieldset {
margin-top:8px;
}
legend {
font-size:16px;
font-weight:bold;
font-family:monospace;
}
th {
cursor:pointer;
@ -19,7 +23,72 @@
code {
font-size:14px;
}
.command {
font-size:14px;
font-family:monospace;
}
</style>
<script src="/library/context.js"></script>
<script>
function update(event, module, details, key) {
if (event) {
window[key+"timer"] = !window[key+"timer"];
}
if (!window[key+"timer"]) {
return
}
console.log("update "+key)
setTimeout(function() {
action(event, module, details, key);
update(null, module, details, key);
}, parseInt({{conf . "refresh_time"}}));
}
function input(event, module, details, key) {
if (event.code == "Enter") {
action(event, module, details, key);
}
}
function action(event, module, details, key) {
var input = document.getElementsByClassName(key+"_input");
for (var i = 0; i < input.length; i++ ){
if (input[i].value != "") {
details.push(input[i].value)
}
}
ctx.POST("", {module:module, details:details}, function(msg) {
if (msg && msg.result) {
var result = document.getElementsByClassName(key+"_result")[0];
result.innerHTML = msg.result;
}
if (!msg || !msg.append || msg.append.length < 1) {
return
}
var append = document.getElementsByClassName(key+"_append")[0];
if (append.rows.length == msg[msg.append[0]].length+1) {
return
}
append.innerHTML = '';
var tr = append.insertRow(0);
for (var i in msg.append) {
var th = tr.appendChild(document.createElement("th"));
th.appendChild(document.createTextNode(msg.append[i]));
}
for (var i = 0; i < msg[msg.append[0]].length; i++) {
var tr = append.insertRow(1);
for (var j in msg.append) {
var td = tr.appendChild(document.createElement("td"));
td.appendChild(document.createTextNode(msg[msg.append[j]][i]));
}
}
var div = append.parent;
})
return false;
}
</script>
</head>
<body>
{{end}}
@ -29,7 +98,7 @@
{{end}}
{{define "notice"}}
<fieldset class="notice"><legend>notice</legend>
<fieldset class="notice"><legend>[notice]</legend>
{{template "code" result .Meta}}
</fieldset>
<style>
@ -38,34 +107,27 @@
{{end}}
{{define "detail"}}
{{$key := append . "title"|meta}}
{{$msg := .}}
<fieldset><legend>{{append . "title"|meta}}</legend>
{{$key := append . "title"|meta}}
<fieldset><legend><a onclick="return action(event, '{{option .Meta "module"}}', ['{{detail .Meta}}'], '{{$key}}')" href="/">{{option . "title"}}</a></legend>
{{range option . "ninput"|meta|list}}
<input type="text" class="{{$key}}_input" value="" onkeyup="return input(event, '{{option $msg.Meta "module"}}', ['{{detail $msg.Meta}}'], '{{$key}}_input', '{{$key}}_result')"></input>
<input type="text" class="{{$key}}_input" value="" onkeyup="return input(event, '{{option $msg.Meta "module"}}', ['{{detail $msg.Meta}}'], '{{$key}}')"></input>
{{end}}
{{if option . "refresh"}}
<input type="button" class="{{$key}}_button" value="update" onclick="return update(event, '{{option $msg.Meta "module"}}', ['{{detail $msg.Meta}}'], '{{$key}}')"></input>
<input type="button" class="{{$key}}_button" value="cancel" onclick="return update(event, '{{option $msg.Meta "module"}}', ['{{detail $msg.Meta}}'], '{{$key}}')"></input>
{{end}}
<a onclick="return action(event, '{{option .Meta "module"}}', ['{{detail .Meta}}'], '{{$key}}_input', '{{$key}}_result')" href="/">{{template "code" detail .Meta}}</a>
<pre><code class="{{$key}}_result"></code></pre>
<div style="max-height:150px;overflow:auto">
<table class="{{$key}}_append"></table>
</div>
</fieldset>
<script>
function input(event, module, details, input, results) {
if (event.code == "Enter") {
action(event, module, details, input, results);
}
}
function action(event, module, details, input, results) {
var input = document.getElementsByClassName(input);
for (var i = 0; i < input.length; i++ ){
if (input[i].value != "") {
details.push(input[i].value)
}
}
ctx.POST("", {module:module, details:details}, function(msg) {
var result = document.getElementsByClassName(results)[0];
result.innerHTML = msg.result || msg.message || msg;
})
return false;
}
{{if option . "auto_refresh"}}
update(true, '{{option $msg.Meta "module"}}', ['{{detail $msg.Meta}}'], '{{$key}}');
{{end}}
</script>
{{end}}
@ -86,7 +148,7 @@ function jump(to) {
{{end}}
{{define "append"}}
<fieldset><legend>{{append . "title"}}</legend>
<fieldset><legend>{{option . "title"}}</legend>
<table class="append">
{{$msg := .}}
{{$ncol := append . |len}}
@ -122,6 +184,5 @@ welcome to context world!
{{end}}
{{define "tail"}}
<script src="/library/context.js"></script>
</body>
{{end}}