diff --git a/js/postboxes.js b/js/postboxes.js index 1503434..f538e72 100644 --- a/js/postboxes.js +++ b/js/postboxes.js @@ -8,8 +8,8 @@ function revealPostReplyBox(post_id) { textarea = document.createElement("textarea") textarea.setAttribute("class", "directReplyBox") - textarea.setAttribute("id", "postBody") - textarea.setAttribute("name", "postBody") + textarea.setAttribute("id", "postContent") + textarea.setAttribute("name", "postContent") textarea.setAttribute("rows", "10") textarea.setAttribute("cols", "50") textarea.value = ">>" + post_id + " \n" diff --git a/server.py b/server.py index 7bffc66..1107962 100644 --- a/server.py +++ b/server.py @@ -730,6 +730,7 @@ class HTML(object): cherrypy.response.cookie["auth_hash"]["expires"] = 0 raise cherrypy.HTTPRedirect("/index") + @cherrypy.expose def setBookmark(self, bookmarkId=None, delBookmark=None): if "bookmarks" in cherrypy.request.cookie: @@ -751,6 +752,7 @@ class HTML(object): cherrypy.response.cookie["bookmarks"]["max-age"] = 34560000 raise cherrypy.HTTPRedirect("/index") + @cherrypy.expose def index(self, bookmarkId=None, delBookmark=None): database = sqlite3.connect(dbname) @@ -771,12 +773,12 @@ class HTML(object): pinned_threads = [thread for thread in threads if thread["pinned"]] if "bookmarks" in cookie: - loads = json.loads(cookie["bookmarks"].value) - bookmarked_threads = [thread for thread in threads if thread["thread_id"] in loads] + user_bookmarks = json.loads(cookie["bookmarks"].value) + bookmarked_threads = [thread for thread in threads if thread["thread_id"] in user_bookmarks] threads = [ thread for thread in threads if not thread["pinned"] - and not thread["thread_id"] in loads + and not thread["thread_id"] in user_bookmarks ] else: bookmarked_threads = [] @@ -796,6 +798,7 @@ class HTML(object): } return template.render(variables) + @cherrypy.expose def thread(self, id=None): if not id: @@ -822,6 +825,7 @@ class HTML(object): } return template.render(variables) + @cherrypy.expose def threadSubmit(self, title=None, postContent=None): database = sqlite3.connect(dbname) @@ -840,14 +844,21 @@ class HTML(object): @cherrypy.expose - def threadReply(self, postBody, threadId): + def threadReply(self, postContent=None, threadId=None): + if not threadId: + return "No thread ID provided." + elif not postContent: + return "Reply content is empty." database = sqlite3.connect(dbname) cookie = cherrypy.request.cookie if "username" in cookie and "auth_hash" in cookie: user = db.user_resolve(database, cookie["username"].value) if cookie["auth_hash"].value.lower() != user["auth_hash"]: return "Authorization info not correct." - db.thread_reply(database, user["user_id"], threadId, postBody) + if postContent.strip(): + db.thread_reply(database, user["user_id"], threadId, postContent) + else: + return "Post reply is empty." raise cherrypy.HTTPRedirect("/thread?id=" + threadId) return "User not logged in" diff --git a/templates/threadIndex.html b/templates/threadIndex.html index c759019..d160c5d 100644 --- a/templates/threadIndex.html +++ b/templates/threadIndex.html @@ -16,7 +16,7 @@ {% else %} Not logged in. {% endif %} - Set login info. + Manage login. {% if authorized_user %} @@ -45,6 +45,7 @@
{{ thread["reply_count"] }} replies; active {{ thread["last_mod"] }}
+ last active by {{ usermap[thread["author"]]["user_name"] }} {% endfor %} @@ -63,7 +64,8 @@
{{ thread["reply_count"] }} replies; active {{ thread["last_mod"] }}
- Unbookmark this thread. + last active by {{ usermap[thread["author"]]["user_name"] }} +
Unbookmark this thread. {% endfor %} @@ -82,7 +84,8 @@
{{ thread["reply_count"] }} replies; active {{ thread["last_mod"] }}
- Bookmark this thread. + last active by {{ usermap[thread["author"]]["user_name"] }} +
Bookmark this thread. {% endfor %} diff --git a/templates/threadLoad.html b/templates/threadLoad.html index 4aa1c72..612fdab 100644 --- a/templates/threadLoad.html +++ b/templates/threadLoad.html @@ -18,9 +18,11 @@ {% else %} Not logged in. {% endif %} - Set login info. + Manage login. +

{{ usermap[thread["author"]]["user_name"] }}: {{ thread["title"] }}

+ {% for message in thread["messages"] %}