Esempio n. 1
0
    def __init__(self, document_info):
        self.id = document_info[0]
        self.article_id = document_info[1]
        self.doc_name = document_info[2]
        self.doc_dir = document_info[3]
        self.doc_desc = document_info[4]
        self.doc_url = document_info[5]
        self.doc_time = document_info[6]
        self.update_time = document_info[7]
        self.link = self.doc_dir + self.doc_name
        self.doc_time = self.doc_time[0:10]
        self.update_time = self.update_time[0:10]

        article_info = self.article_instance.getArticleInfoFromId(self.article_id)
        self.article = article_head(article_info)
Esempio n. 2
0
    def __init__(self, document_info):
        self.id = document_info[0]
        self.article_id = document_info[1]
        self.doc_name = document_info[2]
        self.doc_dir = document_info[3]
        self.doc_desc = document_info[4]
        self.doc_url = document_info[5]
        self.doc_time = document_info[6]
        self.update_time = document_info[7]
        self.link = self.doc_dir + self.doc_name
        self.doc_time = self.doc_time[0:10]
        self.update_time = self.update_time[0:10]

        article_info = self.article_instance.getArticleInfoFromId(
            self.article_id)
        self.article = article_head(article_info)
Esempio n. 3
0
def article_list_view(request, category = 'index', page = '1'):
    title = '城镇规划展示'
    article_instance = articleModel()
    if not page:
        page = '1'

    if category == 'zcfb':
        article_type = 1
        category_name = webConfig.TOPLABEL1
    elif category == 'gsgg':
        article_type = 2
        category_name = webConfig.TOPLABEL2
    elif category == 'lddt':
        article_type = 3
        category_name = webConfig.TOPLABEL3
    elif category == 'hydt':
        article_type = 4
        category_name = webConfig.TOPLABEL4
    elif category == 'dfdt':
        article_type = 5
        category_name = webConfig.TOPLABEL5
    elif category == 'qtwz':
        article_type = 0
        category_name = webConfig.TOPLABEL6
    elif category == 'index':
        article_type = -1
        category_name = webConfig.TOPLABEL0
    else:
        article_type = -1
        category_name = webConfig.TOPLABEL0

    articles = article_instance.getArticleList(page=int(page), article_type = article_type)
    articlesForHtml = []
    for temp in articles:
        article_head_temp = article_head(temp)
        articlesForHtml.append(article_head_temp)

    article_num = article_instance.getArticleNum(article_type)
    page_total = article_num / webConfig.PAGENUM + 1

    if page == '1':
        previous_page = '1'
    else:
        previous_page = str(int(page) - 1)

    if page == str(page_total):
        next_page = str(page_total)
    else:
        next_page = str(int(page) + 1)

    page = int(page)
    pages = []
    temp = page - page % 5
    if page_total <= 5:
        for i in range(page_total):
            pages.append(i + 1)
    elif page > page_total - page_total % 5:
        for i in range(page_total - page_total % 5, page_total):
            pages.append(i + 1)
    else:
        for i in range(5):
            pages.append(i + 1 + temp)

    return render_to_response("index.html",
                              {
                                  "title": title,
                                  'articles': articlesForHtml,
                                  'project_name': webConfig.PROJECTNAME,
                                  'toplabel0': webConfig.TOPLABEL0,
                                  'toplabel1': webConfig.TOPLABEL1,
                                  'toplabel2': webConfig.TOPLABEL2,
                                  'toplabel3': webConfig.TOPLABEL3,
                                  'toplabel4': webConfig.TOPLABEL4,
                                  'toplabel5': webConfig.TOPLABEL5,
                                  'toplabel6': webConfig.TOPLABEL6,
                                  'page_total': page_total,
                                  'page': page,
                                  'previous_page': previous_page,
                                  'next_page': next_page,
                                  'pages': pages,
                                  'category': category,
                                  'category_name': category_name

                              }
                              )