summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2009-11-25 22:49:43 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2009-11-25 22:49:43 +0100
commit492433abe865220c227e62cf12f3c93856432585 (patch)
treec33d0562c3c1c2dfde298eb083d5fd39c5fe8984
downloadweb-492433abe865220c227e62cf12f3c93856432585.tar.gz
web-492433abe865220c227e62cf12f3c93856432585.tar.bz2
web-492433abe865220c227e62cf12f3c93856432585.zip
Initial Portato Website
-rw-r--r--.gitignore1
-rw-r--r--helper.py4
-rwxr-xr-xindex.py69
-rw-r--r--static/css/style.css387
-rw-r--r--static/images/favicon.icobin0 -> 3262 bytes
-rw-r--r--static/images/img01.gifbin0 -> 3840 bytes
-rw-r--r--static/images/img02.gifbin0 -> 4689 bytes
-rw-r--r--static/images/img03.gifbin0 -> 229 bytes
-rw-r--r--static/images/img04.gifbin0 -> 92 bytes
-rw-r--r--static/images/portato.pngbin0 -> 3684 bytes
-rw-r--r--templates/menu.lst3
-rw-r--r--templates/page.mako14
-rw-r--r--templates/pages/development.mako7
-rw-r--r--templates/pages/download.mako7
-rw-r--r--templates/pages/index.mako8
-rw-r--r--templates/root.mako61
16 files changed, 561 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0d20b64
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.pyc
diff --git a/helper.py b/helper.py
new file mode 100644
index 0000000..910da0d
--- /dev/null
+++ b/helper.py
@@ -0,0 +1,4 @@
+import web
+
+def url (path):
+ return "\"%s\"" % web.url(path)
diff --git a/index.py b/index.py
new file mode 100755
index 0000000..09a24aa
--- /dev/null
+++ b/index.py
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+
+from __future__ import with_statement
+
+import os
+import web
+import mako
+from mako.lookup import TemplateLookup
+
+from functools import partial
+
+import helper
+
+APPDIR = os.path.dirname(os.path.abspath(__file__))
+
+def appdir (*args):
+ return os.path.join(APPDIR, *args)
+
+class Renderer:
+ def __init__ (self):
+ self.lookup = TemplateLookup(directories=[appdir('templates')],
+ module_directory = "/tmp/portato/",
+ input_encoding='utf-8',
+ output_encoding='utf-8')
+
+ def render (self, tpl):
+ print tpl
+ try:
+ t = self.get_tpl(tpl)
+ except mako.exceptions.TopLevelLookupException, e:
+ raise web.webapi.notfound(e)
+
+ return partial(t.render, w = web, h = helper)
+
+ __call__ = render
+
+ def get_tpl (self, tpl):
+ return self.lookup.get_template(self.get_tpl_name(tpl))
+
+ def get_tpl_name (self, tpl):
+ if not tpl.endswith(".mako"):
+ tpl = tpl+".mako"
+
+ return os.path.join("pages", tpl)
+
+urls = ("/(.*)", "Handler")
+app = web.application(urls, globals())
+
+render = Renderer()
+
+class Handler:
+ def GET(self, name = '/'):
+ print "Test"
+ if not name or name == '/': name = 'index'
+ return render(name)(menulist = self.generate_menu_list())
+
+ def generate_menu_list (self):
+ menulist = []
+ with open(appdir("templates", "menu.lst")) as menu:
+ for entry in menu:
+ entry = entry.strip()
+ menulist.append((entry, render.get_tpl(entry).uri))
+
+ return menulist
+
+
+# web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
+if __name__ == "__main__":
+ app.run()
diff --git a/static/css/style.css b/static/css/style.css
new file mode 100644
index 0000000..fd08a50
--- /dev/null
+++ b/static/css/style.css
@@ -0,0 +1,387 @@
+/*
+Design by Free CSS Templates
+http://www.freecsstemplates.org
+Released for free under a Creative Commons Attribution 2.5 License
+*/
+
+body {
+ margin: 0;
+ padding: 0;
+ background: #000000;
+ font-size: 13px;
+ font-family: "Trebuchet MS", Georgia, "Times New Roman", Times, serif;
+ text-align: justify;
+ color: #FFFFFF;
+}
+
+
+h1, h2, h3 {
+ margin: 0;
+ text-transform: lowercase;
+ font-weight: normal;
+ color: #FFFFFF;
+}
+
+h1 {
+ letter-spacing: -1px;
+ font-size: 32px;
+}
+
+h2 {
+ font-size: 23px;
+}
+
+p, ul, ol {
+ margin: 0 0 2em 0;
+ text-align: justify;
+ line-height: 26px;
+}
+
+a:link {
+ color: #8BD80E;
+}
+
+a:hover, a:active {
+ text-decoration: none;
+ color: #8BD80E;
+}
+
+a:visited {
+ color: #8BD80E;
+}
+
+img {
+ border: none;
+}
+
+img.left {
+ float: left;
+ margin-right: 15px;
+}
+
+img.right {
+ float: right;
+ margin-left: 15px;
+}
+
+/* Form */
+
+form {
+ margin: 0;
+ padding: 0;
+}
+
+fieldset {
+ margin: 0;
+ padding: 0;
+ border: none;
+}
+
+legend {
+ display: none;
+}
+
+input, textarea, select {
+ font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
+ font-size: 13px;
+ color: #333333;
+}
+
+#wrapper {
+ margin: 0;
+ padding: 0;
+ background: #FFFFFF url(../images/img01.gif) repeat-x left top;
+}
+
+/* Header */
+
+#header {
+ width: 713px;
+ margin: 0 auto;
+ height: 42px;
+}
+
+/* Menu */
+
+#menu {
+ float: left;
+ width: 713px;
+ height: 50px;
+ background: url(../images/img02.gif) no-repeat left top;
+}
+
+#menu ul {
+ margin: 0;
+ padding: 0px 0 0 10px;
+ list-style: none;
+ line-height: normal;
+}
+
+#menu li {
+ display: block;
+ float: left;
+}
+
+#menu a {
+ display: block;
+ float: left;
+ background: url(../images/img04.gif) no-repeat right 55%;
+ margin-top: 5px;
+ margin-right: 3px;
+ padding: 8px 17px;
+ text-decoration: none;
+ font-size: 13px;
+ color: #000000;
+}
+
+#menu a:hover {
+ color: #000000;
+}
+
+#menu .current_page_item a {
+ color: #000000;
+}
+
+/** LOGO */
+
+#logo {
+ width: 713px;
+ height: 80px;
+ margin: 0 auto;
+}
+
+#logo h1, #logo h2, #logo img {
+ float: left;
+ margin: 0;
+ padding: 30px 0 0 0px;
+ line-height: normal;
+}
+
+#logo img {
+ float: left;
+ margin-right: 15px;
+ padding: 30px 0 0 0px;
+}
+
+#logo h1 {
+ font-family: Georgia, "Times New Roman", Times, serif;
+ font-size:40px;
+}
+
+#logo h1 a {
+ text-decoration: none;
+ color: #4C4C4C;
+}
+
+#logo h1 a:hover { text-decoration: underline; }
+
+#logo h2 {
+ float: left;
+ padding: 45px 0 0 18px;
+ font: 18px Georgia, "Times New Roman", Times, serif;
+ color: #8BD80E;
+}
+
+#logo p a {
+ text-decoration: none;
+ color: #8BD80E;
+}
+
+#logo p a:hover { text-decoration: underline; }
+
+
+
+/* Page */
+
+#page {
+ width: 663px;
+ margin: 0 auto;
+ background: #4C4C4C url(../images/img03.gif) no-repeat left bottom;
+ padding: 0 25px;
+}
+
+/* Content */
+
+#content {
+ float: left;
+ width: 620px;
+
+}
+
+/* Post */
+
+.post {
+ padding: 15px 0px;
+ margin-bottom: 20px;
+}
+
+.post .title {
+ margin-bottom: 20px;
+ padding-bottom: 5px;
+}
+
+.post h1 {
+ padding: 0px 0 0 0px;
+ background: url(../images/img08.jpg) no-repeat left top;
+ font-size: 24px;
+ color: #FFFFFF;
+}
+
+.post h2 {
+ padding: 0px 0 0 0px;
+ font-size: 22px;
+ color: #FFFFFF;
+}
+
+.post .entry {
+}
+
+.post .meta {
+ padding: 15px 15px 30px 0px;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 11px;
+}
+
+.post .meta p {
+ margin: 0;
+ padding-top: 15px;
+ line-height: normal;
+ color: #FFFFFF;
+}
+
+.post .meta .byline {
+ float: left;
+}
+
+.post .meta .links {
+ float: right;
+}
+
+.post .meta .more {
+ padding: 0 10px 0 18px;
+}
+
+.post .meta .comments {
+}
+
+.post .meta b {
+ display: none;
+}
+
+
+/* Sidebar */
+
+#sidebar {
+ width: 210px;
+ float: right;
+ margin: 0;
+ padding: 0;
+}
+
+#sidebar ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+#sidebar li {
+ margin-bottom: 40px;
+}
+
+#sidebar li ul {
+}
+
+#sidebar li li {
+ margin: 0;
+}
+
+#sidebar h2 {
+ width: 250px;
+ padding: 8px 0 0 0px;
+ margin-bottom: 10px;
+ background: url(../images/img07.jpg) no-repeat left top;
+ font-size: 20px;
+ color: #FFFFFF;
+}
+
+/* Search */
+
+#search {
+
+}
+
+#search h2 {
+ margin-bottom: 20px;
+}
+
+#s {
+ width: 140px;
+ margin-right: 5px;
+ padding: 3px;
+ border: 1px solid #BED99C;
+}
+
+#x {
+ padding: 3px;
+ border: none;
+ background: #8BD80E;
+ text-transform: lowercase;
+ font-size: 11px;
+ color: #FFFFFF;
+}
+
+/* Boxes */
+
+.box1 {
+ padding: 20px;
+}
+
+.box2 {
+ color: #BABABA;
+}
+
+.box2 h2 {
+ margin-bottom: 15px;
+ font-size: 16px;
+ color: #FFFFFF;
+}
+
+.box2 ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.box2 a:link, .box2 a:hover, .box2 a:active, .box2 a:visited {
+ color: #EDEDED;
+}
+
+/* Footer */
+#footer-wrap {
+}
+
+#footer {
+ margin: 0 auto;
+ padding: 20px 0 10px 0;
+ background: #000000;
+}
+
+html>body #footer {
+ height: auto;
+}
+
+#footer p {
+ font-size: 11px;
+}
+
+#legal {
+ clear: both;
+ padding-top: 17px;
+ text-align: center;
+ color: #FFFFFF;
+}
+
+#legal a {
+ font-weight: normal;
+ color: #FFFFFF;
+}
diff --git a/static/images/favicon.ico b/static/images/favicon.ico
new file mode 100644
index 0000000..bf53e8d
--- /dev/null
+++ b/static/images/favicon.ico
Binary files differ
diff --git a/static/images/img01.gif b/static/images/img01.gif
new file mode 100644
index 0000000..5f082bd
--- /dev/null
+++ b/static/images/img01.gif
Binary files differ
diff --git a/static/images/img02.gif b/static/images/img02.gif
new file mode 100644
index 0000000..45a3ae9
--- /dev/null
+++ b/static/images/img02.gif
Binary files differ
diff --git a/static/images/img03.gif b/static/images/img03.gif
new file mode 100644
index 0000000..d92ea38
--- /dev/null
+++ b/static/images/img03.gif
Binary files differ
diff --git a/static/images/img04.gif b/static/images/img04.gif
new file mode 100644
index 0000000..950c4af
--- /dev/null
+++ b/static/images/img04.gif
Binary files differ
diff --git a/static/images/portato.png b/static/images/portato.png
new file mode 100644
index 0000000..f83e039
--- /dev/null
+++ b/static/images/portato.png
Binary files differ
diff --git a/templates/menu.lst b/templates/menu.lst
new file mode 100644
index 0000000..4560d9b
--- /dev/null
+++ b/templates/menu.lst
@@ -0,0 +1,3 @@
+index
+download
+development
diff --git a/templates/page.mako b/templates/page.mako
new file mode 100644
index 0000000..4543cc0
--- /dev/null
+++ b/templates/page.mako
@@ -0,0 +1,14 @@
+<%!
+ title = ""
+%>
+
+<%inherit file="/root.mako" />
+
+<h1 class="title">${self.attr.title}</h1>
+<div class="entry">
+ ${next.body()}
+</div>
+
+<%def name="menu_name()">
+ ${self.attr.title}
+</%def>
diff --git a/templates/pages/development.mako b/templates/pages/development.mako
new file mode 100644
index 0000000..20fc521
--- /dev/null
+++ b/templates/pages/development.mako
@@ -0,0 +1,7 @@
+<%!
+ title = "Development"
+%>
+<%inherit file="/page.mako" />
+<p>
+Developers, Developers, Developers
+</p>
diff --git a/templates/pages/download.mako b/templates/pages/download.mako
new file mode 100644
index 0000000..87b1a6f
--- /dev/null
+++ b/templates/pages/download.mako
@@ -0,0 +1,7 @@
+<%!
+ title = "Download"
+%>
+<%inherit file="/page.mako" />
+<p>
+From somewhere...
+</p>
diff --git a/templates/pages/index.mako b/templates/pages/index.mako
new file mode 100644
index 0000000..6dec44b
--- /dev/null
+++ b/templates/pages/index.mako
@@ -0,0 +1,8 @@
+<%!
+ title = "Portato"
+%>
+<%inherit file="/page.mako" />
+
+<p>
+Hier haben wir als irgendwas über Portato.
+</p>
diff --git a/templates/root.mako b/templates/root.mako
new file mode 100644
index 0000000..97bd983
--- /dev/null
+++ b/templates/root.mako
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <link rel="shortcut icon" href=${"/favicon.ico" | w.url} type="image/icon">
+ <title>${self.title()}</title>
+ ${self.style()}
+ </head>
+
+ <body>
+ <div id="wrapper">
+ <div id="logo">
+ <img src=${"/images/portato.png" | w.url} />
+ <h1><a href="./">Portato</a></h1>
+ <h2>»   A Portage GUI</h2>
+ </div>
+
+ <div id="header">
+ <div id="menu">
+ ${self.menu()}
+ </div>
+ </div>
+ </div>
+
+ <div id="page">
+ <div id="content">
+ <div class="post">
+ ${next.body()}
+ </div>
+ </div>
+ <div style="clear: both;"> </div>
+ </div>
+ <div id="footer">
+ <p id="legal">
+ ${self.footer()}
+ </p>
+ </div>
+ </body>
+</html>
+
+<%def name="title()">
+ Portato
+</%def>
+
+<%def name="style()">
+ <link href=${"/css/style.css" | w.url} rel="stylesheet" type="text/css" />
+</%def>
+
+<%def name="footer()">
+ powered by <a href="http://www.webpy.org">web.py</a> & <a href="http://www.makotemplates.org">mako</a> |
+ © 2009. All Rights Reserved. René Neumann |
+ with the help of <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.
+</%def>
+
+<%def name="menu()">
+ <ul>
+ % for page, uri in menulist:
+ <li class="current_page_item"><a href="${page}">${local.get_namespace(uri).menu_name()}</a></li>
+ % endfor
+ </ul>
+</%def>