summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-02-15 23:04:18 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2011-02-15 23:04:18 +0100
commit4989a8e572ea666d3e392a503ee6831b8a9386f9 (patch)
treef1cf0bf4e6744acb45ad3cbd15023916762ecf37 /templates
Initial commit.
Diffstat (limited to 'templates')
-rw-r--r--templates/base.tmpl43
-rw-r--r--templates/help.tmpl10
-rw-r--r--templates/login.tmpl14
-rw-r--r--templates/my.tmpl14
-rw-r--r--templates/register.tmpl16
-rw-r--r--templates/upload.tmpl23
-rw-r--r--templates/uploaded.tmpl11
7 files changed, 131 insertions, 0 deletions
diff --git a/templates/base.tmpl b/templates/base.tmpl
new file mode 100644
index 0000000..5b710f8
--- /dev/null
+++ b/templates/base.tmpl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <title>$title</title>
+ <link rel="StyleSheet" href="/s/style.css" type="text/css" />
+#block head
+#end block
+ </head>
+ <body>
+ <div id="page">
+ <div id="page-header">
+ <h1><a href="/">$header</a></h1>
+ </div>
+ <p class="login">#slurp
+#if $user
+Logged in as $user.username.#slurp
+#else
+Not logged in.#slurp
+#end if
+</p>
+ <div id="page-content">
+#block content
+#end block
+ <div id="page-wrapper"></div>
+ </div>
+ </div>
+ <div id="page-footer">
+ <ul>
+ <li><a href="/u">upload</a></li>
+#if $user
+ <li><a href="/o">logout</a></li>
+ <li><a href="/m">myfiles</a></li>
+#else
+ <li><a href="/l">login</a></li>
+ <li><a href="/r">register</a></li>
+#end if
+ <li><a href="/h">help</a></li>
+ </ul>
+ </div>
+ </body>
+</html>
diff --git a/templates/help.tmpl b/templates/help.tmpl
new file mode 100644
index 0000000..48d12bc
--- /dev/null
+++ b/templates/help.tmpl
@@ -0,0 +1,10 @@
+#def title: help
+#def header: help
+#extends templates.base
+#def content
+ <p>Usage: POST to <a href="$scheme://$host/u">$scheme://$host/u</a> with filedata given to "file" and original filename to "filename".
+ Login is sent by cookies with user id in "uid" and an identifier which is md5(uid+md5(password)).</p>
+ <p>cURL example:
+ <code>curl -b 'uid=42; identifier=3858f62230ac3c915f300c664312c63f' -F 'file=@image.png' -F 'filename=image.png' http://myhost/u</code>
+ Here user id is 42 and the password is "foobar".</p>
+#end def
diff --git a/templates/login.tmpl b/templates/login.tmpl
new file mode 100644
index 0000000..6baee6c
--- /dev/null
+++ b/templates/login.tmpl
@@ -0,0 +1,14 @@
+#def title: login
+#def header: login
+#extends templates.base
+#def content
+#set error = $error or ''
+ <div class="error">$error</div>
+ <form method="post" action="/l">
+ <p>username</p>
+ <p><input type="text" id="username" name="username" /></p>
+ <p>password</p>
+ <p><input type="password" id="password" name="password" /></p>
+ <p><input type="submit" value="Upload" /></p>
+ </form>
+#end def
diff --git a/templates/my.tmpl b/templates/my.tmpl
new file mode 100644
index 0000000..b1fb2cc
--- /dev/null
+++ b/templates/my.tmpl
@@ -0,0 +1,14 @@
+#def title: myfiles
+#def header: myfiles
+#extends templates.base
+#def content
+<p>Your uploads:</p>
+<ul>
+#for file in $files
+ <li>$file.html</li>
+#end for
+#if not len($files)
+ <li><em>(No file uploads yet.)</em></li>
+#end if
+</ul>
+#end def
diff --git a/templates/register.tmpl b/templates/register.tmpl
new file mode 100644
index 0000000..2a9d1a9
--- /dev/null
+++ b/templates/register.tmpl
@@ -0,0 +1,16 @@
+#def title: register
+#def header: register
+#extends templates.base
+#def content
+#set error = $error or ''
+ <div class="error">$error</div>
+ <form method="post" action="/r">
+ <p>username</p>
+ <p><input type="text" id="username" name="username" /></p>
+ <p>password</p>
+ <p><input type="password" id="password" name="password" /></p>
+ <p>repeat password</p>
+ <p><input type="password" id="password2" name="password2" /></p>
+ <p><input type="submit" value="Register" /></p>
+ </form>
+#end def
diff --git a/templates/upload.tmpl b/templates/upload.tmpl
new file mode 100644
index 0000000..49b0212
--- /dev/null
+++ b/templates/upload.tmpl
@@ -0,0 +1,23 @@
+#def title: upload
+#def header: upload
+#extends templates.base
+#def head
+ <script type="text/javascript">
+ function file_changed() {
+ s = document.getElementById('file').value;
+ i = s.lastIndexOf('/');
+ if(i < 0)
+ i = s.lastIndexOf('\\');
+ if(i >= 0)
+ s = s.substr(i+1);
+ document.getElementById('filename').value = s;
+ }
+ </script>
+#end def
+#def content
+ <form method="post" action="/u" enctype="multipart/form-data">
+ <input type="hidden" id="filename" name="filename" />
+ <p><input type="file" id="file" name="file" onchange="file_changed()" /></p>
+ <p><input type="submit" value="Upload" /></p>
+ </form>
+#end def
diff --git a/templates/uploaded.tmpl b/templates/uploaded.tmpl
new file mode 100644
index 0000000..e36fc53
--- /dev/null
+++ b/templates/uploaded.tmpl
@@ -0,0 +1,11 @@
+#def title: upload
+#def header: upload
+#extends templates.base
+#def content
+ <p>Your file has been uploaded: <a href="/f/$hash/$filename">$scheme://$host/f/$hash/$filename</a>.
+#if $user
+ <p>Your file will also appear in <a href="/m">your file list</a>.</p>
+#else
+ <p>If you were <a href="/r">registered</a> and <a href="/l">logged in</a>, your file would also appear in <a href="/m">your file list</a>.</p>
+#end if
+#end def