Rewrite session Part 1

This commit is contained in:
Stefan Ritter 2009-05-17 23:19:07 +02:00
parent af872acbd3
commit a38cb989fa
4 changed files with 237 additions and 121 deletions

View File

@ -6,7 +6,8 @@
# To Public License, Version 2, as published by Sam Hocevar. See # To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details. # http://sam.zoy.org/wtfpl/COPYING for more details.
# Author: Stefan Ritter <xeno@thehappy.de> # Authors: Stefan Ritter <xeno@thehappy.de>
# Adrian Vondendriesch <disco-stu@disco-stu.de>
# Description: A simple blogging software # Description: A simple blogging software
import cgi, os, time, glob, re, md5, sys, random import cgi, os, time, glob, re, md5, sys, random
@ -190,6 +191,7 @@ if feed_display == "atom":
# Generate regular page # Generate regular page
else: else:
document_header("xhtml-transitional") document_header("xhtml-transitional")
# XHTML Header
print ' <head>' print ' <head>'
print ' <title>' + blog_title + '</title>' print ' <title>' + blog_title + '</title>'
print ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />' print ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />'
@ -198,65 +200,93 @@ else:
print ' <link rel="stylesheet" type="text/css" href="styles/' + style + '" />' print ' <link rel="stylesheet" type="text/css" href="styles/' + style + '" />'
print ' </head>' print ' </head>'
print ' <body>' print ' <body>'
print ' <div class="title"><a href="?" class="title">' + blog_title + '</a></div>' print ''
print ' <div class="feeds">' # Site header
print ' <a href="?feed=rss"><img src="styles/images/rss.png" alt="rss" /></a>' print ' <div class="header">'
print ' <a href="?feed=atom"><img src="styles/images/atom.png" alt="atom" /></a>' print ' <div class="header_title">'
print ' <a href="?" class="header_link">' + blog_title + '</a>'
print ' </div>' print ' </div>'
print ' </div>'
print ''
# RSS feed
print ' <div class="rss">'
if os.path.exists('styles/' + style.replace('.css', '') + '_img/rss.jpg'):
print ' <a href="?feed=rss"><img src="styles/' + style.replace('.css', '') + '_img/rss.jpg"></a>'
else:
print ' <a href="?feed=rss" class="rss_link">rss</a>'
print ' </div>'
print ''
# Atom feed
print ' <div class="atom">'
if os.path.exists('styles/' + style.replace('.css', '') + '_img/atom.jpg'):
print ' <a href="?feed=atom"><img src="styles/' + style.replace('.css', '') + '_img/atom.jpg></a>'
else:
print ' <a href="?feed=atom" class="atom_link">atom</a>'
print ' </div>'
print ''
print ' <div class="screen"><div class="sidebar">' # Staticpages
# Sidebar: Staticpages
if staticpages == "True": if staticpages == "True":
staticpages = [] staticpages = []
staticpages_list = glob.glob(staticpages_dir + '*') staticpages_list = glob.glob(staticpages_dir + '*')
staticpages_list.sort() staticpages_list.sort()
print ' <div class="sidebarentry">' print ' <div class="pages">'
print ' <small>pages</small><br />' print ' <div class="pages_title">pages</div>'
print ' <div class="pages_list">'
print ' <ul class="pages_list">'
for staticpage in staticpages_list: for staticpage in staticpages_list:
title = re.sub('\w+?\/\d+?-', '', staticpage) title = re.sub('\w+?\/\d+?-', '', staticpage)
link = re.sub('\w+?\/', '', staticpage) link = re.sub('\w+?\/', '', staticpage)
# The ultimative lookshe-hack *g* print ' <li class="pages_list_entry"><a href="?s=' + link + '" class="pages_list_entry">' + title + '</a></li>'
if title == "lookshe": print ' </ul>'
print ' &nbsp;<a href="?s=' + link + '">/me</a>&nbsp;<br />'
else:
print ' &nbsp;<a href="?s=' + link + '">' + title + '</a>&nbsp;<br />'
if monthlist == "True": print ' <br />'
print ' </div>' print ' </div>'
print ' <div class="pages_footer"></div>'
print ' </div>'
print ''
# Sidebar: Monthlist # Monthlist
if monthlist == "True": if monthlist == "True":
olddate = "" olddate = ""
print ' <div class="sidebarentry">' print ' <div class="months">'
print ' <small>months</small><br />' print ' <div class="months_title">months</div>'
print ' <div class="months_list">'
print ' <ul class="months_list">'
for entry in entries: for entry in entries:
date = time.strftime("%m%Y", entry[0]) date = time.strftime("%m%Y", entry[0])
date_display = time.strftime("%h %Y", entry[0]) date_display = time.strftime("%h %Y", entry[0])
if not olddate == date: if not olddate == date:
print ' &nbsp;<a href="?m=' + date + '">' + date_display + '</a>&nbsp;<br />' print ' <li class="months_list_entry"><a href="?m=' + date + '" class="months_list_entry">' + date_display + '</a></li>'
olddate = date olddate = date
if linklist == "True": print ' <br />' print ' </ul>'
print ' </div>' print ' </div>'
print ' <div class="months_footer"></div>'
print ' </div>'
print ''
# Sidebar: Linklist # Linklist
if linklist == "True": if linklist == "True":
print ' <div class="sidebarentry">' print ' <div class="linklist">'
print ' <small>links</small><br />' print ' <div class="linklist_title">links</div>'
print ' <div class="linklist_list">'
print ' <ul class="linklist_list">'
try: try:
content = open("linklist", "r") content = open("linklist", "r")
for line in content: for line in content:
if line.strip() is "": if line.strip() is "":
print ' <br />' print ''
else: else:
print ' &nbsp;<a href="' + line.split(" ")[0] + '" target="_blank">' + line.split(" ", 1)[1].strip() + '</a>&nbsp;<br />' print ' <li class="linklist_list_entry"><a href="' + line.split(" ")[0] + '" target="_blank" class="months_list_entry">' + line.split(" ", 1)[1].strip() + '</a></li>'
content.close() content.close()
except: except:
print ' <br />' print ''
print ' </ul>'
print ' </div>' print ' </div>'
print ' <div class="linklist_footer"></div>'
print ' </div>'
print ''
print ' </div>'
print ' <div class="content">' print ' <div class="content">'
print '<br><br><br><br><br><br><br>'
if static_display != "": # Show Staticpage if static_display != "": # Show Staticpage
content = open(staticpages_dir + static_display, "r") content = open(staticpages_dir + static_display, "r")

