from .tool.func import *
def title_index_2(conn):
curs = conn.cursor()
page = int(number_check(flask.request.args.get('page', '1')))
num = int(number_check(flask.request.args.get('num', '100')))
if page * num > 0:
sql_num = page * num - num
else:
sql_num = 0
all_list = sql_num + 1
if num > 1000:
return re_error('/error/3')
data = '(250) (500) (1000)'
curs.execute("select title from data order by title asc limit ?, ?", [str(sql_num), str(num)])
title_list = curs.fetchall()
if title_list:
data += '
'
for list_data in title_list:
data += '- ' + str(all_list) + '. ' + list_data[0] + '
'
all_list += 1
if page == 1:
count_end = []
curs.execute("select count(title) from data")
count = curs.fetchall()
if count:
count_end += [count[0][0]]
else:
count_end += [0]
sql_list = [load_lang('template', 1).lower() + ':', 'category:', 'user:', 'file:']
for sql in sql_list:
curs.execute("select count(title) from data where title like ?", [sql + '%'])
count = curs.fetchall()
if count:
count_end += [count[0][0]]
else:
count_end += [0]
count_end += [count_end[0] - count_end[1] - count_end[2] - count_end[3] - count_end[4]]
data += '''
- all : ''' + str(count_end[0]) + '''
- ''' + load_lang('template') + ' : ' + str(count_end[1]) + '''
- ''' + load_lang('category') + ' : ' + str(count_end[2]) + '''
- ''' + load_lang('user') + ' : ' + str(count_end[3]) + '''
- ''' + load_lang('file') + ' : ' + str(count_end[4]) + '''
- other : ''' + str(count_end[5]) + '''
'''
data += '
' + next_fix('/title_index?num=' + str(num) + '&page=', page, title_list, num)
sub = ' (' + str(num) + ')'
return easy_minify(flask.render_template(skin_check(),
imp = [load_lang('all_document_list'), wiki_set(), custom(), other2([sub, 0])],
data = data,
menu = [['other', load_lang('return')]]
))