Пример #1
0
def article_notice(filterCondition, keyWord, pageNum):
    try:
        # get Notice Articles
        articlesOnBoard = select_articles().subquery()

        # Get MemberId
        articlesOnBoard = join_member_id(articlesOnBoard,
                                         subMemberIdIndex = articlesOnBoard.c.\
                                                                            writerIdIndex).subquery()

        # Get Problem Name
        articlesOnBoard = join_problems_name(
            subquery=articlesOnBoard,
            subProblemIndex=articlesOnBoard.c.problemIndex).subquery()
        # 과목 공지글
        try:
            if request.method == 'POST':
                for form in request.form:
                    # FilterCondition
                    if 'keyWord' != form:
                        filterCondition = form
                        keyWord = get_request_value(form=request.form,
                                                    name='keyWord')
                        pageNum = 1

                if not keyWord:
                    keyWord = ' '
            # Notices Sorted
            articleNoticeRecords = select_sorted_articles(
                articlesOnBoard,
                FilterFindParameter(filterCondition,
                                    (keyWord if keyWord != ' ' else '')),
                isAll=True)
            # Get Notices count
            count = select_count(articleNoticeRecords.subquery().\
                                                      c.\
                                                      articleIndex).first().\
                                                                    count
            # Get Notices in Page
            articleNoticeRecords = get_page_record(articleNoticeRecords,
                                                   pageNum=pageNum).all()
        except Exception:
            count = 0
            articleNoticeRecords = []

        return render_template(
            HTMLResources().const.ARTICLE_NOTICE_HTML,
            articleNoticeRecords=articleNoticeRecords,
            pages=get_page_pointed(pageNum, count),
            # 검색시 FilterCondition List
            Filters=[
                LanguageResources().const.All,
                LanguageResources().const.Writer,
                LanguageResources().const.Title
            ],
            filterCondition=filterCondition,
            keyWord=keyWord)
    except Exception as e:
        return unknown_error(e)
def article_notice(filterCondition, keyWord, pageNum): 
    try:
        # get Notice Articles
        articlesOnBoard = select_articles().subquery()

        # Get MemberId
        articlesOnBoard = join_member_id(articlesOnBoard,
                                         subMemberIdIndex = articlesOnBoard.c.\
                                                                            writerIdIndex).subquery()
                                                            
        # Get Problem Name
        articlesOnBoard = join_problems_name(subquery = articlesOnBoard,
                                             subProblemIndex = articlesOnBoard.c.problemIndex).subquery()
                # 과목 공지글 
        try:
            if request.method == 'POST':
                for form in request.form:
                    # FilterCondition
                    if 'keyWord' != form:
                        filterCondition = form
                        keyWord = get_request_value(form = request.form,
                                                    name = 'keyWord')
                        pageNum = 1

                if not keyWord:
                    keyWord = ' '                
            # Notices Sorted
            articleNoticeRecords = select_sorted_articles(articlesOnBoard,
                                                          FilterFindParameter(filterCondition,
                                                                              (keyWord if keyWord != ' '
                                                                               else '')),
                                                          isAll = True)        
            # Get Notices count
            count = select_count(articleNoticeRecords.subquery().\
                                                      c.\
                                                      articleIndex).first().\
                                                                    count
            # Get Notices in Page                                                                           
            articleNoticeRecords = get_page_record(articleNoticeRecords,
                                                   pageNum = pageNum).all()
        except Exception:
            count = 0
            articleNoticeRecords = []
        
        return render_template(HTMLResources().const.ARTICLE_NOTICE_HTML,
                               articleNoticeRecords = articleNoticeRecords,
                               pages = get_page_pointed(pageNum,
                                                        count),
                                                              # 검색시 FilterCondition List
                               Filters = [LanguageResources().const.All,
                                          LanguageResources().const.Writer,
                                          LanguageResources().const.Title],
                               filterCondition = filterCondition,
                               keyWord = keyWord)
    except Exception as e:
        return unknown_error(e)
