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

163 lines
5.2 KiB
Cheetah

{{define "head"}}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{option .Meta "page_title"}}</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>
form.option div {
float:left;
}
form.option hr {
clear:both;
}
form.option label.keymap {
display:none;
color:red;
}
form.option label.keymap.show {
display:inline;
}
table.append th {
cursor:pointer;
background-color:lightgreen;
}
table.append th.order {
cursor:pointer;
background-color:red;
}
table.append td {
padding-left: 10px;
padding-right: 20px;
}
code.result pre {
color:white;
font-size:14px;
background-color:#272822;
padding:5px;
border:solid 2px green;
border-left:solid 4px green;
overflow:scroll;
}
</style>
</head>
<body onkeyup="return onaction(event, 'keymap')">
{{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>
<input id="clipboard">
</fieldset>
{{end}}
{{define "upload"}}
<fieldset><legend>clipboard</legend>
<form
>
<file></file>
</form>
</fieldset>
{{end}}
{{define "componet"}}
<fieldset><legend title="{{option .Meta "help"}}">{{option .Meta "help"}}({{option .Meta "command"}}.{{option .Meta "context"}})</legend>
{{$form_type := option . "form_type"|meta}}
<form class="option {{option .Meta "name"}}"
data-last_componet_group="{{option . "last_componet_group"|meta}}"
data-last_componet_order="{{option . "last_componet_order"|meta}}"
data-componet_group="{{option . "componet_group"|meta}}"
data-componet_order="{{option . "componet_order"|meta}}"
data-componet_name="{{option . "name"|meta}}"
data-componet_help="{{option . "help"|meta}}"
{{if eq $form_type "upload"}}
method="POST" action="/upload" enctype="multipart/form-data"
{{end}}
>
<input style="display:none"></input>
{{range $index, $input := option . "inputs"}}
<div>
{{$type := index $input "type"}}
{{if eq $type "button"}}
<input type="button" name="{{index $input "name"}}" value="{{index $input "value"}}" onclick="return onaction(event, 'command')">
{{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"}}
<label>{{index $input "label"}} : </label>
<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}}
<label>{{index $input "label"}} : </label>
<input
name="{{index $input "name"}}"
value="{{index $input "value"}}"
list="clipstack"
onclick="return onaction(event, 'click')"
onkeyup="return onaction(event, 'input')">
{{end}}
</div>
{{end}}
<hr/>
</form>
{{if index .Meta "display_append"}}
{{option .Meta "display_append"}}
{{else}}
<table class="append {{option .Meta "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 "name"}}"><pre>{{result .Meta}}</pre></code>
{{end}}
</fieldset>
{{end}}
{{define "tail"}}
<script src="/library/context.js"></script>
<script src="/library/base.js"></script>
</body>
{{end}}