Skip to content

Scoreboard HTML Configuration

John Clevenger edited this page May 30, 2020 · 10 revisions

Overview

As described at Scoreboard Viewing, PC² supports generation of two sets of HTML scoreboard pages: a public set which shows the current standings taking into account any configured "scoreboard freeze period", and a private set which show the current, actual standings ignoring any scoreboard freeze period.

PC² initially generates standings in the form of a hierarchical XML document string, and then uses XSL Transformations (XSLT) to map those standings into various HTML documents. The XSL Transformations which PC² uses to control the mapping from XML standings to formatted HTML are contained in the folder data/xsl under the PC² installation directory. There is one .xsl file in the folder for each of the types of HTML files which PC² generates (actually, more correctly, it is the presence of an XSL file in the data/xsl directory which causes a corresponding HTML file to be generated). The standard PC² distribution includes XSL files for the following pages:

  • full, which contains the full standings including rank, team name, number of problems solved, and penalty time, listed in team rank order.
  • fullnums, same as full but also includes the team number in the "name" column.
  • summary, which in addition to the data shown in full also shows per-problem details of attempts and solutions by team.
  • sumatt, a summary of problem attempts and whether or not the problem was solved, ordered by team name (instead of by rank).
  • sumtime, a summary like sumatt but also showing (for solved problems) the time of solution.
  • index, a file containing the same data as summary, but augmented with a contest title, scoreboard status message indicating whether it is a "live" or "frozen" scoreboard, and formatted using embedded CSS stylesheet data.

These files can be replaced by the user with XSLT files specifying any alternative desired transformations. The user can also add additional .xsl files to the data/xsl directory to cause automatic generation of additional HTML files. Each generated HTML file has a name corresponding to a .xsl file in the data/xsl directory, with .html appended as a suffix (replacing the .xsl suffix).

XML Standings Format

Modifying the XSL Transformations used to generate the output HTML, or adding new XSL Transformation files, requires an understanding of the format of the XML standings string which acts as input to the XSL Transformations. The standings string is a hierarchical XML document tree based on the PC² class XMLMemento, an instance of which is created by class DefaultScoringAlgorithm (which is the class used to generate current standings).

The root of the standings XML document tree is a node named contestStandings. Beneath this root node lies a child node named standingsHeader which contains fields such as title, scoreboardMessage, systemName, systemVersion, etc. The title field is initialized to the contest title as given in the contest configuration (or to the string "title" if no contest title has been defined).

The scoreboardMessage field is initialized to the string "Live (unfrozen) Scoreboard" if the DefaultScoringAlgorithm has been configured to ignore any "scoreboard freeze" period; if DefaultScoringAlgorithm has been told to respect the configured scoreboard freeze period then the scoreboardMessage is initialized to a message like "Scoreboard will be frozen with XXX minutes remaining" or "Scoreboard was frozen with XXX minutes remaining", depending on whether the start of the scoreboard freeze period has been reached.

The contestStandings node also contains child nodes problemCount, containing the number of problems in the contest; siteCount, containing the number of PC² sites in the contest; groupCount, containing the number of defined team groups in the contest; and groupList, itself a tree containing group child nodes, each of which has an id, title, externalId, and pc2site field describing each group defined in the contest. contestStandings also contains additional nodes such as colorList, a sub-tree containing the balloon colors associated with each contest problem. Finally, contestStandings contains a complete subtree containing all the team standings in ranked order.

The fields in the XML standings string can be accessed by name in XSL transformations. For example the title field in the standingsHeader component of contestStandings can be referenced in XSL using the XSL value-of operator using xsl:value-of select="/contestStandings/standingsHeader/@title"/.

The following fields in the XML standings document can be included in XSL documents (.xsl files) used to generate HTML documents by referencing the field names (all field names are part of the contestStandings node and hence must be prefixed with /contestStandings/):

