mirror of https://github.com/bbj-dev/bbj
update web appearance
This commit is contained in:
parent
9118dfaba7
commit
b88aa96e42
|
@ -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"
|
||||
|
|
21
server.py
21
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"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
{% else %}
|
||||
<span>Not logged in.</span>
|
||||
{% endif %}
|
||||
<a class="navbarLink" href="/login">Set login info.</a>
|
||||
<a class="navbarLink" href="/login">Manage login.</a>
|
||||
</div>
|
||||
|
||||
{% if authorized_user %}
|
||||
|
@ -45,6 +45,7 @@
|
|||
<br>
|
||||
{{ thread["reply_count"] }} replies; active <span class="datetime">{{ thread["last_mod"] }}</span>
|
||||
<br>
|
||||
last active by <span class="color{{ usermap[thread['author']]['color'] }}">{{ usermap[thread["author"]]["user_name"] }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -63,7 +64,8 @@
|
|||
<br>
|
||||
{{ thread["reply_count"] }} replies; active <span class="datetime">{{ thread["last_mod"] }}</span>
|
||||
<br>
|
||||
<a href="setBookmark?delBookmark={{ thread['thread_id'] }}">Unbookmark this thread.</a>
|
||||
last active by <span class="color{{ usermap[thread['author']]['color'] }}">{{ usermap[thread["author"]]["user_name"] }}</span>
|
||||
<br><a href="setBookmark?delBookmark={{ thread['thread_id'] }}">Unbookmark this thread.</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -82,7 +84,8 @@
|
|||
<br>
|
||||
{{ thread["reply_count"] }} replies; active <span class="datetime">{{ thread["last_mod"] }}</span>
|
||||
<br>
|
||||
<a href="setBookmark?bookmarkId={{ thread['thread_id'] }}">Bookmark this thread.</a>
|
||||
last active by <span class="color{{ usermap[thread['author']]['color'] }}">{{ usermap[thread["author"]]["user_name"] }}</span>
|
||||
<br><a href="setBookmark?bookmarkId={{ thread['thread_id'] }}">Bookmark this thread.</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
|
@ -18,9 +18,11 @@
|
|||
{% else %}
|
||||
<span>Not logged in.</span>
|
||||
{% endif %}
|
||||
<a class="navbarLink" href="/login">Set login info.</a>
|
||||
<a class="navbarLink" href="/login">Manage login.</a>
|
||||
</div>
|
||||
|
||||
<h3><span class="color{{ usermap[thread['author']]['color'] }}">{{ usermap[thread["author"]]["user_name"] }}</span>: {{ thread["title"] }}</h3>
|
||||
|
||||
{% for message in thread["messages"] %}
|
||||
<div class="message">
|
||||
<div class="messageHeader">
|
||||
|
|
Loading…
Reference in New Issue