Rewrite session Part 3

This commit is contained in:
Stefan Ritter 2009-05-18 21:08:37 +02:00
parent b1fc650b1b
commit 03a1d02ee3

View File

@ -285,10 +285,11 @@ else:
print ' </div>' print ' </div>'
print '' print ''
print ' <div class="entries">'
print ''
# Staticpage # Staticpage
if static_display != "": if static_display != "":
content = open(staticpages_dir + static_display, "r") content = open(staticpages_dir + static_display, "r")
print ' <div class="entry">'
print ' <div class="entry_title">' + re.sub('\d+?-', '', static_display) + '</div>' print ' <div class="entry_title">' + re.sub('\d+?-', '', static_display) + '</div>'
print ' <div class="entry_content">' print ' <div class="entry_content">'
print ' <p>' print ' <p>'
@ -302,7 +303,6 @@ else:
print ' <div class="entry_border_right"></div>' print ' <div class="entry_border_right"></div>'
print ' <div class="entry_border_top"></div>' print ' <div class="entry_border_top"></div>'
print ' <div class="entry_border_bottom"></div>' print ' <div class="entry_border_bottom"></div>'
print ' </div>'
content.close() content.close()
# Entry # Entry
else: else:
@ -318,7 +318,6 @@ else:
if post_display == title or not post_display: if post_display == title or not post_display:
if allentries_display == "1" or entry_counter < entries_per_page: if allentries_display == "1" or entry_counter < entries_per_page:
content = open(entry, "r") content = open(entry, "r")
print ' <div class="entry">'
if permalinks: if permalinks:
print ' <div class="entry_title"><a href="?p=' + title + '" class="entry_title">' + title + '</a></div>' print ' <div class="entry_title"><a href="?p=' + title + '" class="entry_title">' + title + '</a></div>'
else: else:
@ -333,8 +332,6 @@ else:
print ' <div class="entry_border_right"></div>' print ' <div class="entry_border_right"></div>'
print ' <div class="entry_border_top"></div>' print ' <div class="entry_border_top"></div>'
print ' <div class="entry_border_bottom"></div>' print ' <div class="entry_border_bottom"></div>'
print ' </div>'
print ''
# Comments... # Comments...
# ... are shown when post_display and comments_file isn't false # ... are shown when post_display and comments_file isn't false
@ -343,6 +340,9 @@ else:
if comments_file: if comments_file:
comments_file = glob.glob(entries_dir + title + '.comments') comments_file = glob.glob(entries_dir + title + '.comments')
comments_content = open(comments_file[0], "r") comments_content = open(comments_file[0], "r")
print ''
print ' </div>'
print ''
print ' <div class="comments">' print ' <div class="comments">'
for line in comments_content: for line in comments_content:
if line.split(".", 1)[0] == "-": if line.split(".", 1)[0] == "-":
@ -354,7 +354,6 @@ else:
print ' <div class="comments_content">' print ' <div class="comments_content">'
print ' ' + line.strip() + '<br />' print ' ' + line.strip() + '<br />'
print ' </div>' print ' </div>'
print ' </div>'
print '' print ''
comments_content.close() comments_content.close()
@ -362,14 +361,15 @@ else:
random_int_a = random.randint(1,9) random_int_a = random.randint(1,9)
random_int_b = random.randint(1,9) random_int_b = random.randint(1,9)
cquizv = random_int_a + random_int_b cquizv = random_int_a + random_int_b
print ' <form action="" method="post">' print ' <form action="" method="post">'
print ' <input type="hidden" name="ctitle" value="' + title + '" />' print ' <input type="hidden" name="ctitle" value="' + title + '" />'
print ' <input type="hidden" name="cquizv" value="' + str(cquizv) + '" />' print ' <input type="hidden" name="cquizv" value="' + str(cquizv) + '" />'
print ' <label for="cname">name:</label><input type="text" id="cname" name="cname" />' print ' <label for="cname">name:</label><input type="text" id="cname" name="cname" />'
print ' <br /><label for="ctext">text:</label><textarea rows="5" cols="80" id="ctext" name="ctext"></textarea>' print ' <br /><label for="ctext">text:</label><textarea rows="5" cols="80" id="ctext" name="ctext"></textarea>'
print ' <br /><label for="cquiz">' + str(random_int_a) + '+' + str(random_int_b) + '=</label><input type="text" id="cquiz" name="cquiz" />' print ' <br /><label for="cquiz">' + str(random_int_a) + '+' + str(random_int_b) + '=</label><input type="text" id="cquiz" name="cquiz" />'
print ' <br /><input type="submit" id="submit" value="post comment" />' print ' <br /><input type="submit" id="submit" value="post comment" />'
print ' </form>' print ' </form>'
print ''
if comments == "True": if comments == "True":
comments_file = glob.glob(entries_dir + title + '.comments') comments_file = glob.glob(entries_dir + title + '.comments')
@ -377,6 +377,7 @@ else:
print ' <div class="entry_comments">' print ' <div class="entry_comments">'
print ' <a href="?p=' + title + '" class="entry_comments">no comments</a>' print ' <a href="?p=' + title + '" class="entry_comments">no comments</a>'
print ' </div>' print ' </div>'
print ''
elif comments_file and not post_display: elif comments_file and not post_display:
comments_content = open(comments_file[0], "r") comments_content = open(comments_file[0], "r")
comments_counter = 0 comments_counter = 0
@ -385,6 +386,7 @@ else:
print ' <div class="entry_comments">' print ' <div class="entry_comments">'
print ' <a href="?p=' + title + '" class="entry_comments">comments (' + str(comments_counter) + ')</a>' print ' <a href="?p=' + title + '" class="entry_comments">comments (' + str(comments_counter) + ')</a>'
print ' </div>' print ' </div>'
print ''
comments_content.close() comments_content.close()
content.close() content.close()
@ -393,6 +395,7 @@ else:
if not month_display and not post_display and not allentries_display and entry_counter == entries_per_page: # Display pagelist if not month_display and not post_display and not allentries_display and entry_counter == entries_per_page: # Display pagelist
print ' <div class="entry"><a href=?a=1>View all entries...</a></div>' print ' <div class="entry"><a href=?a=1>View all entries...</a></div>'
print ' </div>'
print '' print ''
print ' </body>' print ' </body>'
print '</html>' print '</html>'