Пример #3
0
def board(activeTabCourseId, pageNum):    
    try:
        # 검색시 FilterCondition List
        Filters = ['모두', '작성자', '제목 및 내용']
        
                # 허용 과목 리스트
        myCourses = select_current_courses(select_accept_courses().subquery()).subquery()
        # TabActive Course or All Articles
        # get course or All Articles 
        articlesOnBoard = join_courses_names(# get TabActive Articles
                                             select_articles(activeTabCourseId = activeTabCourseId,
                                                             isDeleted = ENUMResources().const.FALSE).subquery(),
                                             myCourses).subquery()
                # 과목 공지글    
        try:  
            articleNoticeRecords = get_page_record((select_sorted_articles(articlesOnBoard,
                                                                           isNotice = ENUMResources().const.TRUE)),
                                                   pageNum = int(1),
                                                   LIST = OtherResources().const.NOTICE_LIST).all()
        except Exception:
            articleNoticeRecords = []
                # 과목 게시글
        try:
            if request.method == 'POST':
                try:
                    for form in request.form:
                        # FilterCondition
                        if 'keyWord' != form:
                            filterCondition = form
                            keyWord = request.form['keyWord']
                except Exception:
                    filterCondition = None
                    keyWord = None
            else:
                filterCondition = None
                keyWord = None
                
            articlesOnBoardSub = select_sorted_articles(articlesOnBoard,
                                                        isNotice = ENUMResources().const.FALSE,
                                                        filterFindParameter = FilterFindParameter(filterCondition,
                                                                                                  keyWord))
            count = select_count(articlesOnBoardSub.subquery().\
                                                    c.articleIndex).first().\
                                                                    count
            articleRecords = get_page_record(articlesOnBoardSub,
                                             pageNum = pageNum).all()
        except Exception:
            count = 0
            articleRecords = []
            
        try:
            myCourses = dao.query(myCourses).all()
        except Exception:
            myCourses = []
        # myCourses Default Add ALL
        myCourses.insert(0, OtherResources().const.ALL)
        
        return render_template(HTMLResources().const.BOARD_HTML,
                               SETResources = SETResources,
                               SessionResources = SessionResources,
                               LanguageResources = LanguageResources,
                               articleRecords = articleRecords,
                               articleNoticeRecords =  articleNoticeRecords,
                               myCourses = myCourses,
                               pages = get_page_pointed(pageNum,
                                                        count),
                               Filters = Filters,
                               activeTabCourseId = activeTabCourseId) # classType, condition은 검색 할 때 필요한 변수    
        
    except Exception:
        return unknown_error()
Пример #4
0
def article_board(filterCondition, keyWord, pageNum):
    try:
        # get Articles
        articlesOnBoard = select_articles().subquery()
        # Get MemberId
        articlesOnBoard = join_member_id(articlesOnBoard,
                                         subMemberIdIndex = articlesOnBoard.c.\
                                                                            writerIdIndex).subquery()

        # Get Problem Name
        articlesOnBoard = join_problems_name(
            articlesOnBoard,
            subProblemIndex=articlesOnBoard.c.problemIndex).subquery()
        # 과목 공지글
        try:
            articleNoticeRecords = select_sorted_articles(
                articlesOnBoard).all()
        except Exception:
            articleNoticeRecords = []

            # 과목 게시글
        try:
            # Search Event
            if request.method == 'POST':
                for form in request.form:
                    # FilterCondition
                    if 'keyWord' != form:
                        filterCondition = form
                        keyWord = get_request_value(form=request.form,
                                                    name='keyWord')
                        pageNum = 1

                if not keyWord:
                    keyWord = ' '
            articlesOnBoardSub = select_sorted_articles(
                articlesOnBoard,
                FilterFindParameter(filterCondition,
                                    (keyWord if keyWord != ' ' else '')),
                articleType=ENUMResources().const.QUESTION)
            count = select_count(articlesOnBoardSub.subquery().\
                                                    c.articleIndex).first().\
                                                                    count
            articleRecords = get_page_record(articlesOnBoardSub,
                                             pageNum=pageNum,
                                             LIST=int(20)).all()
        except Exception:
            count = 0
            articleRecords = []

        return render_template(
            HTMLResources().const.BOARD_HTML,
            articleRecords=articleRecords,
            articleNoticeRecords=articleNoticeRecords,
            pages=get_page_pointed(pageNum, count, int(20)),
            # 검색시 FilterCondition List
            Filters=[
                LanguageResources().const.All,
                LanguageResources().const.Writer,
                LanguageResources().const.Title
            ],
            filterCondition=filterCondition,
            keyWord=keyWord)
    except Exception as e:
        return unknown_error(e)
