def fatal_exception(exc, tourney=None): cgicommon.print_html_head("Player View") cgicommon.writeln("<body>") if tourney: cgicommon.show_sidebar(tourney) cgicommon.writeln("<div class=\"mainpane\">") cgicommon.show_tourney_exception(exc) cgicommon.writeln("</div>") cgicommon.writeln("</body></html>") sys.exit(1)
def fatal_exception(exc, tourney=None): cgicommon.print_html_head("Table Index") cgicommon.writeln("<body>") if tourney: cgicommon.show_sidebar(tourney, show_misc_table_links=True) cgicommon.writeln("<div class=\"mainpane\">") cgicommon.show_tourney_exception(exc) cgicommon.writeln("</div>") cgicommon.writeln("</body></html>") sys.exit(1)
def show_error(err_str): cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") cgicommon.print_html_head("Tourney: %s" % tourney_name) cgicommon.writeln("<body>") cgicommon.show_sidebar(tourney) cgicommon.writeln("<div class=\"mainpane\">") cgicommon.writeln("<p><strong>%s</strong></p>" % err_str) cgicommon.writeln("</div>") cgicommon.writeln("</body>") cgicommon.writeln("</html>")
cgicommon.writeln("") baseurl = "/cgi-bin/tourneysetupadvanced.py" form = cgi.FieldStorage() tourneyname = form.getfirst("tourney") show_tournament_rating = bool( int_or_none(form.getfirst("showtournamentratingcolumn"))) tr_bonus = float_or_none(form.getfirst("tournamentratingbonus")) tr_diff_cap = float_or_none(form.getfirst("tournamentratingdiffcap")) rank = int_or_none(form.getfirst("rank")) rank_finals = int_or_none(form.getfirst("rankfinals")) tourney = None request_method = os.environ.get("REQUEST_METHOD", "") cgicommon.print_html_head("Advanced setup: " + str(tourneyname)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() if tourneyname is not None: try: tourney = countdowntourney.tourney_open(tourneyname, cgicommon.dbdir) except countdowntourney.TourneyException as e: cgicommon.show_tourney_exception(e) cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body></html>") sys.exit(1) cgicommon.show_sidebar(tourney)
if uploader.http_server_port else "")) def unix_time_to_str(unix_time): if unix_time is None: return None return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(unix_time)) cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") form = cgi.FieldStorage() tourney_name = form.getfirst("tourney") cgicommon.print_html_head("Live Broadcast Setup: %s" % (tourney_name)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() tourney = None if tourney_name is not None: try: tourney = countdowntourney.tourney_open(tourney_name, cgicommon.dbdir) except countdowntourney.TourneyException as e: cgicommon.show_tourney_exception(e) cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body></html>") sys.exit(1)
cgitb.enable() cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") form = cgi.FieldStorage() tourney_name = form.getfirst("tourney") tourney = None cgicommon.set_module_path() import countdowntourney cgicommon.print_html_head("Tim Down Award: %s" % (tourney_name)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() if tourney_name is None: cgicommon.writeln("<h1>No tourney specified</h1>") cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body></html>") sys.exit(0) try: tourney = countdowntourney.tourney_open(tourney_name, cgicommon.dbdir) cgicommon.show_sidebar(tourney, show_misc_table_links=True)
cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") baseurl = "/cgi-bin/gameslist.py" form = cgi.FieldStorage() tourney_name = form.getfirst("tourney") tourney = None request_method = os.environ.get("REQUEST_METHOD", "") cgicommon.set_module_path() import countdowntourney cgicommon.print_html_head("Games: " + str(tourney_name)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() if tourney_name is None: cgicommon.writeln("<h1>No tourney specified</h1>") cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body></html>") sys.exit(0) try: tourney = countdowntourney.tourney_open(tourney_name, cgicommon.dbdir) cgicommon.show_sidebar(tourney)
you may have given the players. That's why you need to tick the box as well. """) cgicommon.writeln("</p>") cgicommon.writeln("<p>") cgicommon.writeln("<form method=\"POST\" action=\"%s?tourney=%s\">" % (cgicommon.escape(baseurl), urllib.parse.quote_plus(tourney_name))) cgicommon.writeln("<input type=\"submit\" name=\"reratebyplayerid\" value=\"Rerate players by player ID\" />") cgicommon.writeln("<input type=\"checkbox\" name=\"reratebyplayeridconfirm\" id=\"reratebyplayeridconfirm\" style=\"margin-left: 20px\" />") cgicommon.writeln("<label for=\"reratebyplayeridconfirm\">Yes, I'm sure</label>") cgicommon.writeln("</form>") cgicommon.writeln("</p>") cgicommon.print_html_head("Overachievers: " + str(tourney_name)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() request_method = os.environ.get("REQUEST_METHOD", "") if tourney_name is None: cgicommon.writeln("<h1>No tourney specified</h1>") cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body></html>") sys.exit(0) try: tourney = countdowntourney.tourney_open(tourney_name, cgicommon.dbdir) cgicommon.show_sidebar(tourney, show_misc_table_links=True)
cgicommon.writeln("") form = cgi.FieldStorage() tourney_name = form.getfirst("tourney") mode = form.getfirst("mode") if mode is not None: try: mode = int(mode) except ValueError: mode = None cgicommon.set_module_path() import countdowntourney cgicommon.print_html_head("Display: " + str(tourney_name), cssfile="teleoststyle.css") try: tourney = countdowntourney.tourney_open(tourney_name, cgicommon.dbdir) except countdowntourney.TourneyException as e: cgicommon.writeln("<body>") cgicommon.writeln("<p>") cgicommon.writeln(cgicommon.escape(e.description)) cgicommon.writeln("</p>") cgicommon.writeln("</body></html>") sys.exit(0) teleost_modes = tourney.get_teleost_modes() cgicommon.writeln("<body class=\"display\" onload=\"displaySetup();\">")
cgitb.enable() cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") baseurl = "/cgi-bin/preferences.py" form = cgi.FieldStorage() tourney_name = form.getfirst("tourney") tourney = None request_method = os.environ.get("REQUEST_METHOD", "") cgicommon.set_module_path() cgicommon.print_html_head("Preferences") saved_prefs = False cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() cgicommon.writeln(""" <script> function change_saved_indicator(on) { var control = document.getElementById("prefssavedspan"); if (on) { control.innerHTML = "Preferences saved."; } else {
cgitb.enable() cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") form = cgi.FieldStorage() tourney_name = form.getfirst("tourney") tourney = None cgicommon.set_module_path() import countdowntourney cgicommon.print_html_head("Standings: " + str(tourney_name)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() if tourney_name is None: cgicommon.writeln("<h1>No tourney specified</h1>") cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body></html>") sys.exit(0) try: tourney = countdowntourney.tourney_open(tourney_name, cgicommon.dbdir) cgicommon.show_sidebar(tourney)
cgicommon.writeln("<td class=\"tourneylistlink\">") cgicommon.writeln( "<a href=\"/cgi-bin/display.py?tourney=%s\">Full screen display</a>" % (urllib.parse.quote_plus(name))) cgicommon.writeln("</td>") cgicommon.writeln("</tr>") cgicommon.writeln("</table>") baseurl = "/cgi-bin/home.py" cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") cgicommon.print_html_head( "Create Tourney" if cgicommon.is_client_from_localhost() else "Atropine") form = cgi.FieldStorage() tourneyname = form.getfirst("name", "") order_by = form.getfirst("orderby", "mtime_d") request_method = os.environ.get("REQUEST_METHOD", "GET") cgicommon.writeln("<body>") cgicommon.writeln("<h1>Welcome to Atropine</h1>") if cgicommon.is_client_from_localhost(): # Client is from localhost, so serve the administrator's front page, which # produces a menu of tournaments and the ability to create a new one. tourney_created = False
cgitb.enable() cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") form = cgi.FieldStorage() tourney_name = form.getfirst("tourney") tourney = None cgicommon.set_module_path() import countdowntourney cgicommon.print_html_head("Tuff luck: " + str(tourney_name)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() if tourney_name is None: cgicommon.writeln("<h1>No tourney specified</h1>") cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body></html>") sys.exit(0) try: tourney = countdowntourney.tourney_open(tourney_name, cgicommon.dbdir) cgicommon.show_sidebar(tourney, show_misc_table_links=True) num_losing_games = cgicommon.int_or_none(form.getfirst("numlosinggames", 3))
def add_column(self, column): self.columns.append(column) def get_columns(self): return self.columns[:] baseurl = "/cgi-bin/sql.py" cgitb.enable() cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") cgicommon.print_html_head("Raw SQL interface") cgicommon.assert_client_from_localhost() form = cgi.FieldStorage() request_method = os.environ.get("REQUEST_METHOD", "") sql_text = None execute_sql = None tourney_name = form.getfirst("tourney") error_text = None error_text_context = "" db = None result_rows = [] num_result_cols = 0 num_rows_affected = None
cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") baseurl = "/cgi-bin/displayoptions.py" form = cgi.FieldStorage() tourney_name = form.getfirst("tourney") tourney = None request_method = os.environ.get("REQUEST_METHOD", "") cgicommon.set_module_path() import countdowntourney cgicommon.print_html_head("Display setup: " + str(tourney_name), "style.css") cgicommon.writeln("<body>") cgicommon.writeln("<script>") cgicommon.writeln(""" function clearBannerEditBox() { document.getElementById("bannereditbox").value = ""; } """) cgicommon.writeln("</script>") cgicommon.assert_client_from_localhost() if tourney_name is None: cgicommon.writeln("<h1>No tourney specified</h1>")
venue = form.getfirst("venue") date_year = form.getfirst("dateyear") date_month = form.getfirst("datemonth") date_day = form.getfirst("dateday") show_draws_column = int_or_none(form.getfirst("showdrawscolumn")) accessible_tables_default = int_or_none( form.getfirst("accessibletablesdefault")) accessible_tables_string = form.getfirst("accessibletables") if not accessible_tables_string: accessible_tables_string = "" rules_submit = form.getfirst("rulessubmit") tourney = None request_method = os.environ.get("REQUEST_METHOD", "") cgicommon.print_html_head("Tourney Setup: " + str(tourneyname)) cgicommon.writeln( "<body onload=\"textAreaChange(); playerListExtraHelpShow();\">") cgicommon.writeln("<script>") cgicommon.writeln(""" function set_player_list_example(which) { var element = document.getElementById("playerlistexamplepre"); if (element == null) return; switch (which) { """) for (num, text) in [
import countdowntourney cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") baseurl = "/cgi-bin/delround.py" form = cgi.FieldStorage() round_no = int_or_none(form.getfirst("round")) confirm = int_or_none(form.getfirst("confirm")) tourneyname = form.getfirst("tourney") tourney = None request_method = os.environ.get("REQUEST_METHOD", "") cgicommon.print_html_head("Delete round: " + str(tourneyname)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() if tourneyname is not None: try: tourney = countdowntourney.tourney_open(tourneyname, cgicommon.dbdir) except countdowntourney.TourneyException as e: cgicommon.show_tourney_exception(e) if tourneyname is None: cgicommon.show_sidebar(None) cgicommon.writeln("<div class=\"mainpane\">") cgicommon.writeln("<h1>Delete round</h1>")
csv_event_code = "" if csv_game_format is None: csv_game_format = "" import countdowntourney if tourney_name is None: show_error("No tourney specified") sys.exit(0) if export_format is None: # No format specified: display a list of possible formats to choose from cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") started_html = True cgicommon.print_html_head("Tournament report: " + str(tourney_name)) cgicommon.writeln("<body>") tourney = countdowntourney.tourney_open(tourney_name, cgicommon.dbdir) cgicommon.show_sidebar(tourney) cgicommon.writeln("<div class=\"mainpane\">") html = """<h1>Choose export format</h1> <p> How do you want to export results? </p> <p> <a href="$BASEURL?tourney=$TOURNEY&format=html" target="_blank">HTML $NEWWINDOW</a> - a single HTML page containing standings and results.
cgicommon.writeln("Content-Type: text/html; charset=utf-8") cgicommon.writeln("") baseurl = "/cgi-bin/fixtureedit.py" form = cgi.FieldStorage() tourney_name = form.getfirst("tourney") round_no = form.getfirst("round") tourney = None request_method = os.environ.get("REQUEST_METHOD", "") cgicommon.set_module_path() import countdowntourney cgicommon.print_html_head("Edit fixtures: " + str(tourney_name)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() if not tourney_name: cgicommon.writeln("<h1>No tourney specified</h1>") cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body></html>") sys.exit(0) if not round_no: cgicommon.writeln("<h1>No round number specified</h1>") cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body></html>")
tourney = countdowntourney.tourney_open(tourneyname, cgicommon.dbdir) except countdowntourney.TourneyException as e: fatal_exception(e, None) # Read parameters to adjust how the table is formatted max_columns = int_or_none(form.getfirst("maxcols")) if max_columns is None or max_columns < 1: max_columns = 3 names_per_column = int_or_none(form.getfirst("namespercol")) if names_per_column is None or names_per_column <= 0: names_per_column = 20 min_names_per_column = int_or_none(form.getfirst("minnamespercol")) if min_names_per_column is None or min_names_per_column < 0: min_names_per_column = 5 cgicommon.print_html_head("Table assignment") cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() cgicommon.show_sidebar(tourney, show_misc_table_links=True) cgicommon.writeln("<div class=\"mainpane\">") rd = tourney.get_current_round() if rd is None: cgicommon.writeln("<h1>Table assignment</h1>") cgicommon.writeln("<p>There are no fixtures yet.</p>") else:
exceptions_to_show.append(("<p>Added player \"%s\" but failed to set attributes...</p>" % (cgicommon.escape(new_player_name)), e)) elif request_method == "GET" and form.getfirst("searchsubmit"): player_name = form.getfirst("searchname") try: player = tourney.get_player_from_name(player_name) player_name = player.get_name() player_id = player.get_id() except countdowntourney.TourneyException as e: player = None player_name = None player_id = None exceptions_to_show.append(("", e)) if player: cgicommon.print_html_head(player_name) else: cgicommon.print_html_head("Player View") cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() cgicommon.show_sidebar(tourney) cgicommon.writeln("<div class=\"mainpane\">") cgicommon.writeln("<div class=\"playersetupcontainer\">") cgicommon.writeln("<div class=\"playersetuplistpanecontainer\">") cgicommon.writeln("<div class=\"playersetuplistpane\">")
form = cgi.FieldStorage() tourneyname = form.getfirst("tourney") player_team_submit = form.getfirst("playerteamsubmit") random_assignment_submit = form.getfirst("randomassignmentsubmit") clear_teams_submit = form.getfirst("clearteams") random_group_size = int_or_none(form.getfirst("randomgroupsize")) if random_group_size is None: random_group_size = 6 tourney = None tourney_exception = None player_teams_set = False request_method = os.environ.get("REQUEST_METHOD", "") cgicommon.print_html_head("Hangover Team Setup: " + str(tourneyname)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() if tourneyname is not None: try: tourney = countdowntourney.tourney_open(tourneyname, cgicommon.dbdir) except countdowntourney.TourneyException as e: cgicommon.show_tourney_exception(e) cgicommon.show_sidebar(tourney) if tourneyname and tourney: if request_method == "POST":
def fatal_error(text): cgicommon.print_html_head("Table Index") cgicommon.writeln("<body>") cgicommon.writeln("<p>%s</p>" % (cgicommon.escape(text))) cgicommon.writeln("</body></html>") sys.exit(1)
division_size_multiple = int_or_none(form.getfirst("divsizemultiple")) div_sort = form.getfirst("divsort") if not div_sort or div_sort not in ["standings", "ratings"]: div_sort = "ratings" else: div_sort = "standings" if num_divisions_required is None: num_divisions_required = 1 if division_size_multiple is None: division_size_multiple = 2 tourney = None request_method = os.environ.get("REQUEST_METHOD", "") cgicommon.print_html_head("Division Setup: " + str(tourneyname)) cgicommon.writeln("<body onload=\"hide_div_renames();\">") cgicommon.writeln(""" <script> function show_div_rename(div) { buttondiv = document.getElementById("divrenamebutton" + div.toString()); renamediv = document.getElementById("divrenamecontrols" + div.toString()); textbox = document.getElementById("newdivnameinput" + div.toString()) buttondiv.style.display = "none"; renamediv.style.display = "inline"; textbox.focus(); textbox.select(); }
cgicommon.writeln("<td class=\"fixgentable fixgen\">") cgicommon.writeln( "<a href=\"/cgi-bin/fixturegen.py?generator=%s&tourney=%s\">%s</a>" % (urllib.parse.quote_plus(module_name), urllib.parse.quote_plus(tourney_name), cgicommon.escape(fixgen_module.name))) cgicommon.writeln("</td>") #cgicommon.writeln("<td class=\"fixgentable fixgenmodule\">%s</td>" % (cgicommon.escape(module_name))); cgicommon.writeln( "<td class=\"fixgentable fixgendescription\">%s</td>" % (cgicommon.escape(fixgen_module.description))) cgicommon.writeln("</tr>") cgicommon.writeln("</table>") cgicommon.print_html_head("Generate Fixtures: " + str(tourney_name)) cgicommon.writeln("<body>") cgicommon.assert_client_from_localhost() if tourney_name is None: cgicommon.show_error_text("No tourney specified.") cgicommon.writeln("<p><a href=\"/cgi-bin/home.py\">Home</a></p>") cgicommon.writeln("</body>") cgicommon.writeln("</html>") sys.exit(0) exception_content = None exceptions_to_show = [] warning_content = None