mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 01:04:06 +08:00
add some
Change-Id: Icd9aa865f02675b59091145b2c08269fe50c912b
This commit is contained in:
parent
60901ac971
commit
a3b3f0aa94
@ -906,6 +906,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
|
||||
if len(arg) > 0 && arg[0] == "check" { // 检查工作流
|
||||
bench := m.Confv("bench", m.Option("bench")).(map[string]interface{})
|
||||
m.Log("fuck", "waht %v", bench)
|
||||
if bench["creator"].(string) != arg[1] {
|
||||
switch bench["share"].(string) {
|
||||
case "private":
|
||||
@ -1007,15 +1008,16 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
}
|
||||
|
||||
if !right {
|
||||
lark := m.Find("web.lark")
|
||||
lark := m.Find("web.chat.lark")
|
||||
if lark != nil && m.Confs("login_lark") {
|
||||
right = ctx.Right(lark.Cmd("auth", m.Option("username"), "check", m.Option("cmd")).Result(0))
|
||||
}
|
||||
}
|
||||
|
||||
bench_share := ""
|
||||
bench, ok := m.Confv("bench", m.Option("bench")).(map[string]interface{})
|
||||
if right && !m.Confs("bench_disable") {
|
||||
if _, ok := m.Confv("bench", m.Option("bench")).(map[string]interface{}); !ok { // 创建工作流
|
||||
if !ok { // 创建工作流
|
||||
m.Append("redirect", fmt.Sprintf("%s?bench=%s", m.Option("index_path"), m.Spawn().Cmd("bench", "create").Append("key")))
|
||||
return
|
||||
}
|
||||
@ -1098,7 +1100,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
|
||||
if order != "" || (val["pre_run"] != nil && val["pre_run"].(bool)) {
|
||||
if val["componet_cmd"] != nil {
|
||||
if bench_share != "protected" {
|
||||
if len(bench) > 0 && bench_share != "protected" {
|
||||
now := time.Now().Format(m.Conf("time_format"))
|
||||
m.Confv("bench", []interface{}{m.Option("bench"), "commands", m.Option("componet_name_order")}, map[string]interface{}{
|
||||
"cmd": args[1:],
|
||||
|
@ -1,4 +1,4 @@
|
||||
package lark
|
||||
package chat
|
||||
|
||||
import (
|
||||
"contexts/ctx"
|
||||
@ -9,13 +9,13 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var Index = &ctx.Context{Name: "lark", Help: "会议中心",
|
||||
var Index = &ctx.Context{Name: "chat", Help: "会议中心",
|
||||
Caches: map[string]*ctx.Cache{},
|
||||
Configs: map[string]*ctx.Config{
|
||||
"lark_msg": &ctx.Config{Name: "lark_msg", Value: []interface{}{}, Help: "聊天记录"},
|
||||
"chat_msg": &ctx.Config{Name: "chat_msg", Value: []interface{}{}, Help: "聊天记录"},
|
||||
},
|
||||
Commands: map[string]*ctx.Command{
|
||||
"/lark": &ctx.Command{Name: "user", Help: "应用示例", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||
"/chat": &ctx.Command{Name: "user", 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)
|
||||
|
||||
@ -32,13 +32,13 @@ var Index = &ctx.Context{Name: "lark", Help: "会议中心",
|
||||
fmt.Fprintf(w, "{\"challenge\": \"%s\"}", data["challenge"])
|
||||
return
|
||||
}
|
||||
m.Confv("lark_msg", "-1", data)
|
||||
m.Confv("chat_msg", "-1", data)
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
lark := &web.WEB{}
|
||||
lark.Context = Index
|
||||
web.Index.Register(Index, lark)
|
||||
chat := &web.WEB{}
|
||||
chat.Context = Index
|
||||
web.Index.Register(Index, chat)
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package jira
|
||||
package team
|
||||
|
||||
import (
|
||||
"contexts/ctx"
|
||||
"contexts/web"
|
||||
)
|
||||
|
||||
var Index = &ctx.Context{Name: "jira", Help: "任务中心",
|
||||
var Index = &ctx.Context{Name: "team", Help: "任务中心",
|
||||
Caches: map[string]*ctx.Cache{},
|
||||
Configs: map[string]*ctx.Config{},
|
||||
Commands: map[string]*ctx.Command{
|
||||
@ -16,7 +16,7 @@ var Index = &ctx.Context{Name: "jira", Help: "任务中心",
|
||||
}
|
||||
|
||||
func init() {
|
||||
jira := &web.WEB{}
|
||||
jira.Context = Index
|
||||
web.Index.Register(Index, jira)
|
||||
team := &web.WEB{}
|
||||
team.Context = Index
|
||||
web.Index.Register(Index, team)
|
||||
}
|
218
usr/template/chat/chat.tmpl
Normal file
218
usr/template/chat/chat.tmpl
Normal file
@ -0,0 +1,218 @@
|
||||
{{define "head"}}
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.7">
|
||||
<title>code</title>
|
||||
<style>
|
||||
html, body {
|
||||
height:100%;
|
||||
width:100%;
|
||||
margin:0px;
|
||||
background-color:#d8d8d8;
|
||||
}
|
||||
fieldset {
|
||||
margin-top:8px;
|
||||
}
|
||||
legend {
|
||||
font-size:16px;
|
||||
font-weight:bold;
|
||||
font-family:monospace;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
textarea.clipboard {
|
||||
color:white;
|
||||
background-color:#272822;
|
||||
width:600px;
|
||||
}
|
||||
form.option div {
|
||||
float:left;
|
||||
}
|
||||
form.option hr {
|
||||
clear:both;
|
||||
}
|
||||
form.option label.keymap {
|
||||
color:red;
|
||||
display:none;
|
||||
}
|
||||
form.option label.keymap.show {
|
||||
display:inline;
|
||||
}
|
||||
form.option input {
|
||||
margin-right:10px;
|
||||
}
|
||||
form.option input.cmd {
|
||||
color:white;
|
||||
background-color:#272822;
|
||||
padding-left:10px;
|
||||
width:600px;
|
||||
}
|
||||
form.option input.file_cmd {
|
||||
color:white;
|
||||
background-color:#272822;
|
||||
padding-left:10px;
|
||||
width:400px;
|
||||
}
|
||||
form.option input.file_name {
|
||||
width:200px;
|
||||
}
|
||||
form.option.exec input {
|
||||
color:white;
|
||||
background-color:#272822;
|
||||
padding-left:10px;
|
||||
width:600px;
|
||||
}
|
||||
form.option select {
|
||||
margin-right:10px;
|
||||
}
|
||||
table.append {
|
||||
font-size:14px;
|
||||
overflow: auto;
|
||||
}
|
||||
table.append th {
|
||||
font-family:monospace;
|
||||
background-color:lightgreen;
|
||||
cursor:pointer;
|
||||
}
|
||||
table.append th.order {
|
||||
background-color:red;
|
||||
cursor:pointer;
|
||||
}
|
||||
table.append td {
|
||||
font-family:monospace;
|
||||
padding-left: 10px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
code.result pre {
|
||||
color:white;
|
||||
font-size:14px;
|
||||
background-color:#272822;
|
||||
overflow:scroll;
|
||||
padding:5px;
|
||||
border:solid 2px green;
|
||||
border-left:solid 4px green;
|
||||
margin:0;
|
||||
}
|
||||
code.result pre.clipboard {
|
||||
height:2em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onkeyup="return onaction(event, 'keymap')" onkeydown="return onaction(event, 'scroll')">
|
||||
{{end}}
|
||||
|
||||
{{define "void"}}{{end}}
|
||||
|
||||
{{define "detail"}}{{detail .}}{{end}}
|
||||
{{define "option"}}{{option .}}{{end}}
|
||||
{{define "append"}}{{append .}}{{end}}
|
||||
{{define "result"}}{{result .}}{{end}}
|
||||
|
||||
{{define "clipboard"}}
|
||||
<fieldset><legend>clipboard</legend>
|
||||
<datalist id="clipstack"></datalist>
|
||||
<datalist id="clistack"></datalist>
|
||||
<textarea class="clipboard"></textarea>
|
||||
</fieldset>
|
||||
{{end}}
|
||||
|
||||
{{define "componet"}}
|
||||
<fieldset><legend title="{{option .Meta "componet_help"}}">{{option .Meta "componet_help"}}({{option .Meta "componet_ctx"}}.{{option .Meta "componet_cmd"}})</legend>
|
||||
{{$form_type := option . "form_type"|meta}}
|
||||
{{$msg := .}}
|
||||
|
||||
{{if eq $form_type "upload"}}
|
||||
{{end}}
|
||||
<form class="option {{option .Meta "componet_name"}}"
|
||||
data-componet_group="{{option . "componet_group"|meta}}"
|
||||
data-componet_name="{{option . "componet_name"|meta}}"
|
||||
{{if eq $form_type "upload"}}
|
||||
method="POST" action="/upload" enctype="multipart/form-data"
|
||||
onsubmit="onaction(event,'upload')"
|
||||
{{end}}
|
||||
>
|
||||
<input style="display:none"></input>
|
||||
{{range $index, $input := option . "inputs"}}
|
||||
<div>
|
||||
{{$type := index $input "type"}}
|
||||
{{if index $input "label"}}
|
||||
<label>{{index $input "label"}} : </label>
|
||||
{{end}}
|
||||
{{if eq $type "button"}}
|
||||
<input type="button" onclick="return onaction(event, 'command')" value="{{index $input "value"}}">
|
||||
{{else if eq $type "submit"}}
|
||||
<input type="submit" value="{{index $input "value"}}">
|
||||
{{else if eq $type "file"}}
|
||||
<input type="file" name="{{index $input "name"}}">
|
||||
{{else if eq $type "choice"}}
|
||||
{{$default_value := index $input "value"}}
|
||||
<select name="{{index $input "name"}}" onchange="return onaction(event, 'command')">
|
||||
{{range $index, $value := index $input "choice"}}
|
||||
{{$val := index $value "value"}}
|
||||
{{if eq $default_value $val}}
|
||||
<option value="{{index $value "value"}}" selected>{{index $value "name"}}</option>
|
||||
{{else}}
|
||||
<option value="{{index $value "value"}}">{{index $value "name"}}</option>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</select>
|
||||
{{else if eq $type "password"}}
|
||||
<input
|
||||
type="password"
|
||||
name="{{index $input "name"}}"
|
||||
value="{{index $input "value"}}"
|
||||
class="{{index $input "class"}}"
|
||||
onclick="return onaction(event, 'click')"
|
||||
onkeyup="return onaction(event, 'input')">
|
||||
{{else}}
|
||||
{{$name := index $input "name"}}
|
||||
{{$value := option $msg $name|option}}
|
||||
<input
|
||||
name="{{index $input "name"}}"
|
||||
{{if $value}}
|
||||
value="{{$value}}"
|
||||
{{else}}
|
||||
value="{{index $input "value"}}"
|
||||
{{end}}
|
||||
class="{{index $input "class"}}"
|
||||
{{if index $input "clipstack"}}
|
||||
list="{{index $input "clipstack"}}"
|
||||
{{else}}
|
||||
list="clipstack"
|
||||
{{end}}
|
||||
onclick="return onaction(event, 'click')"
|
||||
onkeyup="return onaction(event, 'input')">
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
<hr/>
|
||||
</form>
|
||||
{{if eq $form_type "upload"}}
|
||||
{{end}}
|
||||
|
||||
{{if index .Meta "display_append"}}
|
||||
{{option .Meta "display_append"}}
|
||||
{{else}}
|
||||
<table class="append {{option .Meta "componet_name"}}">
|
||||
{{$msg := .}}
|
||||
<tr>{{range $field := append .}}<th>{{$field}}</th>{{end}}</tr>
|
||||
{{range $line := table .}}
|
||||
<tr>{{range $field := append $msg}}<td>{{index $line $field|unescape}}</td>{{end}}</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
{{end}}
|
||||
|
||||
{{if index .Meta "display_result"}}
|
||||
{{option .Meta "display_result"}}
|
||||
{{else}}
|
||||
<code class="result {{option .Meta "componet_name"}}"><pre>{{result .Meta}}</pre></code>
|
||||
{{end}}
|
||||
</fieldset>
|
||||
{{end}}
|
||||
|
||||
{{define "tail"}}
|
||||
<script src="/librarys/context.js"></script>
|
||||
<script src="/librarys/code.js"></script>
|
||||
</body>
|
||||
{{end}}
|
@ -169,8 +169,10 @@
|
||||
<ul class="cmd">
|
||||
<li data-action="shrink_cmd">+ 折叠命令行(Ctrl+Z)</li>
|
||||
<li data-action="create_cmd">+ 添加命令行(Ctrl+M)</li>
|
||||
{{range $index, $cmd := index $bench "commands"}}
|
||||
<li class="command{{$index}}" data-cmd="{{$index}}">{{index $cmd "now"|option}} {{$index}}: {{index $cmd "cmd"|option}}</li>
|
||||
{{if $bench}}
|
||||
{{range $index, $cmd := index $bench "commands"}}
|
||||
<li class="command{{$index}}" data-cmd="{{$index}}">{{index $cmd "now"|option}} {{$index}}: {{index $cmd "cmd"|option}}</li>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</ul>
|
||||
</li>
|
||||
@ -179,7 +181,7 @@
|
||||
<li data-action="refresh_fly">+ 刷新工作流(Ctrl+R)</li>
|
||||
<li data-action="create_fly">+ 添加工作流(Ctrl+T)</li>
|
||||
{{range $key, $item := conf . "bench"}}
|
||||
{{$creator := index $item "creator"}}
|
||||
{{$creator := index $item "creator"|option}}
|
||||
{{if eq $creator $username}}
|
||||
<li data-key="{{$key}}">{{index $item "modify_time"}} {{index $item "comment"}}({{slice $key 0 6}})</li>
|
||||
{{end}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user