Пример #5
0
def article_notice(activeTabCourseId, pageNum):    
    try:
        # 검색시 FilterCondition List
        Filters = ['모두', '작성자', '제목 및 내용']
        
                # 허용 과목 리스트
        myCourses = select_current_courses(select_accept_courses().subquery()).subquery()
        # TabActive Course or All Articles
        # get course or All Articles 
        articlesOnBoard = join_courses_names(# get TabActive Articles
                                             select_articles(activeTabCourseId = activeTabCourseId,
                                                             isDeleted = ENUMResources().const.FALSE).subquery(),
                                             myCourses).subquery()
                # 과목 공지글 
        try:
            if request.method == 'POST':
                try:
                    for form in request.form:
                        # FilterCondition
                        if 'keyWord' != form:
                            filterCondition = form
                            keyWord = request.form['keyWord']
                except Exception:
                    filterCondition = None
                    keyWord = None
            else:
                filterCondition = None
                keyWord = None
                
            # Notices Sorted
            articleNoticeRecords = select_sorted_articles(articlesOnBoard,
                                                          isNotice = ENUMResources().const.TRUE,
                                                          filterFindParameter = FilterFindParameter(filterCondition,
                                                                                                    keyWord))
            # Get Notices count
            count = select_count(articleNoticeRecords.subquery().\
                                                      c.articleIndex).\
                                                      first().\
                                                      count
            # Get Notices in Page                                                                           
            articleNoticeRecords = get_page_record(articleNoticeRecords,
                                                   pageNum = pageNum).all()
        except Exception:
            count = 0
            articleNoticeRecords = []
            
        try:
            myCourses = dao.query(myCourses).all()
        except Exception:
            myCourses = []
        # myCourses Default Add ALL
        myCourses.insert(0, OtherResources().const.ALL)
        
        return render_template(HTMLResources().const.ARTICLE_NOTICE_HTML,
                               articleNoticeRecords =  articleNoticeRecords,
                               myCourses = myCourses,
                               pages = get_page_pointed(pageNum,
                                                        count),
                               Filters = Filters,
                               activeTabCourseId = activeTabCourseId) # classType, condition은 검색 할 때 필요한 변수    
        
    except Exception:
        return 
def article_board(filterCondition, keyWord, pageNum):    
    try:
        # get Articles
        articlesOnBoard = select_articles().subquery()
        # Get MemberId
        articlesOnBoard = join_member_id(articlesOnBoard,
                                         subMemberIdIndex = articlesOnBoard.c.\
                                                                            writerIdIndex).subquery()
                                                                    
        # Get Problem Name
        articlesOnBoard = join_problems_name(articlesOnBoard,
                                             subProblemIndex = articlesOnBoard.c.problemIndex).subquery()
                # 과목 공지글
        try:  
            articleNoticeRecords = select_sorted_articles(articlesOnBoard).all()
        except Exception:
            articleNoticeRecords = []
            
                # 과목 게시글
        try:
            # Search Event
            if request.method == 'POST':
                for form in request.form:
                    # FilterCondition
                    if 'keyWord' != form:
                        filterCondition = form
                        keyWord = get_request_value(form = request.form,
                                                    name = 'keyWord')
                        pageNum = 1
                    
                if not keyWord:
                    keyWord = ' '
            articlesOnBoardSub = select_sorted_articles(articlesOnBoard,
                                                        FilterFindParameter(filterCondition,
                                                                            (keyWord if keyWord != ' '
                                                                             else '')),
                                                        articleType = ENUMResources().const.QUESTION)
            count = select_count(articlesOnBoardSub.subquery().\
                                                    c.articleIndex).first().\
                                                                    count
            articleRecords = get_page_record(articlesOnBoardSub,
                                             pageNum = pageNum,
                                             LIST = int(20)).all()
        except Exception:
            count = 0
            articleRecords = []
            
        return render_template(HTMLResources().const.BOARD_HTML,
                               articleRecords = articleRecords,
                               articleNoticeRecords = articleNoticeRecords,
                               pages = get_page_pointed(pageNum,
                                                        count,
                                                        int(20)),
                                                              # 검색시 FilterCondition List
                               Filters = [LanguageResources().const.All,
                                          LanguageResources().const.Writer,
                                          LanguageResources().const.Title],
                               filterCondition = filterCondition,
                               keyWord = keyWord)  
    except Exception as e:
        return unknown_error(e)