1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
shaoying 2019-10-13 13:36:39 +08:00
parent db63632956
commit 57ba474020
6 changed files with 55 additions and 9 deletions

View File

@ -7,5 +7,5 @@ var version = struct {
self int self int
}{ }{
[]string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"}, []string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"},
`2019-10-09 20:58:29`, `centos`, 630, `2019-10-13 12:01:52`, `mac`, 640,
} }

View File

@ -1243,6 +1243,55 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
} }
return return
}}, }},
"xls": {Name: "xls", Help: "表格", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
switch len(arg) {
case 0:
m.Cmdy("ssh.data", "show", "xls")
m.Meta["append"] = []string{"id", "title"}
case 1:
var data map[int]map[int]string
what := m.Cmd("ssh.data", "show", "xls", arg[0], "format", "object").Append("content")
json.Unmarshal([]byte(what), &data)
max, n := 0, 0
for i, v := range data {
if i > n {
n = i
}
for i := range v {
if i > max {
max = i
}
}
}
m.Log("info", "m: %d n: %d", m, n)
for k := 0; k < n+2; k++ {
for i := 0; i < max+2; i++ {
m.Push(kit.Format(k), kit.Format(data[k][i]))
}
}
case 2:
m.Cmdy("ssh.data", "insert", "xls", "title", arg[0], "content", arg[1])
default:
data := map[int]map[int]string{}
what := m.Cmd("ssh.data", "show", "xls", arg[0], "format", "object").Append("content")
json.Unmarshal([]byte(what), &data)
for i := 1; i < len(arg)-2; i += 3 {
if _, ok := data[kit.Int(arg[i])]; !ok {
data[kit.Int(arg[i])] = make(map[int]string)
}
data[kit.Int(arg[i])][kit.Int(arg[i+1])] = arg[i+2]
}
m.Cmdy("ssh.data", "update", "xls", arg[0], "content", kit.Format(data))
}
return
}},
}, },
} }

View File

@ -1,4 +1,4 @@
kit xls "表格" "index.js" "index.css" private \ kit xls "表格" "index.js" "index.css" private "nfs.xls" \
text "" name title imports plugin_xls_id action auto \ text "" name title imports plugin_xls_id action auto \
text "" name content \ text "" name content \
button "执行" \ button "执行" \

View File

@ -340,7 +340,6 @@ fieldset.Footer>div.output div.state {
float:right; float:right;
} }
fieldset.Footer>div.output div.state div { fieldset.Footer>div.output div.state div {
margin-left:5px;
float:right; float:right;
} }

View File

@ -1038,7 +1038,7 @@ function Plugin(page, pane, field, inits, runs) {
return Inputs(plugin, input, item, plugin.View(option, "input", input)[input.name], option).target return Inputs(plugin, input, item, plugin.View(option, "input", input)[input.name], option).target
}), }),
Select: shy("选择控件", function(target, focus) {field.onclick(event) Select: shy("选择控件", function(target, focus) {field.onclick(event)
page.input = target = target || option.querySelectorAll("input")[1] page.plugin = field, page.input = target = target || option.querySelectorAll("input")[1]
plugin.which.set(page.input.name) plugin.which.set(page.input.name)
focus && page.input.focus() focus && page.input.focus()
}), }),
@ -1056,9 +1056,7 @@ function Plugin(page, pane, field, inits, runs) {
return JSON.stringify(field.Meta) return JSON.stringify(field.Meta)
}), }),
Clone: shy("复制插件", function() { Clone: shy("复制插件", function() {
return pane.Append("field", {text: plugin.Reveal()}, [], "", function(line, index, event, cmds, cbs) { return pane.Append("field", {text: plugin.Reveal(), init: meta.init, view: meta.view}, [], "").item.Plugin.Select()
plugin.Run(event, cmds, cbs, true)
}).item.Plugin.Select()
}), }),
Move: function() { Move: function() {
@ -1337,7 +1335,7 @@ function Inputs(plugin, meta, item, target, option) {
if (event.key == "Enter" && (event.ctrlKey || item.type == "text")) { if (event.key == "Enter" && (event.ctrlKey || item.type == "text")) {
// Event入口 2.1 // Event入口 2.1
input.which.set(target.value) != undefined && plugin.History(target.value, target) input.which.set(target.value) != undefined && plugin.History(target.value, target)
input.Event(event, {}) && plugin.Check(target) input.Event(event, {}) && plugin.Check(event, target)
} }
}, },
onkeyup: function(event) { onkeyup: function(event) {

View File

@ -35,7 +35,7 @@ kit = toolkit = (function() {var kit = {__proto__: document,
} }
return meta[type] = list, list.push({time: Date.now(), data: data})-1 return meta[type] = list, list.push({time: Date.now(), data: data})-1
}), }),
Debug: shy("调试断点", {why: true, msg: true}, function(key) { Debug: shy("调试断点", {why: true, msg: true, config: false}, function(key) {
if (arguments.callee.meta[key]) {debugger} if (arguments.callee.meta[key]) {debugger}
}), }),
Log: shy("输出日志", {hide: {"init": true, "wss": false}, call: [], Log: shy("输出日志", {hide: {"init": true, "wss": false}, call: [],