Esempio n. 1
0
def commentWeb():
    username=session.get("username")
    if username == None:
        return login();
    
    global conn
    
    postid=int(session.get("postid"))
    
    posts=post.Post(conn)
    post_datas=posts.getPostsByPostid(postid)
    postJson=[post_datas[0][0],post_datas[0][1],postid]
    
    userid=session.get("userid")

    comments=comment.Comment(conn)
    comment_datas=comments.getCommentsByPostid(postid,userid)
    comment_data=[];
    for item in comment_datas:
        datalist={
                'like':item[0],
                'flag':item[1],
                'commentid':item[2],
                'username':item[3],
                'comment':item[4]
                }
        comment_data.append(datalist)
    commentJson=json.dumps(comment_data)
    
    return render_template('comment.html',Musername=username,username=postJson[0],\
                userpost=postJson[1],postid=postJson[2],commentjson=commentJson)
Esempio n. 2
0
def modifycommentdata():
    global conn
    if request.method == "POST":
        blogs=request.form.get('myblog')
        commentid=int(session.get("commentid"))
        comments=comment.Comment(conn);
        ressult=comments.modifyData(commentid,blogs)
        return """<script>window.location.href="/commentWeb";</script>"""
Esempio n. 3
0
def dislikeComment():
    global conn
    userid=session.get("userid")
    data=json.loads(request.form.get('data'))
    commentid=int(data["commentid"])
    comments=comment.Comment(conn);
    comments.dislikeComments(commentid,userid)
    return ""
Esempio n. 4
0
def deleteComments():
    global conn
    data=json.loads(request.form.get('data'))
    commentid=int(data["commentid"])
    
    comments=comment.Comment(conn)
    comments.deleteComment(commentid)
    
    return "";
Esempio n. 5
0
def modifycommentweb():
    username=session.get("username")
    if username == None:
        return login();
    global conn
    commentid=int(session.get("commentid"))
    comments=comment.Comment(conn);
    datas=comments.getCommentsByCommentid(commentid)
    text=datas[0][0]
    return render_template('modifycomment.html',username=username,comment=text)
Esempio n. 6
0
def SubComment():
    data=json.loads(request.form.get('data'))
    postid=int(data["postid"])
    mycomment=data["comment"]
    
    global conn
    userid=session.get("userid")
    comments=comment.Comment(conn)
    comments.insertData(mycomment,userid,postid)
    
    return ""
Esempio n. 7
0
 def __init__(self):
     self.COMMAND_PATH = constants.SRC_PATH + constants.TPM_PATH + "command/"
     self.comments = comment.Comment()
     self.functions = []