from .tool.func import * async def vote_list(list_type = 'normal', num = 1): with get_db_connect() as conn: curs = conn.cursor() sql_num = (num * 50 - 50) if num * 50 > 0 else 0 data = '' if list_type == 'normal': data += '(' + await get_lang('close_vote_list') + ')' sub = 0 curs.execute(db_change('select name, id, type from vote where type = "open" or type = "n_open" limit ?, 50'), [sql_num]) else: data += '(' + await get_lang('open_vote_list') + ')' sub = '(' + await get_lang('closed') + ')' curs.execute(db_change('select name, id, type from vote where type = "close" or type = "n_close" limit ?, 50'), [sql_num]) data += '' menu = [] if list_type == 'normal': menu = [["vote/add", await get_lang('add_vote')]] if await acl_check('', 'vote') != 1 else [] data += await get_next_page_bottom('/vote/list/{}', num, data_list) else: data += await get_next_page_bottom('/vote/list/close/{}', num, data_list) return easy_minify(flask.render_template(await skin_check(), imp = [await get_lang('vote_list'), await wiki_set(), await wiki_custom(), wiki_css([sub, 0])], data = data, menu = [['other', await get_lang('return')]] + menu ))