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