recent_discuss.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. from .tool.func import *
  2. def recent_discuss_2(conn, tool):
  3. curs = conn.cursor()
  4. div = ''
  5. if tool == 'normal':
  6. div += '<a href="/recent_discuss/close">(' + load_lang('close_discussion') + ')</a> '
  7. div += '<a href="/recent_discuss/open">(' + load_lang('open_discussion_list') + ')</a>'
  8. m_sub = 0
  9. elif tool == 'close':
  10. div += '<a href="/recent_discuss">(' + load_lang('normal') + ')</a>'
  11. m_sub = ' (' + load_lang('closed') + ')'
  12. else:
  13. div += '<a href="/recent_discuss">(' + load_lang('normal') + ')</a>'
  14. m_sub = ' (' + load_lang('open_discussion_list') + ')'
  15. div += '''
  16. <hr class="main_hr">
  17. <table id="main_table_set">
  18. <tbody>
  19. <tr id="main_table_top_tr">
  20. <td id="main_table_width_half">''' + load_lang('discussion_name') + '''</td>
  21. <td id="main_table_width_half">''' + load_lang('time') + '''</td>
  22. </tr>
  23. '''
  24. if tool == 'normal':
  25. curs.execute(db_change("select title, sub, date, code from rd where not stop = 'O' order by date desc limit 50"))
  26. elif tool == 'close':
  27. curs.execute(db_change("select title, sub, date, code from rd where stop = 'O' order by date desc limit 50"))
  28. else:
  29. curs.execute(db_change('select title, sub, date, code from rd where stop != "O" order by date asc limit 50'))
  30. for data in curs.fetchall():
  31. div += '' + \
  32. '<tr>' + \
  33. '<td>' + \
  34. '<a href="/thread/' + data[3] + '">' + html.escape(data[1]) + '</a> ' + \
  35. '<a href="/topic/' + url_pas(data[0]) + '">(' + html.escape(data[0]) + ')</a>' + \
  36. '</td>' + \
  37. '<td>' + data[2] + '</td>' + \
  38. '</tr>' + \
  39. ''
  40. div += '</tbody></table>'
  41. return easy_minify(flask.render_template(skin_check(),
  42. imp = [load_lang('recent_discussion'), wiki_set(), wiki_custom(), wiki_css([m_sub, 0])],
  43. data = div,
  44. menu = 0
  45. ))