def deleteQuestion():

    if session['loginRole'] == 'admin':
        return redirect(url_for('login'))
    else:
        forumQuestionVO = ForumQuestionVO()
        forumQuestionDAO = ForumQuestionDAO()
        forumQuestionVO.forumQuestionId = request.args.get('QuestionId')
        forumQuestionVO.forumQuestionActiveStatus = 'deactive'
        forumQuestionDAO.deleteQuestion(forumQuestionVO)
        return redirect(url_for('loadForum'))
def discussQuestion():

    if session['loginRole'] == 'admin':
        return redirect(url_for('login'))
    else:
        forumQuestionVO = ForumQuestionVO()
        forumQuestionDAO = ForumQuestionDAO()
        forumQuestionVO.forumQuestionId = request.args.get('QuestionId')
        forumQuestionVO.forumQuestionDiscussion = '0'
        forumQuestionDAO.discussQuestion(forumQuestionVO)
        return redirect(url_for('loadForum'))
def replyQuestion():
    try:
        if session['loginRole'] != 'admin':
            forumQuestionDAO = ForumQuestionDAO()
            forumQuestionVO = ForumQuestionVO()
            forumQuestionVO.forumQuestionId = request.args.get('QuestionId')
            forumQuestionDict = forumQuestionDAO.searchForumQuestionById(
                forumQuestionVO)
            return render_template('user/replyForum.html',
                                   forumQuestionDict=forumQuestionDict)
        else:
            return render_template('admin/login.html')
    except:
        return render_template('admin/login.html')
Exemplo n.º 4
0
def loadForumAnswer():
    if session['loginRole'] != 'user':
        return render_template('admin/login.html')

    forumQuestionDAO = ForumQuestionDAO()
    forumQuestionVO = ForumQuestionVO()

    forumQuestionVO.forumQuestionId = request.args.get('forumQuestionId')

    forumQuestionDict = forumQuestionDAO.searchForumQuestionById(
        forumQuestionVO)

    return render_template('user/forumAnswer.html',
                           forumQuestionDict=forumQuestionDict)
Exemplo n.º 5
0
def forum():
    if session['loginRole'] != 'user':
        return render_template('admin/login.html')

    forumAnswerDAO = ForumAnswerDAO()
    forumQuestionDAO = ForumQuestionDAO()

    forumAnswerVO = ForumAnswerVO()
    forumQuestionVO = ForumQuestionVO()

    forumQuestionDict = forumQuestionDAO.searchForumQuestion()
    forumAnswerDict = forumAnswerDAO.searchForumAnswer()

    return render_template('user/forum.html',
                           session=session,
                           forumQuestionDict=forumQuestionDict,
                           forumAnswerDict=forumAnswerDict)
Exemplo n.º 6
0
def insertQuestion():

    if session['loginRole'] != 'user':
        return render_template('admin/login.html')

    forumQuestionDAO = ForumQuestionDAO()
    forumQuestionVO = ForumQuestionVO()

    forumQuestionVO.forumQuestion_LoginId = session['loginId']
    forumQuestionVO.forumQuestion = request.form['forumQuestion']
    forumQuestionVO.forumQuestionDate, forumQuestionVO.forumQuestionTime = str(
        datetime.now()).split(' ')
    forumQuestionVO.forumQuestionDiscussion = 1
    forumQuestionVO.forumQuestionActiveStatus = 'active'

    forumQuestionDAO.insertForumQuestion(forumQuestionVO)

    return redirect(url_for('forum'))
def insertForumQuestion():
    if session['loginRole'] != 'user':
        return redirect(url_for('login'))

    else:
        forumQuestionDAO = ForumQuestionDAO()
        forumQuestionVO = ForumQuestionVO()

        forumQuestionVO.forumQuestion = request.form['forumquestion']
        forumQuestionVO.forumQuestionDate, forumQuestionVO.forumQuestionTime = str(
            datetime.now()).split(' ')
        forumQuestionVO.forumQuestionActiveStatus = 'active'
        forumQuestionVO.forumQuestionDiscussion = 1

        forumQuestionVO.forumQuestion_LoginId = session['loginId']

        forumQuestionDAO.insertForumQuestion(forumQuestionVO)
        # print forumQuestionVO.forumQuestion_LoginId

        return redirect(url_for('loadForum'))
def loadForum():
    try:
        if session['loginRole'] == 'admin':
            return render_template('admin/index.html')
        else:
            forumQuestionDAO = ForumQuestionDAO()
            forumQuestionDict = forumQuestionDAO.searchForumQuestion()

            forumAnswerDAO = ForumAnswerDAO()
            forumAnswerDict = forumAnswerDAO.searchForumAnswer()

            registerDAO = RegisterDAO()
            registerDict = registerDAO.searchRegister()

            return render_template('user/forum.html',
                                   forumQuestionDict=forumQuestionDict,
                                   forumAnswerDict=forumAnswerDict,
                                   registerDict=registerDict,
                                   session=session)
    except:
        return render_template('admin/login.html')