mirror of
https://github.com/bbj-dev/bbj
synced 2024-06-12 20:16:38 +00:00
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 = document.createElement("textarea")
|
||||||
textarea.setAttribute("class", "directReplyBox")
|
textarea.setAttribute("class", "directReplyBox")
|
||||||
textarea.setAttribute("id", "postBody")
|
textarea.setAttribute("id", "postContent")
|
||||||
textarea.setAttribute("name", "postBody")
|
textarea.setAttribute("name", "postContent")
|
||||||
textarea.setAttribute("rows", "10")
|
textarea.setAttribute("rows", "10")
|
||||||
textarea.setAttribute("cols", "50")
|
textarea.setAttribute("cols", "50")
|
||||||
textarea.value = ">>" + post_id + " \n"
|
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
|
cherrypy.response.cookie["auth_hash"]["expires"] = 0
|
||||||
raise cherrypy.HTTPRedirect("/index")
|
raise cherrypy.HTTPRedirect("/index")
|
||||||
|
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def setBookmark(self, bookmarkId=None, delBookmark=None):
|
def setBookmark(self, bookmarkId=None, delBookmark=None):
|
||||||
if "bookmarks" in cherrypy.request.cookie:
|
if "bookmarks" in cherrypy.request.cookie:
|
||||||
|
@ -751,6 +752,7 @@ class HTML(object):
|
||||||
cherrypy.response.cookie["bookmarks"]["max-age"] = 34560000
|
cherrypy.response.cookie["bookmarks"]["max-age"] = 34560000
|
||||||
raise cherrypy.HTTPRedirect("/index")
|
raise cherrypy.HTTPRedirect("/index")
|
||||||
|
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def index(self, bookmarkId=None, delBookmark=None):
|
def index(self, bookmarkId=None, delBookmark=None):
|
||||||
database = sqlite3.connect(dbname)
|
database = sqlite3.connect(dbname)
|
||||||
|
@ -771,12 +773,12 @@ class HTML(object):
|
||||||
pinned_threads = [thread for thread in threads if thread["pinned"]]
|
pinned_threads = [thread for thread in threads if thread["pinned"]]
|
||||||
|
|
||||||
if "bookmarks" in cookie:
|
if "bookmarks" in cookie:
|
||||||
loads = json.loads(cookie["bookmarks"].value)
|
user_bookmarks = json.loads(cookie["bookmarks"].value)
|
||||||
bookmarked_threads = [thread for thread in threads if thread["thread_id"] in loads]
|
bookmarked_threads = [thread for thread in threads if thread["thread_id"] in user_bookmarks]
|
||||||
threads = [
|
threads = [
|
||||||
thread for thread in threads
|
thread for thread in threads
|
||||||
if not thread["pinned"]
|
if not thread["pinned"]
|
||||||
and not thread["thread_id"] in loads
|
and not thread["thread_id"] in user_bookmarks
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
bookmarked_threads = []
|
bookmarked_threads = []
|
||||||
|
@ -796,6 +798,7 @@ class HTML(object):
|
||||||
}
|
}
|
||||||
return template.render(variables)
|
return template.render(variables)
|
||||||
|
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def thread(self, id=None):
|
def thread(self, id=None):
|
||||||
if not id:
|
if not id:
|
||||||
|
@ -822,6 +825,7 @@ class HTML(object):
|
||||||
}
|
}
|
||||||
return template.render(variables)
|
return template.render(variables)
|
||||||
|
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def threadSubmit(self, title=None, postContent=None):
|
def threadSubmit(self, title=None, postContent=None):
|
||||||
database = sqlite3.connect(dbname)
|
database = sqlite3.connect(dbname)
|
||||||
|
@ -840,14 +844,21 @@ class HTML(object):
|
||||||
|
|
||||||
|
|
||||||
@cherrypy.expose
|
@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)
|
database = sqlite3.connect(dbname)
|
||||||
cookie = cherrypy.request.cookie
|
cookie = cherrypy.request.cookie
|
||||||
if "username" in cookie and "auth_hash" in cookie:
|
if "username" in cookie and "auth_hash" in cookie:
|
||||||
user = db.user_resolve(database, cookie["username"].value)
|
user = db.user_resolve(database, cookie["username"].value)
|
||||||
if cookie["auth_hash"].value.lower() != user["auth_hash"]:
|
if cookie["auth_hash"].value.lower() != user["auth_hash"]:
|
||||||
return "Authorization info not correct."
|
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)
|
raise cherrypy.HTTPRedirect("/thread?id=" + threadId)
|
||||||
return "User not logged in"
|
return "User not logged in"
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<span>Not logged in.</span>
|
<span>Not logged in.</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="navbarLink" href="/login">Set login info.</a>
|
<a class="navbarLink" href="/login">Manage login.</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if authorized_user %}
|
{% if authorized_user %}
|
||||||
|
@ -45,6 +45,7 @@
|
||||||
<br>
|
<br>
|
||||||
{{ thread["reply_count"] }} replies; active <span class="datetime">{{ thread["last_mod"] }}</span>
|
{{ thread["reply_count"] }} replies; active <span class="datetime">{{ thread["last_mod"] }}</span>
|
||||||
<br>
|
<br>
|
||||||
|
last active by <span class="color{{ usermap[thread['author']]['color'] }}">{{ usermap[thread["author"]]["user_name"] }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,7 +64,8 @@
|
||||||
<br>
|
<br>
|
||||||
{{ thread["reply_count"] }} replies; active <span class="datetime">{{ thread["last_mod"] }}</span>
|
{{ thread["reply_count"] }} replies; active <span class="datetime">{{ thread["last_mod"] }}</span>
|
||||||
<br>
|
<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>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -82,7 +84,8 @@
|
||||||
<br>
|
<br>
|
||||||
{{ thread["reply_count"] }} replies; active <span class="datetime">{{ thread["last_mod"] }}</span>
|
{{ thread["reply_count"] }} replies; active <span class="datetime">{{ thread["last_mod"] }}</span>
|
||||||
<br>
|
<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>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,9 +18,11 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<span>Not logged in.</span>
|
<span>Not logged in.</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="navbarLink" href="/login">Set login info.</a>
|
<a class="navbarLink" href="/login">Manage login.</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3><span class="color{{ usermap[thread['author']]['color'] }}">{{ usermap[thread["author"]]["user_name"] }}</span>: {{ thread["title"] }}</h3>
|
||||||
|
|
||||||
{% for message in thread["messages"] %}
|
{% for message in thread["messages"] %}
|
||||||
<div class="message">
|
<div class="message">
|
||||||
<div class="messageHeader">
|
<div class="messageHeader">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user