def content_detail(bID): global file_id global up_count, down_count global upvote global downvote global book up_count = 0 down_count = 0 file_id = str(bID) book = mongoBook.get_book(file_id) # print(book) # print(type(book)) image_link = book["front"] # image_link = 'https://drive.google.com/thumbnail?authuser=0&sz=w320&id=1ArSB7DUAsUgxppF-Oc99n5BrztO7s-Ti' download_count = book["download"] file_link = 'https://drive.google.com/file/d/' + file_id + '/view?usp=sharing' page_num = book["page_number"] description = book["description"] Author = book["author"] upvote = len(book['upvote']) downvote = len(book["downvote"]) title = book["book_name"] # Display comments comment_content = [] comment_user_name = [] comment_user_profilepic = [] comment_time = [] data = mongoComment.get_all_comment(file_id) print(data) for cursor in data: comment_content.append(cursor['content']) comment_user_profilepic.append( mongoUsr.get_profile_pic(cursor['user_id'])) comment_user_name.append(mongoUsr.get_name(cursor['user_id'])) comment_time.append(cursor['time']) comment_content.reverse() comment_user_name.reverse() comment_time.reverse() comment_user_profilepic.reverse() up_icon = down_icon = '' if id_ in mongoBook.get_up(file_id): up_icon = '/static/images/up_active.png' down_icon = '/static/images/down_disabled.png' elif id_ in mongoBook.get_down(file_id): up_icon = '/static/images/up_disabled.png' down_icon = '/static/images/down_active.png' else: up_icon = '/static/images/up.png' down_icon = '/static/images/down.png' return render_template("content.html", comment_numb=len(comment_content), content=comment_content, time=comment_time, cusername=comment_user_name, cprofile_pic=comment_user_profilepic, display_navbar="inline", title=title, name=first_Name, picture=profile_pic, upvote_count=upvote, downvote_count=downvote, download_count=download_count, Author=Author, file_link=file_link, image_link=image_link, page_num=page_num, description=description, file_id=bID, up_icon = up_icon, down_icon = down_icon)
def content_detail(bID): global file_id global up_count, down_count global upvote global downvote global book up_count = 0 down_count = 0 file_id = str(bID) book = mongoBook.get_book(file_id) print(book) print(type(book)) image_link = book["front"] # image_link = 'https://drive.google.com/thumbnail?authuser=0&sz=w320&id=1ArSB7DUAsUgxppF-Oc99n5BrztO7s-Ti' download_count = book["download"] file_link = 'https://drive.google.com/file/d/' + file_id + '/view?usp=sharing' page_num = book["page_number"] description = book["description"] Author = book["author"] upvote = book["upvote"] downvote = book["downvote"] title = book["book_name"] return render_template("content.html", display_navbar="inline", title = title, name=first_Name, picture=profile_pic, upvote_count = upvote, downvote_count = downvote, download_count = download_count, Author = Author, file_link = file_link, image_link = image_link, page_num = page_num, description = description, file_id=bID)