Field name Value
standingsHeader/@title The contest title
standingsHeader/@systemName The formal name of the PC² system
standingsHeader/@systemVersion The PC² version number
standingsHeader/@systemURL The URL for PC²
standingsHeader/@currentDate The date and time at which the standings were generated
standingsHeader/@scoreboardMessage The scoreboard status message associated with the standings (e.g. whether the standings are for a "Live" (private) or "Frozen" (public) scoreboard
@problemCount The number of contest problems represented in the standings
@siteCount The number of PC² sites in the contest
@groupCount The number of team groups defined in the contest
groupList/group/@id The id of a group
groupList/group/@title The title of a group
groupList/group/@externalId The "external ID" (e.g. from the ICPC Contest Management System) associated with a group
groupList/group/@pc2Site The PC² site with which the group is associated
colorList/colors/@id The ID of a balloon color
colorList/colors/@siteNum The PC² site which with this balloon color is associated
colorList/colors/problem/@id The ID of the problem which this balloon color is associated with
colorList/colors/problem/@color The "name" of the balloon color for this problem (e.g., "Blue")
teamStanding/@teamId The team number (login account number); for example, the teamId for Team 5 at Site 2 is "5" (note that team numbers are site specific; there can exist a "Team 5" at multiple sites)
teamStanding/@teamName The display name for this team
teamStanding/@firstSolved The first problem solved by this team
teamStanding/@lastSolved The last problem solved by this team
teamStanding/@points The penalty points accrued by this team for solved problems
teamStanding/@solved The total number of problems solved by this team
teamStanding/@rank The current rank of this team
teamStanding/@index The index of this team in the standings (could be different from rank, due to ties)
teamStanding/@teamSiteId The PC² site number for this team
teamStanding/@teamKey A key which uniquely identifies this team contest-wide; for example, the teamKey for Team 5 at Site 2 is "2Team5"
teamStanding/@teamExernalId The external id associated with this team
teamStanding/@shortSchoolName The shortened form of the name of this team's
teamStanding/@teamAlias The alias for this team (if any)
teamStanding/@groupRank The ranking of this team within its group
teamStanding/@teamGroupName The name of the group which this team is in
teamStanding/@teamGroupId The group ID for the group which this team is in
teamStanding/@teamGroupExternalId The external ID for the group which this team is in
teamStanding/@scoringAdjustment An integer scoring adjustment which is applied to this team's score (normally zero)
teamStanding/problemSummaryInfo/@index The index number of a problem
teamStanding/problemSummaryInfo/@problemId The ID of a problem
teamStanding/problemSummaryInfo/@attempts The number of attempts this team has made on this problem
teamStanding/problemSummaryInfo/@points The number of penalty points accrued on this problem
teamStanding/problemSummaryInfo/@solutionTime The time at which the problem was solved (if solved)
teamStanding/problemSummaryInfo/@isSolved Whether or not the problem has been solved by this team
teamStanding/problemSummaryInfo/@isPending Whether or not the team has a pending submission for this problem
teamStanding/problemSummaryInfo/@totalAttempts The total number of submissions which this team has made on all problems
teamStanding/problemSummaryInfo/@problemsAttempted The total number of different problems for which this team has attempted a solution
@medianProblemsSolved The median number of problems solved by all teams
problem/@id The ID of a problem
problem/@title The text title of the problem
problem/@attempts The total number of attempts made on this problem by all teams
problem/@numberSolved The total number of team who have solved this problem
problem/@bestSolutionTime The time of first solution of this problem
problem/@lastSolutionTime The time of the most recent solution of this problem
@totalAttempts The total number of submissions by all teams
@totalSolved The total number of correct problem solutions by all teams
problemsAttempted The total number of submissions by all teams

XSL Transformation Example

The following listings show portions of the default XSL Transformation which maps an XML standings string into the full.html page.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:decimal-format decimal-separator="." grouping-separator="," />

The above specifies that the file contains an XSL stylesheet (xsl:stylesheet) whose form is based on the XML Namespace (xmlns:xsl=...) defined at the specified URL, that the output is to be HTML with indentation and using "period" as the decimal/fractional separator and "comma" as the decimal group separator.

<xsl:template match="contestStandings">
    <HTML>
        <HEAD>
<TITLE>
Full Info - <xsl:value-of select="/contestStandings/standingsHeader/@title"/>
</TITLE>
<META HTTP-EQUIV="EXPIRES" CONTENT="0"/>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"/>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"/>
        </HEAD>

The above specifies the beginning of the HTML document, defining a <HEAD> section containing a <TITLE> line and several HTML <META HTTP> tags. The value for the title is set to be the string "Full Info -" followed by the value of the attribute @title pulled from the contestStandings/standingsHeader element in the contest standings XML string.

        <BODY>
            <TABLE border="0">
                <tr><th><strong><u>Rank</u></strong></th><th><strong><u>Name</u></strong></th><th><strong><u>Solved</u></strong></th><th><strong><u>Time</u></strong></th></tr>
                <xsl:call-template name="teamStanding"/>
            </TABLE>

The above defines the body of the HTML document to be a table with a single table-header row followed by a series table rows each of whose contents is defined by an XSL template named teamStanding (see below).

Created by <A HREF="http://pc2.ecs.csus.edu/">CSUS PC^2 <xsl:value-of select="/contestStandings/standingsHeader/@systemVersion"/></A><br/>
<A HREF="http://pc2.ecs.csus.edu/">http://pc2.ecs.csus.edu/</A><br/>
Last updated
<xsl:value-of select="/contestStandings/standingsHeader/@currentDate"/>
</p>
        </BODY>
    </HTML>

The above completes the HTML document body (and the HTML document) by adding a footer consisting of various data elements pulled from the contestStandings/standingsHeader XML node, including the version of PC² which was used to generate the standings as well as the current date.

</xsl:template>
        <xsl:template name="teamStanding">
            <xsl:for-each select="teamStanding">
                <tr>
                  <td><xsl:value-of select="@rank"/></td>
                  <td><xsl:value-of select="@teamName"/></td>
                  <td align="center"><xsl:value-of select="@solved"/></td>
                  <td align="right"><xsl:value-of select="@points"/></td>
                </tr>
            </xsl:for-each>
        </xsl:template>
</xsl:stylesheet>

The above defines the template for each table data row showing the standings for a single team. The template selects each teamStanding element from the XML tree and displays the value of that team's rank, teamName, solved (total number of problems solved), and points (penalty points) in a table data item in the current row..

Using formatting similar to the above, the user can arrange to have the HTML output generated by PC² to have any desired appearance, simply by replacing the corresponding XSL file in the data/xsl folder with the desired XSL transformation file.

See Also

PC2 Logo

Clone this wiki locally