from .tool.func import *
def view_xref_2(conn, name):
curs = conn.cursor()
if acl_check(name, 'render') == 1:
return re_error('/ban')
num = int(number_check(flask.request.args.get('num', '1')))
if num * 50 > 0:
sql_num = num * 50 - 50
else:
sql_num = 0
if flask.request.args.get('change', '1') == '1':
div = '(' + load_lang('link_in_this') + ')
'
else:
div = '(' + load_lang('normal') + ')
'
div += ''
if flask.request.args.get('change', '1') == '1':
curs.execute(db_change("" + \
"select distinct link, type from back " + \
"where title = ? and not type = 'cat' and not type = 'no' and not type = 'nothing'" + \
"order by link asc limit ?, 50" + \
""), [
name,
sql_num
])
else:
curs.execute(db_change("" + \
"select distinct title, type from back " + \
"where link = ? and not type = 'cat' and not type = 'no' and not type = 'nothing'" + \
"order by link asc limit ?, 50" + \
""), [
name,
sql_num
])
data_list = curs.fetchall()
for data in data_list:
div += '- ' + data[0] + ''
if data[1]:
div += ' (' + data[1] + ')'
curs.execute(db_change("select title from back where title = ? and type = 'include'"), [data[0]])
db_data = curs.fetchall()
if db_data:
div += ' (' + load_lang('backlink') + ')'
div += '
'
div += '
' + next_fix('/xref/' + url_pas(name) + '?num=', num, data_list)
return easy_minify(flask.render_template(skin_check(),
imp = [name, wiki_set(), custom(), other2(['(' + load_lang('backlink') + ')', 0])],
data = div,
menu = [['w/' + url_pas(name), load_lang('return')], ['backlink_reset/' + url_pas(name), load_lang('reset_backlink')]]
))