2
0

recent_discuss.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. from .tool.func import *
  2. def recent_discuss_2(conn):
  3. curs = conn.cursor()
  4. div = ''
  5. if flask.request.args.get('what', 'normal') == 'normal':
  6. div += '<a href="/recent_discuss?what=close">(' + load_lang('close_discussion') + ')</a>'
  7. m_sub = 0
  8. else:
  9. div += '<a href="/recent_discuss">(' + load_lang('open_discussion') + ')</a>'
  10. m_sub = ' (' + load_lang('closed') + ')'
  11. div += '''
  12. <hr class=\"main_hr\">
  13. <table id="main_table_set">
  14. <tbody>
  15. <tr>
  16. <td id="main_table_width_half">''' + load_lang('discussion_name') + '''</td>
  17. <td id="main_table_width_half">''' + load_lang('time') + '''</td>
  18. </tr>
  19. '''
  20. if m_sub == 0:
  21. curs.execute(db_change("select title, sub, date, code from rd where not stop = 'O' order by date desc limit 50"))
  22. else:
  23. curs.execute(db_change("select title, sub, date, code from rd where stop = 'O' order by date desc limit 50"))
  24. for data in curs.fetchall():
  25. title = html.escape(data[0])
  26. sub = html.escape(data[1])
  27. div += '<tr><td><a href="/thread/' + data[3] + '">' + sub + '</a> (' + title + ')</td><td>' + data[2] + '</td></tr>'
  28. div += '</tbody></table>'
  29. return easy_minify(flask.render_template(skin_check(),
  30. imp = [load_lang('recent_discussion'), wiki_set(), custom(), other2([m_sub, 0])],
  31. data = div,
  32. menu = 0
  33. ))