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
# 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
import cgi, os, time, glob, re, md5, sys, random
@ -190,6 +191,7 @@ if feed_display == "atom":
# Generate regular page
else:
document_header("xhtml-transitional")
# XHTML Header
print ' <head>'
print ' <title>' + blog_title + '</title>'
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 ' </head>'
print ' <body>'
print ' <div class="title"><a href="?" class="title">' + blog_title + '</a></div>'
print ' <div class="feeds">'
print ' <a href="?feed=rss"><img src="styles/images/rss.png" alt="rss" /></a>'
print ' <a href="?feed=atom"><img src="styles/images/atom.png" alt="atom" /></a>'
print ''
# Site header
print ' <div class="header">'
print ' <div class="header_title">'
print ' <a href="?" class="header_link">' + blog_title + '</a>'
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">'
# Sidebar: Staticpages
# Staticpages
if staticpages == "True":
staticpages = []
staticpages_list = glob.glob(staticpages_dir + '*')
staticpages_list.sort()
print ' <div class="sidebarentry">'
print ' <small>pages</small><br />'
print ' <div class="pages">'
print ' <div class="pages_title">pages</div>'
print ' <div class="pages_list">'
print ' <ul class="pages_list">'
for staticpage in staticpages_list:
title = re.sub('\w+?\/\d+?-', '', staticpage)
link = re.sub('\w+?\/', '', staticpage)
# The ultimative lookshe-hack *g*
if title == "lookshe":
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 ' <li class="pages_list_entry"><a href="?s=' + link + '" class="pages_list_entry">' + title + '</a></li>'
print ' </ul>'
print ' </div>'
print ' <div class="pages_footer"></div>'
print ' </div>'
print ''
# Sidebar: Monthlist
# Monthlist
if monthlist == "True":
olddate = ""
print ' <div class="sidebarentry">'
print ' <small>months</small><br />'
print ' <div class="months">'
print ' <div class="months_title">months</div>'
print ' <div class="months_list">'
print ' <ul class="months_list">'
for entry in entries:
date = time.strftime("%m%Y", entry[0])
date_display = time.strftime("%h %Y", entry[0])
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
if linklist == "True": print ' <br />'
print ' </ul>'
print ' </div>'
print ' <div class="months_footer"></div>'
print ' </div>'
print ''
# Sidebar: Linklist
# Linklist
if linklist == "True":
print ' <div class="sidebarentry">'
print ' <small>links</small><br />'
print ' <div class="linklist">'
print ' <div class="linklist_title">links</div>'
print ' <div class="linklist_list">'
print ' <ul class="linklist_list">'
try:
content = open("linklist", "r")
for line in content:
if line.strip() is "":
print ' <br />'
print ''
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()
except:
print ' <br />'
print ''
print ' </ul>'
print ' </div>'
print ' <div class="linklist_footer"></div>'
print ' </div>'
print ''
print ' </div>'
print ' <div class="content">'
print '<br><br><br><br><br><br><br>'
if static_display != "": # Show Staticpage
content = open(staticpages_dir + static_display, "r")

View File

@ -1,107 +1,193 @@
.html, body {
background: #000;
color: #FFF;
/*
* Author: Adrian Vondendriesch <disco-stu@disco-stu.de>
*/
body {
font-family: Verdana, Times New Roman, Courier New;
font-size: 10px;
margin: 0px;
overflow-x: hidden;
}
padding: 0px;
}
img {
border: 0;
}
border: 0px;
}
a:link, a:active, a:visited, a:hover {
font-family: Verdana;
font-size: 12px;
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;
div.header {
height: 120px;
width: 99%;
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 */
margin-left: 15px;
}
div.header_title {
font-size: 18px;
letter-spacing: 5px;
vertical-align: middle;
display: table-cell;
}
.entrytitle {
font-family: Verdana;
div.header_subtitle {
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-size: 14px;
color: #335599;
text-decoration: underline;
}
letter-spacing: 2px;
}
a.entrytitle:link, a.entrytitle:hover, a.entrytitle:visited, a.entrytitle:active {
font-family: Verdana;
font-weight: bold;
font-size: 12px;
color: #335599;
text-decoration: underline;
}
div.pages_list {
}
.entry {
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;
ul.pages_list {
text-align: center;
padding-left: 8px;
padding-right: 8px;
background: #111;
}
list-style-type: none;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
a.comment:link, a.comment:hover, a.comment:active, a.comment:visited {
font-family: Helvetica;
font-size: 10px;
}
li.pages_list_entry {
display: inline;
margin-right: 10px;
}
input, textarea {
font-family: Verdana;
font-size: 10px;
display: block;
width: 300px;
background: #333;
color: #FFF;
border: thin dotted;
}
a.pages_list_entry {
color: #000000;
text-decoration: none;
font-size: 12px;
font-style: italic;
input#submit {
width: 120px;
}
}
.feeds {
position: absolute;
top: 4px;
right: 5px;
}
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