1
0
forked from x/ContextOS
ContextOS/usr/template/upload.html
2018-05-31 22:07:19 +08:00

104 lines
2.3 KiB
HTML

{{define "git"}}
<fieldset><legend>branch</legend>
<pre>{{index . "branch"}}</pre>
</fieldset>
<fieldset><legend>status</legend>
<pre>{{index . "status"}}</pre>
</fieldset>
{{end}}
{{define "list"}}
<fieldset><legend><input type="text" id="dir" value="{{meta .file}}" onkeydown="return Change(event)"></legend>
<table>
<colgroup>{{range .append}}<col class="{{.}}">{{end}}</colgroup>
<tr>
{{$sort := meta .sort}}
{{$reverse := meta .reverse}}
{{range .append}}
{{if eq $sort .}}
<th class="{{.}} sort" onclick="list('{{.}}')">{{.}}</th>
{{else if eq $reverse .}}
<th class="{{.}} reverse" onclick="list('{{.}}')">{{.}}</th>
{{else if eq . "path"}}
{{else}}
<th class="{{.}}" onclick="list('{{.}}')">{{.}}</th>
{{end}}
{{end}}
</tr>
{{if .append}}
{{$meta := .}}
{{$first := index .append 0}}
{{range $i, $k := index . $first}}
<tr>
{{range $key := index $meta "append"}}
{{if eq $key "name"}}
<td class="{{$key}}">
<a href="/upload?file={{index $meta "path" $i}}"><code>{{index $meta $key $i}}</code></a>
</td>
{{else if eq $key "path"}}
{{else}}
<td class="{{$key}}">
<code>{{index $meta $key $i}}</code>
</td>
{{end}}
{{end}}
</tr>
{{end}}
{{end}}
</table>
</fieldset>
<style>
.time {
padding-right:20px;
}
.size {
text-align:right;
padding-right:20px;
}
.name {
padding-left:10px;
text-align:left;
}
.sort {
color:red;
}
.reverse {
color:green;
}
</style>
<script>
function Change(event) {
if (event.keyCode == 13) {
ctx.Search("file", event.target.value);
}
}
function list(what) {
ctx.Cookie("order", ctx.Cookie("order")*1 + 1);
ctx.Cookie("list", what);
ctx.Refresh();
}
</script>
{{end}}
{{define "upload"}}
<fieldset><legend>upload</legend>
<form method="POST" action="/upload" enctype="multipart/form-data">
<input type="file" name="file"><input type="submit">
</form>
</fieldset>
{{end}}
{{define "create"}}
<fieldset><legend>create</legend>
<form method="POST" action="/upload">
<table>
<tr><td>filename:</td><td><input type="text" name="filename" required><input type="submit"></td></tr>
<tr><td>content:</td><td><textarea rows="5" cols="80" name="content" required></textarea></td></tr>
</table>
</form>
</fieldset>
{{end}}