Rewrite session Part 2
This commit is contained in:
parent
0002b915cd
commit
b1fc650b1b
94
blogthon.cgi
94
blogthon.cgi
@ -285,17 +285,27 @@ else:
|
|||||||
print ' </div>'
|
print ' </div>'
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
print ' <div class="content">'
|
# Staticpage
|
||||||
|
if static_display != "":
|
||||||
if static_display != "": # Show Staticpage
|
|
||||||
content = open(staticpages_dir + static_display, "r")
|
content = open(staticpages_dir + static_display, "r")
|
||||||
print ' <div class="entrytitle">' + re.sub('\d+?-', '', static_display) + '</div>'
|
print ' <div class="entry">'
|
||||||
print ' <div class="entry"><p>'
|
print ' <div class="entry_title">' + re.sub('\d+?-', '', static_display) + '</div>'
|
||||||
|
print ' <div class="entry_content">'
|
||||||
|
print ' <p>'
|
||||||
for line in content:
|
for line in content:
|
||||||
print ' ' + line.strip() + '<br />'
|
print ' ' + line.strip() + '<br />'
|
||||||
print ' </p></div>'
|
print ' </p>'
|
||||||
|
print ' </div>'
|
||||||
|
print ' <div class="entry_footer"></div>'
|
||||||
|
print ' <div class="entry_comments"></div>'
|
||||||
|
print ' <div class="entry_border_left"></div>'
|
||||||
|
print ' <div class="entry_border_right"></div>'
|
||||||
|
print ' <div class="entry_border_top"></div>'
|
||||||
|
print ' <div class="entry_border_bottom"></div>'
|
||||||
|
print ' </div>'
|
||||||
content.close()
|
content.close()
|
||||||
else: # Show regular entry
|
# Entry
|
||||||
|
else:
|
||||||
entry_counter = 0
|
entry_counter = 0
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
date = time.strftime("%c", entry[0])
|
date = time.strftime("%c", entry[0])
|
||||||
@ -308,72 +318,82 @@ 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="entrytitle"><a href="?p=' + title + '" class="entrytitle">' + title + ' <small>(' + date + ')</small></a></div>'
|
print ' <div class="entry_title"><a href="?p=' + title + '" class="entry_title">' + title + '</a></div>'
|
||||||
else:
|
else:
|
||||||
print ' <div class="entrytitle">' + title + ' <small>(' + date + ')</small></div>'
|
print ' <div class="entry_title">' + title + '</div>'
|
||||||
print ' <div class="entry">'
|
print ' <div class="entry_content">'
|
||||||
for line in content:
|
for line in content:
|
||||||
print ' ' + line.strip() + '<br />'
|
print ' ' + line.strip() + '<br />'
|
||||||
|
print ' </div>'
|
||||||
# Comments are shown when post_display and comments_file
|
print ' <div class="entry_footer"></div>'
|
||||||
|
print ' <div class="entry_comments"></div>'
|
||||||
|
print ' <div class="entry_border_left"></div>'
|
||||||
|
print ' <div class="entry_border_right"></div>'
|
||||||
|
print ' <div class="entry_border_top"></div>'
|
||||||
|
print ' <div class="entry_border_bottom"></div>'
|
||||||
|
print ' </div>'
|
||||||
|
print ''
|
||||||
|
|
||||||
|
# Comments...
|
||||||
|
# ... are shown when post_display and comments_file isn't false
|
||||||
comments_file = glob.glob(entries_dir + title + '.comments')
|
comments_file = glob.glob(entries_dir + title + '.comments')
|
||||||
if post_display:
|
if post_display:
|
||||||
if comments_file:
|
if comments_file:
|
||||||
print ' <br /><hr />'
|
|
||||||
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 ' <div class="comments">'
|
||||||
for line in comments_content:
|
for line in comments_content:
|
||||||
if line.split(".", 1)[0] == "-":
|
if line.split(".", 1)[0] == "-":
|
||||||
print ' <br />'
|
print ' <div class="comments_author">' + line.split(".", 1)[1].strip() + '</div>'
|
||||||
print ' <b><i>' + line.split(".", 1)[1].strip() + '</i><small> wrote at '
|
|
||||||
elif line.split(".", 1)[0] == "+":
|
elif line.split(".", 1)[0] == "+":
|
||||||
print ' ' + line.split(".", 1)[1].strip() + ':</small></b><br />'
|
print ' <div class="comments_date">' + line.split(".", 1)[1].strip() + '</div>'
|
||||||
else:
|
else:
|
||||||
line = line.split(".", 1)[1]
|
line = line.split(".", 1)[1]
|
||||||
print ' ' + line.strip() + '<br />'
|
print ' <div class="comments_content">'
|
||||||
|
print ' ' + line.strip() + '<br />'
|
||||||
|
print ' </div>'
|
||||||
|
print ' </div>'
|
||||||
|
print ''
|
||||||
comments_content.close()
|
comments_content.close()
|
||||||
|
|
||||||
# Form for adding comments
|
# Form for adding comments
|
||||||
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 ' <br /><br /><br />'
|
print ' <input type="hidden" name="ctitle" value="' + title + '" />'
|
||||||
print ' <form action="" method="post">'
|
print ' <input type="hidden" name="cquizv" value="' + str(cquizv) + '" />'
|
||||||
print ' <input type="hidden" name="ctitle" value="' + title + '" />'
|
print ' <label for="cname">name:</label><input type="text" id="cname" name="cname" />'
|
||||||
print ' <input type="hidden" name="cquizv" value="' + str(cquizv) + '" />'
|
print ' <br /><label for="ctext">text:</label><textarea rows="5" cols="80" id="ctext" name="ctext"></textarea>'
|
||||||
print ' <label for="cname">name:</label><input type="text" id="cname" name="cname" />'
|
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="ctext">text:</label><textarea rows="5" cols="80" id="ctext" name="ctext"></textarea>'
|
print ' <br /><input type="submit" id="submit" value="post comment" />'
|
||||||
print ' <br /><label for="cquiz">' + str(random_int_a) + '+' + str(random_int_b) + '=</label><input type="text" id="cquiz" name="cquiz" />'
|
print ' </form>'
|
||||||
print ' <br /><input type="submit" id="submit" value="post comment" />'
|
|
||||||
print ' </form>'
|
|
||||||
|
|
||||||
if comments == "True":
|
if comments == "True":
|
||||||
comments_file = glob.glob(entries_dir + title + '.comments')
|
comments_file = glob.glob(entries_dir + title + '.comments')
|
||||||
if not comments_file and not post_display:
|
if not comments_file and not post_display:
|
||||||
print ' <div class="comment">'
|
print ' <div class="entry_comments">'
|
||||||
print ' <ul><li><a href="?p=' + title + '" class="comment">no comments</a></li></ul>'
|
print ' <a href="?p=' + title + '" class="entry_comments">no comments</a>'
|
||||||
print ' </div>'
|
print ' </div>'
|
||||||
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
|
||||||
for line in comments_content:
|
for line in comments_content:
|
||||||
if line.split(".", 1)[0] == "-": comments_counter += 1
|
if line.split(".", 1)[0] == "-": comments_counter += 1
|
||||||
print ' <div class="comment">'
|
print ' <div class="entry_comments">'
|
||||||
print ' <ul><li><a href="?p=' + title + '" class="comment">comments (' + str(comments_counter) + ')</a></li></ul>'
|
print ' <a href="?p=' + title + '" class="entry_comments">comments (' + str(comments_counter) + ')</a>'
|
||||||
print ' </div>'
|
print ' </div>'
|
||||||
comments_content.close()
|
comments_content.close()
|
||||||
|
|
||||||
print ' </div>'
|
|
||||||
print ' <br /><br />'
|
|
||||||
content.close()
|
content.close()
|
||||||
entry_counter += 1
|
entry_counter += 1
|
||||||
|
|
||||||
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></div>'
|
print ''
|
||||||
print ' </body>'
|
print ' </body>'
|
||||||
print '</html>'
|
print '</html>'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user