recent_discuss.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 id="main_table_top_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. div += '' + \
  26. '<tr>' + \
  27. '<td>' + \
  28. '<a href="/thread/' + data[3] + '">' + html.escape(data[1]) + '</a> ' + \
  29. '<a href="/topic/' + url_pas(data[0]) + '">(' + html.escape(data[0]) + ')</a>' + \
  30. '</td>' + \
  31. '<td>' + data[2] + '</td>' + \
  32. '</tr>' + \
  33. ''
  34. div += '</tbody></table>'
  35. return easy_minify(flask.render_template(skin_check(),
  36. imp = [load_lang('recent_discussion'), wiki_set(), wiki_custom(), wiki_css([m_sub, 0])],
  37. data = div,
  38. menu = 0
  39. ))