if len(standings) > 0: m = max([len(x[1]) for x in standings]) if m > max_name_len: max_name_len = m for div_index in range(num_divisions): standings = tourney.get_standings(div_index, True) if num_divisions > 1: cgicommon.writeln(tourney.get_division_name(div_index)) header_format_string = "%%-%ds P W%s%s%s%s" % ( max_name_len + 6, " D" if show_draws_column else "", " Pts" if show_points_column else "", " Spr" if show_spread_column else "", " TR" if show_tournament_rating_column else "") cgicommon.writeln(header_format_string % "") for s in standings: cgicommon.write("%3d %-*s %3d %3d " % (s[0], max_name_len, s[1], s[2], s[3])) if show_draws_column: cgicommon.write("%3d " % s[5]) if show_points_column: cgicommon.write("%4d " % s[4]) if show_spread_column: cgicommon.write("%+5d " % s[6]) if show_tournament_rating_column: if s.tournament_rating is not None: cgicommon.write("%7.2f " % s.tournament_rating) else: cgicommon.write(" ") cgicommon.writeln("") cgicommon.writeln("") cgicommon.writeln("")
cgicommon.writeln( "<p><a href=\"/cgi-bin/tourneysetup.py?tourney=%s\">Back to tourney setup</a></p>" % (urllib.parse.quote_plus(tourney_name))) cgicommon.writeln("<div class=\"sqlentry\">") cgicommon.writeln("<h2>Enter SQL query</h2>") cgicommon.writeln( "<form id=\"sqlform\" action=\"%s?tourney=%s\" method=\"POST\">" % (baseurl, urllib.parse.quote_plus(tourney_name))) cgicommon.writeln("<div class=\"sqlentrybox\">") cgicommon.writeln( "<textarea autofocus id=\"sql\" name=\"sql\" style=\"width: 600px; height: 100px;\">" ) if sql_text: cgicommon.write(cgicommon.escape(sql_text)) cgicommon.writeln("</textarea>") cgicommon.writeln("</div>") cgicommon.writeln("<div class=\"sqlentrysubmit\">") #cgicommon.writeln("<input type=\"text\" name=\"sql\" />") cgicommon.writeln( "<input type=\"hidden\" name=\"tourney\" value=\"%s\" />" % (cgicommon.escape(tourney_name))) cgicommon.writeln("<input type=\"hidden\" name=\"execute\" value=\"1\" />") cgicommon.writeln( "<input type=\"hidden\" name=\"nowarning\" value=\"1\" />") cgicommon.writeln( "<input class=\"bigbutton\" type=\"submit\" name=\"submitsql\" value=\"Run SQL (Ctrl-Enter)\" />" ) cgicommon.writeln("</div>")
) cgicommon.writeln("</p>") cgicommon.writeln("<div class=\"playerlist\">") cgicommon.writeln("<div class=\"playerlistpane\">") cgicommon.writeln('<input type="hidden" name="tourney" value="%s" />' % cgicommon.escape(tourneyname)) cgicommon.writeln( '<textarea rows="30" cols="40" name="playerlist" id="playerlist" oninput="textAreaChange();">' ) if request_method == "POST" and playerlist: # If the user has submitted something, display what the user # submitted rather than what's in the database - this gives them # a chance to correct any errors without typing in the whole # change again. cgicommon.write(cgicommon.escape(playerlist).strip()) else: string_stream = io.StringIO() auto_rating = tourney.get_auto_rating_behaviour() writer = csv.writer(string_stream) prev_div_index = 0 # Write player names, or player names and ratings if the user # specified the players' ratings. for p in players: div_index = p.get_division() if div_index != prev_div_index: writer.writerow(("-", )) row = [] row.append(cgicommon.escape(p.get_name())) if auto_rating == countdowntourney.RATINGS_MANUAL or p.get_rating( ) == 0:
cgicommon.writeln("</div>") # viewpreviewswitch cgicommon.writeln("</div>") cgicommon.writeln("</div>") # viewpreviewandoptions cgicommon.writeln("<div style=\"clear: both;\"></div>") cgicommon.writeln("</div>") # viewselection cgicommon.writeln("<div class=\"viewmenu\">") cgicommon.writeln("<div class=\"viewdetails\">") #cgicommon.writeln("<div class=\"viewmenuheading\">Select screen mode</div>") cgicommon.writeln("<div class=\"viewdetailstext\">") cgicommon.writeln("<span style=\"font-weight: bold;\">") cgicommon.write(cgicommon.escape(mode_info["name"])) cgicommon.writeln(": </span>") cgicommon.writeln(cgicommon.escape(mode_info["desc"])) cgicommon.writeln("</div>") # viewdetailstext cgicommon.writeln("</div>") # viewdetails menu_row_size = 5 teleost_modes_sorted = sorted( teleost_modes, key=lambda x: (x.get("menuorder", 100000), x["num"], x["name"])) for idx in range(len(teleost_modes_sorted)): mode = teleost_modes_sorted[idx] if idx % menu_row_size == 0: if idx > 0:
cgicommon.writeln("</span>") cgicommon.writeln("<span style=\"color: gray; float: right;\" title=\"Number of active players in %s\">%d</span>" % ("the tournament" if num_divisions == 1 else "this division", num_active_players)) cgicommon.writeln("</td></tr>") for p in div_players: player_selected = (player and player.get_name() == p.get_name()) cgicommon.writeln("<tr class=\"playerlistrow %s\">" % ("playerlistrowselected" if player_selected else "")); cgicommon.writeln("<td class=\"playerlistname\">"); cgicommon.writeln(cgicommon.player_to_link(p, tourney.get_name(), emboldenise=player_selected, withdrawn=p.is_withdrawn())) cgicommon.writeln("</td>") cgicommon.writeln("<td class=\"playerlistflags\">") if p.get_rating() == 0: cgicommon.write(" <span title=\"Prune\">⚪</span>") if p.is_avoiding_prune(): cgicommon.write(" <span title=\"Swiss fixture generator will behave as if this player has already played a Prune\">⚫</span>") if p.is_requiring_accessible_table(): cgicommon.write(" <span title=\"Requires accessible table\">♿</span>"); pref_table = p.get_preferred_table() if pref_table is not None: cgicommon.write(" <span title=\"Prefers table %d\" class=\"playerlisttablepreficon\">%d</span>" % (pref_table, pref_table)) cgicommon.writeln("</td>") cgicommon.writeln("</tr>") cgicommon.writeln("</table>") cgicommon.writeln("</div>") # end list pane cgicommon.writeln("</div>") # end list pane container cgicommon.writeln("<div class=\"playersetupformpanecontainer\">") cgicommon.writeln("<div class=\"playersetupformpane\">")