def main(cursor): # Get team Id team_id = int(common.get_val('team', 0)) recache = common.get_val('recache', False) output = [] output.append("""<div style="padding: 5px;"> <form style="padding: 5px;" action="web.py" method="get" accept-charset="utf-8"> <input type="hidden" name="mode" id="mode" value="team_stats" /> <table border="0" cellspacing="5" cellpadding="5"> <tr> <td><label for="team">Team:</label></td> <td>%(team_option_box)s</td> <td width="10"> </td> <td><input type="submit" value="Get stats" /></td> </tr> </table> </form> <a href="web.py?mode=team_stats&team=%(team_id)s&recache=1" class="block_link">Recache</a> <br />""" % { "team_option_box": team_f.structured_list(cursor, default=team_id), "last_id": team_q.get_latest_active_team_id(cursor, skip_irs = True), "team_id": team_id, }) if team_id < 1: return "".join(output) ajax = False output.append(get_stat_core(cursor, team_id, recache, ajax)) # output.append("</div>") return "".join(output)
def main(cursor): # Get team Id team_id = int(common.get_val('team', 0)) post_output = common.get_val('post_output', 0) auto_jump = common.get_val('auto_jump', False) dev_mode = common.get_val('dev_mode', 0) recache = common.get_val('recache', False) ajax = common.get_val('ajax', 0) output = [] if not ajax: output.append("""<div style="padding: 5px;"> <form style="padding: 5px;" action="web.py" method="get" accept-charset="utf-8"> <input type="hidden" name="mode" id="mode" value="ti" /> <table border="0" cellspacing="5" cellpadding="5"> <tr> <td><label for="team">Team:</label></td> <td>%(team_option_box)s</td> <td><label for="post_output">Post ouput:</label></td> <td>%(post_output_checkbox)s</td> <td><label for="auto_jump">Auto-jump:</label></td> <td>%(auto_jump_checkbox)s</td> <td width="10"> </td> <td><input type="submit" value="Get TI" /></td> </tr> </table> </form> <a href="web.py?mode=ti&team=%(last_id)s&post_output=1&auto_jump=1" class="block_link">Update all</a> <br /> <a href="web.py?mode=ti&team=%(team_id)s&recache=1" class="block_link">Recache</a> <br />""" % { "team_option_box": team_f.structured_list(cursor, default=team_id), "post_output_checkbox": common.check_box('post_output', post_output), "auto_jump_checkbox": common.check_box('auto_jump', auto_jump), "last_id": team_q.get_latest_active_team_id(cursor, skip_irs = True), "team_id": team_id, }) if team_id < 1: return "".join(output) if post_output: output.append(get_bbcode_core(cursor, team_id)) else: output.append(get_ti_core(cursor, team_id, recache, ajax)) if auto_jump: new_location = "web.py?mode=ti&post_output=%s&auto_jump=1&team=%d" % (post_output, team_q.get_next_active_team_id(cursor, team_id, skip_irs = True)) if post_output: output.append(common.redirect(new_location, 2000)) else: output.append(common.redirect(new_location)) output.append("</div>") return "".join(output)