View File

@ -1,107 +1,193 @@
.html, body { /*
background: #000; * Author: Adrian Vondendriesch <disco-stu@disco-stu.de>
color: #FFF; */
body {
font-family: Verdana, Times New Roman, Courier New;
font-size: 10px;
margin: 0px; margin: 0px;
overflow-x: hidden; padding: 0px;
} }
img { img {
border: 0; border: 0px;
} }
a:link, a:active, a:visited, a:hover { div.header {
font-family: Verdana; height: 120px;
font-size: 12px; width: 99%;
color: #FC3;
text-decoration: none;
}
a.title:link, a.title:hover, a.title:active, a.title:visited {
position: absolute;
text-align: center;
width: 100%;
height: 25px;
background-image: url(blogthon_img/title_background.png);
font-family: Verdana;
font-weight: bold;
font-size: 18px;
color: #FC3;
}
.screen {
position: relative;
margin: auto; margin: auto;
top: 30px; margin-top: 5px;
text-align: center;
display: table;
border: 3px double #000000;
background-image: url("blogthon_img/header_background.jpg");
background-repeat: no-repeat;
} }
.content { /* Container for entrytitle and entry */ div.header_title {
margin-left: 15px; font-size: 18px;
letter-spacing: 5px;
vertical-align: middle;
display: table-cell;
} }
.entrytitle { div.header_subtitle {
font-family: Verdana; font-size: 14px;
vertical-align: middle;
}
a.header_link {
text-decoration: none;
color: #395434;
font-weight: bold;
font-style: italic;
}
div.rss {
display: inline;
height: 25px;
position: absolute;
top: 15px;
right: 41px;
}
a.rss_link {
text-decoration: none;
color: #AAAAAA;
}
div.atom {
display: inline;
height: 25px;
position: absolute;
top: 15px;
right: 14px;
}
a.atom_link {
text-decoration: none;
color: #AAAAAA;
}
div.pages {
width: 100%;
position: absolute;
top: 110px;
}
div.pages_title {
text-align: center;
display: none;
font-weight: bold; font-weight: bold;
font-size: 14px; font-size: 14px;
color: #335599; letter-spacing: 2px;
text-decoration: underline;
} }
a.entrytitle:link, a.entrytitle:hover, a.entrytitle:visited, a.entrytitle:active { div.pages_list {
font-family: Verdana;
font-weight: bold;
font-size: 12px;
color: #335599;
text-decoration: underline;
} }
.entry { ul.pages_list {
font-family: Verdana;
font-size: 12px;
color: #FFF;
margin: 15px;
width: 600px;
}
.sidebar {
margin-right: 15px;
margin-left: 20px;
margin-bottom: 20px;
float: right;
}
.sidebarentry {
font-family: Verdana;
font-size: 12px;
color: #5577BB;
text-align: center; text-align: center;
padding-left: 8px; list-style-type: none;
padding-right: 8px; margin-top: 0px;
background: #111; margin-bottom: 0px;
padding: 0px;
} }
a.comment:link, a.comment:hover, a.comment:active, a.comment:visited { li.pages_list_entry {
font-family: Helvetica; display: inline;
font-size: 10px; margin-right: 10px;
} }
input, textarea { a.pages_list_entry {
font-family: Verdana; color: #000000;
font-size: 10px; text-decoration: none;
display: block; font-size: 12px;
width: 300px; font-style: italic;
background: #333;
color: #FFF;
border: thin dotted;
} }
input#submit { div.pages_footer {
width: 120px; float: none;
} }
.feeds { div.months {
position: absolute; width: 100px;
top: 4px; }
right: 5px;
div.months_title {
color: #999999;
font-weight: bold;
font-size: 14px;
letter-spacing: 1px;
}
div.months_list {
}
ul.months_list {
text-align: center;
list-style-type: none;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
margin-left: -40px;
}
li.months_list_entry {
margin-right: 10px;
}
a.months_list_entry {
color: #000000;
text-decoration: none;
font-size: 12px;
font-style: italic;
}
div.months_footer {
float: none;
}
div.linkslist {
width: 100px;
}
div.linklist_title {
color: #999999;
font-weight: bold;
font-size: 14px;
letter-spacing: 1px;
}
div.linklist_list {
}
ul.linklist_list {
text-align: center;
list-style-type: none;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
margin-left: -40px;
}
li.linklist_list_entry {
margin-right: 10px;
}
a.linklist_list_entry {
color: #000000;
text-decoration: none;
font-size: 12px;
font-style: italic;
}
div.linklist_footer {
float: none;
} }
# vim: set tw=0 ts=4:

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B