recent_history_reset.py 1.1 KB

12345678910111213141516171819202122232425262728
  1. from .tool.func import *
  2. def recent_history_reset(name = 'Test'):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. if admin_check(conn) != 1:
  6. return re_error(conn, '/error/3')
  7. if flask.request.method == 'POST':
  8. admin_check(conn, None, 'history reset ' + name)
  9. curs.execute(db_change("delete from history where title = ?"), [name])
  10. conn.commit()
  11. return redirect(conn, '/history/' + url_pas(name))
  12. else:
  13. return easy_minify(conn, flask.render_template(skin_check(conn),
  14. imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'history_reset') + ')', 0])],
  15. data = '''
  16. <form method="post">
  17. <span>''' + get_lang(conn, 'delete_warning') + '''</span>
  18. <hr class="main_hr">
  19. <button type="submit">''' + get_lang(conn, 'reset') + '''</button>
  20. </form>
  21. ''',
  22. menu = [['history/' + url_pas(name), get_lang(conn, 'return')]]
  23. ))