1
0
forked from x/ContextOS
2018-09-15 16:55:48 +08:00

142 lines
3.2 KiB
HTML

{{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>
fieldset {
margin-top:8px;
}
legend {
font-size:16px;
font-weight:bold;
font-family:monospace;
}
th {
cursor:pointer;
background-color:lightgreen;
}
td {
padding-left: 10px;
padding-right: 20px;
}
pre {
color:white;
font-size:14px;
background-color:#272822;
padding:5px;
border:solid 2px green;
border-left:solid 4px green;
overflow:scroll;
}
.command {
font-size:14px;
font-family:monospace;
}
html, body {
height:100%;
width:100%;
margin:0px;
background-color:#d8d8d8;
}
</style>
<script src="/library/context.js"></script>
<script src="/library/base.js"></script>
</head>
<body>
{{end}}
{{define "code"}}
<pre><code>{{.}}</code></pre>
{{end}}
{{define "notice"}}
<fieldset class="notice"><legend>[notice]</legend>
{{template "code" result .Meta}}
</fieldset>
<style>
.notice {color:red}
</style>
{{end}}
{{define "detail"}}
{{$msg := .}}
{{$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>
{{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}}
<pre><code class="{{$key}}_result"></code></pre>
<div style="max-height:150px;overflow:auto">
<table class="{{$key}}_append"></table>
</div>
</fieldset>
<script>
var refresh_time = parseInt({{conf . "refresh_time"}});
{{if option . "auto_refresh"}}
update(true, '{{option $msg.Meta "module"}}', ['{{detail $msg.Meta}}'], '{{$key}}');
{{end}}
</script>
{{end}}
{{define "result"}}
<fieldset><legend>{{option . "title"}}</legend>
{{template "code" result .Meta|unscaped}}
</fieldset>
{{end}}
{{define "append_link"}}
<a onclick="return jump('{{.}}')" href="{{.}}">{{.}}</a>
<script>
function jump(to) {
location.href = location.href + "/" +to;
return false
}
</script>
{{end}}
{{define "append"}}
<fieldset><legend>{{option . "title"}}</legend>
<table class="append">
{{$msg := .}}
{{$ncol := append . |len}}
{{$nrow := append . 0|append .|len}}
<tr>{{range append .}}<th><code onclick="sort_table('{{.}}')">{{.}}</code></th>{{end}}</tr>
{{range $row, $val := append . 0|append .}}
<tr>
{{range append $msg}}
{{$value := append $msg . $row}}
<td><code>
{{if eq . "filename"}}
{{template "append_link" $value}}
{{else}}
{{$value}}
{{end}}
</code></td>
{{end}}
</tr>
{{end}}
</table>
</fieldset>
<script>
var sort_field="";
function sort_table(field) {
sort_field = field;
console.log(sort_field);
}
</script>
{{end}}
{{define "main"}}
welcome to context world!
{{end}}
{{define "tail"}}
</body>
{{end}}