From 1c3c306f45f3e18cc0174cd1ea9cca36f37696dc Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Sun, 16 Sep 2012 20:58:01 +0200 Subject: Add some stuff for the wiki --- public/css/sublab-2011-11-02.css | 330 -------------------------- public/css/sublab-2012-09-16.css | 376 ++++++++++++++++++++++++++++++ scripts/template.py | 10 +- scripts/wikitemplate.py | 94 ++++++++ template/pages/wiki_template/content.html | 165 +++++++++++++ template/template/template.html | 12 +- 6 files changed, 648 insertions(+), 339 deletions(-) delete mode 100644 public/css/sublab-2011-11-02.css create mode 100644 public/css/sublab-2012-09-16.css create mode 100755 scripts/wikitemplate.py create mode 100644 template/pages/wiki_template/content.html diff --git a/public/css/sublab-2011-11-02.css b/public/css/sublab-2011-11-02.css deleted file mode 100644 index 20e9c5b..0000000 --- a/public/css/sublab-2011-11-02.css +++ /dev/null @@ -1,330 +0,0 @@ -* { - padding: 0px; - margin: 0px; - font-family: Verdana, Helvetica, sans-serif; - font-size: 12px; - color: #ddd; - } - -iframe.youtube { - margin: 5px 15px 0px 15px; - width: 300px; - height: 235px; - border: 1px solid #444; - } - -iframe.osm { - margin: 5px 15px 0px 15px; - width: 500px; - height: 325px; - border: 1px solid #444; - scroll: no; - } - -body { - background: #000 url(../img/background.jpg) no-repeat fixed center center; - } - -div.frame { - border: 1px solid #aaa; - background-color: rgba(0, 0, 0, 0.75); - margin-left: auto; - margin-right: auto; - min-width: 700px; - max-width: 1500px; - position: relative; - } - -div.hiddenframe { - margin: 50px; - } - -div.logo { - float: left; - height: 150px; - width: 110px; - margin: 5px 5px 5px 5px; - border: 0px solid #222; - background: #000 url(../img/logo.png) no-repeat center center; - } - -div.image { - margin-top: 0px; - margin: 5px; - margin-left: 125px; - border: 1px solid #444; - height: 150px; - background: #000 url(../img/topimage.jpg) no-repeat left bottom; - } - -div.menu { - clear: both; - color: #fff; - border: 1px solid #444; - padding: 5px; - background-color: rgba(16, 16, 16, 0.5); - margin-left: 5px; - position: absolute; - top: 160px; - width: 100px; - min-height: 150px; - } - -div.content { - color: #fff; - border: 1px solid #444; - padding: 5px; - background-color: rgba(16, 16, 16, 0.5); - position: static; - margin: 0px 225px 5px 125px; - top: 160px; - min-height: 120px; - height: 100%; - } - -div.info { - color: #fff; - background-color: rgba(16, 16, 16, 0.5); - border: 1px solid #444; - padding: 5px; - margin-right: 5px; - margin-bottom: 5px; - width: 200px; - position: absolute; - right: 0px; - min-height: 200px; - } - -div.status { - width: 180px; - margin-left: 10px; - margin-right: 10px; - } - -div.footer { - clear: both; - background-color: rgba(16, 16, 16, 0.5); - color: #fff; - border: 1px solid #444; - padding: 5px; - margin: 5px; - text-align: center; - } - -.imagecontent { - clear: both; - float: right; - margin: 5px 10px 5px 10px; - width: 35%; - min-width: 150px; - } - -img { - border: 1px solid #444; - } - -img.webcam { - border: 1px solid #444; - width: 400px; - margin: 5px 5px 0px 15px; - } - -img.logo { - height: 140px; - width: auto; - border: 0px; - } - -img.webcamthumb { - margin: 10px; - border: 1px solid #444; - width: 180px; - height: auto; - } - -.contentimage { - width: 95%; - height: auto; - margin: 0px 5px 0px 5px; - border: 2px solid #444; - } - -img.bigimage { - width: 100%; - max-width: 640px; - margin-left: auto; - margin-right: auto; - display: block; - } - -.floatright { - float: right; - } - -.floatleft { - float: left; - } - -table { - width: 200px; - margin: auto; - } - -hr { - margin: 10px; - color: #ddd; - clear: both; - } - -ul { - margin-left: 40px; - } - -#menu { - list-style: none; - margin: 5px; - } - -#menu a { - text-decoration: none; - font-weight: bold; - line-height: 15px; - border: 0px; - color: #ddd; - } - -#menu a:hover { - text-decoration: none; - font-weight: bold; - color: #fff; - } - -#menu a:active { - text-decoration: none; - font-weight: bold; - color: #bbb; - } - -h1 { - text-align: center; - visibility: hidden; - } - -h3 { - /*clear: both;*/ - font-size: 14px; - text-align: left; - color: #ddd; - line-height: 20px; - margin: 15px 10px 5px 10px; - } - -h4 { - line-height: 25px; - text-align: center; - color: #ddd; - margin-top: 5px; - } - -h2 { - font-size: 18px; - line-height: 40px; - margin-left: 10px; - color: #ddd; - } - -p { - margin: 5px 15px 5px 15px; - color: #ddd; - line-height: 20px; - } - -p.subtext { - color: #ddd; - line-height: 12px; - margin: 2px 5px 5px 15px; - } - -p.header { - text-align: right; - margin: 10px; - } - -span.header { - background-color: rgba(16, 16, 16, 0.75); - padding: 5px 10px 5px 10px; - } - -.statusinfo { - line-height: 20px; - } - -.status { - line-height: 20px; - margin-left: 10px; - margin-right: 10px; - } - -.member { - line-height: 20px; - font-weight: bold; - margin-left: 10px; - margin-right: 10px; - text-align: center; - } - -a { - text-decoration: none; - border-bottom: 1px dotted; - color: #ddd; - } - -a:hover { - text-decoration: none; - color: #fff; - } - -a:active { - text-decoration: none; - color: #bbb; - } - -a.img { - text-decoration: none; - border: 0px; - color: #ddd; - } - -a.img:hover { - text-decoration: none; - color: #bbb; - } - -a.img:active { - text-decoration: none; - color: #999; - } - -span { - border: 1px solid #222; - padding: 2px; - } - -.olFramedCloudPopupContent h2 { - color: #000000; - font-size: 14px; - } - -.olFramedCloudPopupContent p { - color: #000000; - font-size: 12px; - } - -.olFramedCloudPopupContent a { - color: #3333FF; - font-size: 14px; - } - -#mapdiv img { - border: 0px; - } diff --git a/public/css/sublab-2012-09-16.css b/public/css/sublab-2012-09-16.css new file mode 100644 index 0000000..7f55d01 --- /dev/null +++ b/public/css/sublab-2012-09-16.css @@ -0,0 +1,376 @@ +* { + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + color: #ddd; + } + +iframe.youtube { + margin: 5px 15px 0px 15px; + width: 300px; + height: 235px; + border: 1px solid #444; + } + +iframe.osm { + margin: 5px 15px 0px 15px; + width: 500px; + height: 325px; + border: 1px solid #444; + scroll: no; + } + +body { + background: #000 url(../img/background.jpg) no-repeat fixed center center; + } + +div.frame { + border: 1px solid #aaa; + background-color: rgba(0, 0, 0, 0.75); + margin-left: auto; + margin-right: auto; + min-width: 700px; + max-width: 1500px; + position: relative; + } + +div.hiddenframe { + margin: 50px; + } + +div.logo { + float: left; + height: 150px; + width: 110px; + margin: 5px 5px 5px 5px; + border: 0px solid #222; + background: #000 url(../img/logo.png) no-repeat center center; + } + +div.image { + margin-top: 0px; + margin: 5px; + margin-left: 125px; + border: 1px solid #444; + height: 150px; + background: #000 url(../img/topimage.jpg) no-repeat left bottom; + } + +div.menu { + clear: both; + color: #fff; + border: 1px solid #444; + padding: 5px; + background-color: rgba(16, 16, 16, 0.5); + margin-left: 5px; + position: absolute; + top: 160px; + width: 100px; + min-height: 150px; + } + +div.content { + color: #fff; + border: 1px solid #444; + padding: 5px; + background-color: rgba(16, 16, 16, 0.5); + position: static; + margin: 0px 225px 5px 125px; + top: 160px; + min-height: 120px; + height: 100%; + } + +div.info { + color: #fff; + background-color: rgba(16, 16, 16, 0.5); + border: 1px solid #444; + padding: 5px; + margin-right: 5px; + margin-bottom: 5px; + width: 200px; + position: absolute; + right: 0px; + min-height: 200px; + } + +div.status { + width: 180px; + margin-left: 10px; + margin-right: 10px; + } + +div.footer { + clear: both; + background-color: rgba(16, 16, 16, 0.5); + color: #fff; + border: 1px solid #444; + padding: 5px; + margin: 5px; + text-align: center; + } + +.imagecontent { + clear: both; + float: right; + margin: 5px 10px 5px 10px; + width: 35%; + min-width: 150px; + } + +img { + border: 1px solid #444; + } + +img.webcam { + border: 1px solid #444; + width: 400px; + margin: 5px 5px 0px 15px; + } + +img.logo { + height: 140px; + width: auto; + border: 0px; + } + +img.webcamthumb { + margin: 10px; + border: 1px solid #444; + width: 180px; + height: auto; + } + +.contentimage { + width: 95%; + height: auto; + margin: 0px 5px 0px 5px; + border: 2px solid #444; + } + +img.bigimage { + width: 100%; + max-width: 640px; + margin-left: auto; + margin-right: auto; + display: block; + } + +.floatright { + float: right; + } + +.floatleft { + float: left; + } + +table { + width: 200px; + margin: auto; + } + +hr { + margin: 10px; + color: #ddd; + clear: both; + } + +#menu { + list-style: none; + margin: 5px; + padding: 0px; + } + +#menu a { + text-decoration: none; + font-weight: bold; + line-height: 15px; + border: 0px; + color: #ddd; + } + +#menu a:hover { + text-decoration: none; + font-weight: bold; + color: #fff; + } + +#menu a:active { + text-decoration: none; + font-weight: bold; + color: #bbb; + } + +h1 { + text-align: center; + visibility: hidden; + } + +h3 { + /*clear: both;*/ + font-size: 14px; + text-align: left; + color: #ddd; + line-height: 20px; + margin: 15px 10px 5px 10px; + } + +h4 { + line-height: 25px; + text-align: center; + color: #ddd; + margin-top: 5px; + } + +h2 { + font-size: 18px; + line-height: 40px; + margin-left: 10px; + color: #ddd; + } + +p { + margin: 5px 15px 5px 15px; + color: #ddd; + line-height: 20px; + } + +p.subtext { + color: #ddd; + line-height: 12px; + margin: 2px 5px 5px 15px; + } + +p.header { + text-align: right; + margin: 10px; + } + +span.header { + background-color: rgba(16, 16, 16, 0.75); + padding: 5px 10px 5px 10px; + } + +.statusinfo { + line-height: 20px; + } + +.status { + line-height: 20px; + margin-left: 10px; + margin-right: 10px; + } + +.member { + line-height: 20px; + font-weight: bold; + margin-left: 10px; + margin-right: 10px; + text-align: center; + } + +a { + text-decoration: none; + border-bottom: 1px dotted; + color: #ddd; + } + +a:hover { + text-decoration: none; + color: #fff; + } + +a:active { + text-decoration: none; + color: #bbb; + } + +a.img { + text-decoration: none; + border: 0px; + color: #ddd; + } + +a.img:hover { + text-decoration: none; + color: #bbb; + } + +a.img:active { + text-decoration: none; + color: #999; + } + +span.box { + border: 1px solid #222; + padding: 2px; + } + +.olFramedCloudPopupContent h2 { + color: #000000; + font-size: 14px; + } + +.olFramedCloudPopupContent p { + color: #000000; + font-size: 12px; + } + +.olFramedCloudPopupContent a { + color: #3333FF; + font-size: 14px; + } + +#mapdiv img { + border: 0px; + } + +/* These are for the wiki */ +div.page { + border: none; + margin: 0px; + margin-right: 1em; +} + +.actions ul { + text-align: right; + margin-top: -3px; +} +.actions li { + display: inline; + padding: 2px; + border-style: solid; + border-width: 1px; + border-top-width: 0px; + border-color: #444; + background-color: rgba(16,16,16,0.5); +} + +.actions a { + border-bottom: 0px; +} + +div.pageheader { + margin-left: 10px; +} + +div.pagedate { + text-align: right; +} + +span.title, span.parentlinks, .parentlinks a { + font-size: 18px; + font-weight: bold; + line-height: 40px; +} + +span.title:after { + content: " ]"; +} + +span.parentlinks:before { + content: "[ "; +} + +textarea, input, select { + background-color: #101010; +} diff --git a/scripts/template.py b/scripts/template.py index 2cfdf79..f6b073e 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -27,9 +27,11 @@ class Page: data = {"content.html":"", "keywords":"", "desc_de":"", "desc_en":""} for c in data: - f = open(os.path.join(pagepath, name, c), "r") - data[c] = f.read() - f.close + try: + with open(os.path.join(pagepath, name, c), "r") as f: + data[c] = f.read() + except Exception: + sys.excepthook(*sys.exc_info()) self._data = plugin.plugin_manager.process_content(data) @@ -104,6 +106,8 @@ if __name__ == '__main__': if __name__ == '__main__': for page in os.listdir(pagepath): + if page.endswith('_template'): + continue Page(page).render_and_save() if verbose: print "%s.html written" % page diff --git a/scripts/wikitemplate.py b/scripts/wikitemplate.py new file mode 100755 index 0000000..612219e --- /dev/null +++ b/scripts/wikitemplate.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +#Filename: newtemp.py +#Author: stayawake@lavabit.com +# --- +# Copyright (C) 2011 Christian Franke +# +# Permission is hereby granted to use and distribute this +# file for any purpose, provided the above copyright notice +# is kept in place. +# + +import imp +import os +import os.path +import sys +import getopt +import time +import datetime +from string import Template +import ConfigParser + +import plugin +import template + +class WikiTemplate(template.Page): + def __init__(self): + template.Page.__init__(self, 'wiki_template') + + @property + def html(self): + #create template-string + htmltext = Template(htmltemplate) + htmltext = htmltext.substitute( + template_date = '', #', + template_chattopic = topic, + template_keywords = self._data["keywords"], + template_content = self._data["content.html"], + template_desc_de = self._data["desc_de"], + template_desc_en = self._data["desc_en"] + ) + return htmltext + +configfile = "template.conf" +verbose = False +opts, args = getopt.getopt(sys.argv[1:], "c:vh", ["config=", "verbose", "help"]) +for opt, arg in opts: + if opt in ("-c", "--config"): + configfile = arg + elif opt in ("-v", "--verbose"): + verbose = True + elif opt in ("-h", "--help"): + print >>sys.stderr, "Please read the non-existing man page for further assistance" + sys.exit(0) + +basedir = os.path.dirname(os.path.abspath(__file__)) + +def makeabs(path): + if not os.path.isabs(path): + return os.path.join(basedir, path) + return path + +configfile = makeabs(configfile) +config = ConfigParser.ConfigParser() +config.read(configfile) + +path = makeabs(config.get("Default", "path")) +targetdir = makeabs(config.get("Default", "target")) +pagepath = os.path.join(path, "pages") +templatepath = os.path.join(path, "template") +topicpath = os.path.join(path, "topic") + +#set template +htmltemplate = open(os.path.join(templatepath, "template.html"), "r").read() +topic = open(os.path.join(topicpath, "topic"), "r").read() +datenow = time.strftime("%Y-%m-%dT%H:%M:%S +0100") + +if __name__ == '__main__': + if verbose: + print >>sys.stderr, "Pagepath: %s" % pagepath + print >>sys.stderr, "Templatepath: %s" % templatepath + print >>sys.stderr, "topicpath: %s" % topicpath + print >>sys.stderr, "datenow: %s" % datenow + + pluginlist = config.items('Plugins') + for pluginname, pluginarg in pluginlist: + modinfo = imp.find_module(pluginname) + try: + imp.load_module(pluginname, *modinfo) + finally: + modinfo[0].close() + + print WikiTemplate().html + +# vi: noexpandtab:tabstop=8:shiftwidth=8 diff --git a/template/pages/wiki_template/content.html b/template/pages/wiki_template/content.html new file mode 100644 index 0000000..06ee5e6 --- /dev/null +++ b/template/pages/wiki_template/content.html @@ -0,0 +1,165 @@ +
+ +
+ + + +
+ + + +/ + + + + + + (%) + + + + + + +
+ + + + + + + + +
+ +
+ +
+ + + +
+ + + + +
Comments on this page are closed.
+
+
+
+
+ + + +
+ + + + + + + +
+ +License: +
+
+ +
+Last edited + +
+ + + + + +
+ +
diff --git a/template/template/template.html b/template/template/template.html index 344af80..14ee17e 100644 --- a/template/template/template.html +++ b/template/template/template.html @@ -15,7 +15,7 @@ - + @@ -32,7 +32,7 @@

- [ mate und technik ] + [ mate und technik ]

Das sublab - ein Hackerspace in Leipzig @@ -93,7 +93,7 @@ sublab: - Open  Closed + Open  Closed @@ -104,7 +104,7 @@ Taifun: - Online  Offline + Online  Offline @@ -112,7 +112,7 @@ Trieste: - Online  Offline + Online  Offline @@ -120,7 +120,7 @@ Nautilus: - Online  Offline + Online  Offline -- cgit v1.2.1