Beispiel #1
0
    def GET(self, board_name):
        if board_name == '*' or board_name == '^root':
            v = board_actions()
            return v.subboard_list_get()

        board_id = board._get_board_id_from_path(board_name)
        if board_id < 0:
            #try to find regex match
            board_id = board._get_board_id_from_regex_path(board_name)
            if board_id < 0:
                raise web.notfound(util.render().error(lang='ko', error_message=_('INVALID_BOARD'), help_context='error'))
            else:
                path = board._get_path_from_board_id(board_id)
                raise web.seeother(util.link(path))

        board_info = board.get_board_info(board_id)
        if board_info.bType == 0: # 디렉터리
            v = board_actions()
            return v.subboard_list_get(board_name, board_id)
        elif board_info.bType == 2: # 넘겨주기
            board_id = board._get_board_id_from_path(board_info.bDescription)
            if board_id < 0 or board_info.bDescription.strip() == '':
                raise web.notfound(util.render().error(lang='ko', error_message=_('INVALID_ALIAS'), help_context='error'))
            else:
                raise web.seeother(util.link(board_info.bDescription))

        #processing new_article
        if web.ctx.session.has_key('uid'):
            uid = web.ctx.session.uid
            user.update_unreaded_articles_board(uid, board_id)

        qs = web.ctx.query
        if len(qs) > 0:
            qs = qs[1:]
            qs = parse_qs(qs)


        t = article._get_total_page_count(board_id, config.page_size)
        if qs:
            page = int(qs['page'][0])
        else:
            page = t

        a = article.get_article_list(board_id, config.page_size, page)
        m = article.get_marked_article(board_id)

        return util.render().board(lang="ko",
            title = board_info.bName,
            board_path = board_info.bName[1:],
            board_desc = board_info.bDescription,
            stylesheet = board_info.stylesheet,
            articles=a, marked_articles = m,
            total_page = t, page = page, feed = True,
            help_context = 'board')
Beispiel #2
0
def get_login_notice(notice_board = '/noah/welcome'):
    # /noah/welcome에서 공지 표시된 글 중 아무거나 하나를 랜덤으로 돌려 줌.
    # 공지 표시된 글이 없는 경우 '공지가 없습니다.'를 돌려 줌.
    articles = []
    board_id = board._get_board_id_from_path(notice_board)
    if board_id < 0:
        return _('INVALID_NOTICE_BOARD')
    for i in article.get_marked_article(board_id):
        articles.append(i)
    if len(articles) == 0:
        return _('NO_NOTICE')
    return articles[random.randint(0, len(articles)-1)].aContent
Beispiel #3
0
    def all_get(self, board_name, board_id, current_uid = -1):
        board_id = board._get_board_id_from_path(board_name)
        if board_id < 0:
            path = board._get_path_from_board_id(board_id)
            raise web.seeother(util.link(path))

        board_info = board.get_board_info(board_id)
        board_name = board_info.bName;

        if web.ctx.session.has_key('uid'):
            uid = web.ctx.session.uid
            user.update_unreaded_articles_board(uid, board_id)

        qs = web.ctx.query
        if len(qs) > 0:
            qs = qs[1:]
            qs = parse_qs(qs)

        t = article._get_recurse_page_count(board_name, config.page_size)
        if qs:
            page = int(qs['page'][0])
        else:
            page = t

        a = article.get_recurse_article_list(board_name, 
            config.page_size, page)
        m = article.get_marked_article(board_id)

        return util.render().board(lang="ko",
            title = board_info.bName,
            board_path = board_info.bName[1:],
            board_desc = board_info.bDescription,
            stylesheet = board_info.stylesheet,
            articles=a, marked_articles = m,
            total_page = t, page = page, feed = True,
            help_context = 'board')