|
|
@@ -1,6 +1,7 @@
|
|
|
from .tool.func import *
|
|
|
|
|
|
from .go_api_list_history import api_list_history
|
|
|
+from .go_api_list_recent_change import api_list_recent_change
|
|
|
|
|
|
from .recent_change import recent_change_send_render
|
|
|
|
|
|
@@ -12,7 +13,7 @@ async def option_lang(lang_in, lang):
|
|
|
|
|
|
return lang_in
|
|
|
|
|
|
-async def list_history(num = 1, set_type = 'normal', doc_name = 'Test'):
|
|
|
+async def list_history(tool = 'history', num = 1, set_type = 'normal', doc_name = 'Test'):
|
|
|
with get_db_connect() as conn:
|
|
|
if flask.request.method == 'POST':
|
|
|
a = flask.request.form.get('a')
|
|
|
@@ -20,7 +21,18 @@ async def list_history(num = 1, set_type = 'normal', doc_name = 'Test'):
|
|
|
|
|
|
return redirect(conn, f'/diff/{b}/{a}/{doc_name}')
|
|
|
else:
|
|
|
- data = await api_list_history(num, set_type, doc_name)
|
|
|
+ if tool == "history":
|
|
|
+ data = await api_list_history(num, set_type, doc_name)
|
|
|
+
|
|
|
+ title = doc_name
|
|
|
+ sub = '(' + get_lang(conn, 'history') + ')'
|
|
|
+ menu = [['other', get_lang(conn, 'return')], ['history_add/' + url_pas(doc_name), get_lang(conn, 'history_add')], ['history_reset/' + url_pas(doc_name), get_lang(conn, 'history_reset')]]
|
|
|
+ else:
|
|
|
+ data = await api_list_recent_change(num, set_type, 50, '')
|
|
|
+
|
|
|
+ title = get_lang(conn, 'recent_change')
|
|
|
+ sub = '(' + get_lang(conn, set_type) + ')'
|
|
|
+ menu = [['other', get_lang(conn, 'return')], ['recent_edit_request', get_lang(conn, 'edit_request')]]
|
|
|
|
|
|
lang = data["language"]
|
|
|
auth = data["auth"]
|
|
|
@@ -28,10 +40,16 @@ async def list_history(num = 1, set_type = 'normal', doc_name = 'Test'):
|
|
|
|
|
|
data_html = ''
|
|
|
|
|
|
- option_list = ['normal', 'edit', 'move', 'delete', 'revert', 'r1', 'setting']
|
|
|
- for option in option_list:
|
|
|
- label = await option_lang(option, lang)
|
|
|
- data_html += f'<a href="/history_page/1/{option}/{doc_name}">({label})</a> '
|
|
|
+ if tool == "history":
|
|
|
+ option_list = ['normal', 'edit', 'move', 'delete', 'revert', 'r1', 'setting']
|
|
|
+ for option in option_list:
|
|
|
+ label = await option_lang(option, lang)
|
|
|
+ data_html += f'<a href="/history_page/1/{option}/{doc_name}">({label})</a> '
|
|
|
+ else:
|
|
|
+ option_list = ['normal', 'edit', 'move', 'delete', 'revert', 'r1', 'edit_request', 'user', 'file', 'category']
|
|
|
+ for option in option_list:
|
|
|
+ label = await option_lang(option, lang)
|
|
|
+ data_html += f'<a href="/recent_change/1/{option}">({label})</a> '
|
|
|
|
|
|
date_heading = ''
|
|
|
select = ''
|
|
|
@@ -45,7 +63,7 @@ async def list_history(num = 1, set_type = 'normal', doc_name = 'Test'):
|
|
|
data_html += await opennamu_make_list('----', '', '', '')
|
|
|
continue
|
|
|
|
|
|
- left = ''
|
|
|
+ left = '<a href="/w/' + doc_name + '">' + html.escape(data[for_a][1]) + '</a> '
|
|
|
rev = ''
|
|
|
|
|
|
if data[for_a][6] != "":
|
|
|
@@ -59,13 +77,12 @@ async def list_history(num = 1, set_type = 'normal', doc_name = 'Test'):
|
|
|
before_rev = str(int(data[for_a][0]) - 1)
|
|
|
rev = f'<a href="/diff/{before_rev}/{data[for_a][0]}/{doc_name}">{rev}</a>'
|
|
|
|
|
|
- left += rev
|
|
|
-
|
|
|
right = f'<span id="opennamu_list_history_{for_a}_over">'
|
|
|
right += f'<a id="opennamu_list_history_{for_a}" href="javascript:void(0);">'
|
|
|
right += '<span class="opennamu_svg opennamu_svg_tool"> </span></a>'
|
|
|
right += f'<span class="opennamu_popup_footnote" id="opennamu_list_history_{for_a}_load" style="display: none;"></span>'
|
|
|
right += '</span> | '
|
|
|
+ right += rev + ' | '
|
|
|
|
|
|
diff_size = data[for_a][5]
|
|
|
if diff_size == '0':
|
|
|
@@ -127,18 +144,21 @@ async def list_history(num = 1, set_type = 'normal', doc_name = 'Test'):
|
|
|
</script>
|
|
|
'''
|
|
|
|
|
|
- data_html+= get_next_page_bottom(conn, f'/recent_change/{{}}/{set_type}', num, data)
|
|
|
- data_html = (
|
|
|
- '<form method="post">'
|
|
|
- f'<select name="a">{select}</select> '
|
|
|
- f'<select name="b">{select}</select> '
|
|
|
- f'<button type="submit">{lang["compare"]}</button>'
|
|
|
- '</form>'
|
|
|
- '<hr class="main_hr"></hr>' + data_html
|
|
|
- )
|
|
|
+ if tool == "history":
|
|
|
+ data_html += get_next_page_bottom(conn, f'/history_page/{{}}/{set_type}/{doc_name}', num, data)
|
|
|
+ data_html = (
|
|
|
+ '<form method="post">'
|
|
|
+ f'<select name="a">{select}</select> '
|
|
|
+ f'<select name="b">{select}</select> '
|
|
|
+ f'<button type="submit">{lang["compare"]}</button>'
|
|
|
+ '</form>'
|
|
|
+ '<hr class="main_hr"></hr>' + data_html
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ data_html += get_next_page_bottom(conn, f'/recent_change/{{}}/{set_type}', num, data)
|
|
|
|
|
|
return easy_minify(conn, flask.render_template(skin_check(conn),
|
|
|
- imp = [doc_name, wiki_set(conn), await wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'history') + ')', 0])],
|
|
|
+ imp = [title, wiki_set(conn), await wiki_custom(conn), wiki_css([sub, 0])],
|
|
|
data = data_html,
|
|
|
- menu = [['other', get_lang(conn, 'return')], ['history_add/' + url_pas(doc_name), get_lang(conn, 'history_add')], ['history_reset/' + url_pas(doc_name), get_lang(conn, 'history_reset')]]
|
|
|
+ menu = menu
|
|
|
))
|