示例#1
0
 }
 // Show JS toggle of previous submission results.
 if ($lastjud !== NULL) {
     echo "<span class=\"testcases_prev\">" . "<a href=\"javascript:togglelastruns();\">show/hide</a> results of previous " . "<a href=\"submission.php?id={$lastsubmitid}\">submission s{$lastsubmitid}</a>" . (empty($lastjud['verify_comment']) ? '' : "<span class=\"prevsubmit\"> (verify comment: '" . $lastjud['verify_comment'] . "')</span>") . "</span>";
 }
 // display following data only when the judging has been completed
 if ($judging_ended) {
     // display verification data: verified, by whom, and comment.
     // only if this is a valid judging, otherwise irrelevant
     if ($jud['valid'] || isset($jud['rejudgingid']) && $jud['rvalid']) {
         $verification_required = dbconfig_get('verification_required', 0);
         if (!($verification_required && $jud['verified'])) {
             $val = !$jud['verified'];
             echo addForm('verify.php') . addHidden('id', $jud['judgingid']) . addHidden('val', $val) . addHidden('redirect', @$_SERVER['HTTP_REFERER']);
         }
         echo "<p>Verified: " . "<strong>" . printyn($jud['verified']) . "</strong>";
         if ($jud['verified'] && !empty($jud['jury_member'])) {
             echo ", by " . specialchars($jud['jury_member']);
             if (!empty($jud['verify_comment'])) {
                 echo ' with comment "' . specialchars($jud['verify_comment']) . '"';
             }
         }
         if (!($verification_required && $jud['verified'])) {
             echo '; ' . addSubmit(($val ? '' : 'un') . 'mark verified', 'verify');
             if ($val) {
                 echo ' with comment ' . addInput('comment', '', 25);
             }
             echo "</p>" . addEndForm();
         } else {
             echo "</p>\n";
         }
示例#2
0
        echo "<p class=\"nodata\">No contests defined</p>\n\n";
    } else {
        $times = array('activate', 'start', 'freeze', 'end', 'unfreeze');
        echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">CID</th>";
        echo "<th scope=\"col\">contest<br />shortname</th>\n";
        echo "<th scope=\"col\">contest<br />name</th>";
        echo "<th scope=\"col\">problem<br />shortname</th>";
        echo "<th scope=\"col\">allow<br />submit</th>";
        echo "<th scope=\"col\">allow<br />judge</th>";
        echo "<th class=\"sorttable_nosort\" scope=\"col\">colour</th>\n";
        echo "</tr>\n</thead>\n<tbody>\n";
        $iseven = false;
        foreach ($res as $row) {
            $link = '<a href="contest.php?id=' . urlencode($row['cid']) . '">';
            echo '<tr class="' . ($iseven ? 'roweven' : 'rowodd') . (!$row['enabled'] ? ' disabled' : '') . '">' . "<td class=\"tdright\">" . $link . "c" . (int) $row['cid'] . "</a></td>\n";
            echo "<td>" . $link . specialchars($row['shortname']) . "</a></td>\n";
            echo "<td>" . $link . specialchars($row['name']) . "</a></td>\n";
            echo "<td>" . $link . specialchars($row['problemshortname']) . "</a></td>\n";
            echo "<td class=\"tdcenter\">" . $link . printyn($row['allow_submit']) . "</a></td>\n";
            echo "<td class=\"tdcenter\">" . $link . printyn($row['allow_judge']) . "</a></td>\n";
            echo !empty($row['color']) ? '<td title="' . specialchars($row['color']) . '">' . $link . '<div class="circle" style="background-color: ' . specialchars($row['color']) . ';"></div></a></td>' : '<td>' . $link . '&nbsp;</a></td>';
            $iseven = !$iseven;
            echo "</tr>\n";
        }
        echo "</tbody>\n</table>\n\n";
    }
}
echo "<h2>Submissions for " . specialchars($data['name']) . "</h2>\n\n";
$restrictions = array('probid' => $id);
putSubmissions($cdatas, $restrictions);
require LIBWWWDIR . '/footer.php';
示例#3
0
          WHERE endtime > %i OR (endtime IS NULL and valid = 1)
          GROUP BY judgehost';
$from = $now - 2 * 60;
$work2min = $DB->q($query, $now, $from, $from);
$from = $now - 10 * 60;
$work10min = $DB->q($query, $now, $from, $from);
$from = $cdata['starttime'];
$workcontest = $DB->q($query, $now, $from, $from);
$clen = difftime($now, $cdata['starttime']);
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No judgehosts defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">hostname</th>" . "<th scope=\"col\">active</th>" . "<th class=\"sorttable_nosort\">status</th>" . "<th class=\"sorttable_nosort\">restriction</th>" . "<th class=\"sorttable_nosort\">load</th></tr>\n" . "</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $link = '<a href="judgehost.php?id=' . urlencode($row['hostname']) . '">';
        echo "<tr" . ($row['active'] ? '' : ' class="disabled"') . "><td>" . $link . printhost($row['hostname']) . '</a>' . "</td><td class=\"tdcenter\">" . $link . printyn($row['active']) . "</a></td>";
        echo "<td class=\"tdcenter ";
        if (empty($row['polltime'])) {
            echo "judgehost-nocon";
            echo "\" title =\"never checked in\">";
        } else {
            $reltime = floor(difftime($now, $row['polltime']));
            if ($reltime < dbconfig_get('judgehost_warning', 30)) {
                echo "judgehost-ok";
            } else {
                if ($reltime < dbconfig_get('judgehost_critical', 120)) {
                    echo "judgehost-warn";
                } else {
                    echo "judgehost-crit";
                }
            }
示例#4
0
<?php

/**
 * View the languages
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
$title = 'Languages';
require LIBWWWDIR . '/header.php';
echo "<h1>Languages</h1>\n\n";
$res = $DB->q('SELECT * FROM language ORDER BY name');
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No languages defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID/ext</th><th scope=\"col\">name</th>" . "<th scope=\"col\">allow<br />submit</th>" . "<th scope=\"col\">allow<br />judge</th><th scope=\"col\">timefactor</th>" . "<th scope=\"col\">extensions</th><th scope=\"col\"></th>" . "</tr>\n</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $link = '<a href="language.php?id=' . urlencode($row['langid']) . '">';
        echo "<tr" . ($row['allow_submit'] ? '' : ' class="disabled"') . "><td>" . $link . specialchars($row['langid']) . "</a>" . "</td><td>" . $link . specialchars($row['name']) . "</a>" . "</td><td>" . $link . printyn($row['allow_submit']) . "</a>" . "</td><td>" . $link . printyn($row['allow_judge']) . "</a>" . "</td><td>" . $link . specialchars($row['time_factor']) . "</a>" . "</td><td>" . $link . specialchars(implode(', ', json_decode($row['extensions']))) . "</a>";
        if (IS_ADMIN) {
            echo "</td><td class=\"editdel\">" . editLink('language', $row['langid']) . "&nbsp;" . delLink('language', 'langid', $row['langid']);
        }
        echo "</td></tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('language') . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
示例#5
0
	               result, verified, valid FROM judging
	               WHERE cid IN (%Ai) AND judgehost = %s
	               ORDER BY starttime DESC, judgingid DESC', $cids, $row['hostname']);
}
if (empty($cids) || $res->count() == 0) {
    echo "<p class=\"nodata\">No judgings.</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">ID</th><th " . "scope=\"col\">started</th><th scope=\"col\">runtime</th><th " . "scope=\"col\">result</th><th scope=\"col\">valid</th><th " . "scope=\"col\">verified</th></tr>\n</thead>\n<tbody>\n";
    while ($jud = $res->next()) {
        if (empty($jud['endtime'])) {
            if ($jud['valid']) {
                $runtime = printtimediff($jud['starttime'], NULL);
            } else {
                $runtime = '[aborted]';
            }
        } else {
            $runtime = printtimediff($jud['starttime'], $jud['endtime']);
        }
        $link = ' href="submission.php?id=' . (int) $jud['submitid'] . '&amp;jid=' . (int) $jud['judgingid'] . '"';
        echo '<tr' . ($jud['valid'] ? '' : ' class="disabled"') . '>';
        echo "<td><a{$link}>j" . (int) $jud['judgingid'] . '</a></td>';
        echo "<td><a{$link}>" . printtime($jud['starttime']) . '</a></td>';
        echo "<td><a{$link}>" . $runtime . '</a></td>';
        echo "<td><a{$link}>" . printresult(@$jud['result'], $jud['valid']) . '</a></td>';
        echo "<td class=\"tdcenter\"><a{$link}>" . printyn($jud['valid']) . '</a></td>';
        echo "<td class=\"tdcenter\"><a{$link}>" . printyn($jud['verified']) . '</a></td>';
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
require LIBWWWDIR . '/footer.php';
示例#6
0
/**
 * View the categories
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
$title = 'Categories';
require LIBWWWDIR . '/header.php';
echo "<h1>Categories</h1>\n\n";
$res = $DB->q('SELECT team_category.*, COUNT(teamid) AS numteams
               FROM team_category LEFT JOIN team USING (categoryid)
               GROUP BY team_category.categoryid ORDER BY sortorder, categoryid');
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No categories defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">sort</th>" . "<th scope=\"col\">name</th><th scope=\"col\">#teams</th>" . "<th scope=\"col\">visible</th><th scope=\"col\"></th></tr>\n" . "</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $link = '<a href="team_category.php?id=' . (int) $row['categoryid'] . '">';
        echo '<tr' . (isset($row['color']) ? ' style="background: ' . $row['color'] . ';"' : '') . '><td>' . $link . (int) $row['categoryid'] . '</a></td><td>' . $link . (int) $row['sortorder'] . '</a></td><td>' . $link . htmlspecialchars($row['name']) . '</a></td><td class="tdright">' . $link . (int) $row['numteams'] . '</a></td><td class="tdcenter">' . $link . printyn($row['visible']) . '</a></td>';
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('team_category', $row['categoryid']) . " " . delLink('team_category', 'categoryid', $row['categoryid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('team_category') . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
示例#7
0
$data = $DB->q('TUPLE SELECT * FROM team_category WHERE categoryid = %i', $id);
if (!$data) {
    error("Missing or invalid category id");
}
if (isset($_GET['edited'])) {
    echo addForm('refresh_cache.php') . msgbox("Warning: Refresh scoreboard cache", "If the category sort order was changed, it may be necessary to " . "recalculate any cached scoreboards.<br /><br />" . addSubmit('recalculate caches now', 'refresh')) . addHidden('cid', $id) . addEndForm();
}
echo "<h1>Category: " . specialchars($data['name']) . "</h1>\n\n";
echo "<table>\n";
echo '<tr><td>ID:</td><td>' . specialchars($data['categoryid']) . "</td></tr>\n";
echo '<tr><td>Name:</td><td>' . specialchars($data['name']) . "</td></tr>\n";
echo '<tr><td>Sortorder:</td><td>' . specialchars($data['sortorder']) . "</td></tr>\n";
if (isset($data['color'])) {
    echo '<tr><td>Colour:       </td><td style="background: ' . specialchars($data['color']) . ';">' . specialchars($data['color']) . "</td></tr>\n";
}
echo '<tr><td>Visible:</td><td>' . printyn($data['visible']) . "</td></tr>\n";
echo "</table>\n\n";
if (IS_ADMIN) {
    echo "<p>" . editLink('team_category', $data['categoryid']) . "\n" . delLink('team_category', 'categoryid', $data['categoryid'], $data['name']) . "</p>\n\n";
}
echo "<h2>Teams in " . specialchars($data['name']) . "</h2>\n\n";
$listteams = array();
$teams = $DB->q('SELECT teamid,name FROM team WHERE categoryid = %i', $id);
if ($teams->count() == 0) {
    echo "<p class=\"nodata\">no teams</p>\n\n";
} else {
    echo "<table class=\"list\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">teamname</th></tr>\n" . "</thead>\n<tbody>\n";
    while ($team = $teams->next()) {
        $listteams[] = $team['teamid'];
        $link = '<a href="team.php?id=' . urlencode($team['teamid']) . '">';
        echo "<tr><td>" . $link . "t" . specialchars($team['teamid']) . "</a></td><td>" . $link . specialchars($team['name']) . "</a></td></tr>\n";
示例#8
0
/**
 * Print a list of clarifications in a table with links to the clarifications.
 */
function putClarificationList($clars, $team = NULL)
{
    global $username, $cids;
    if ($team == NULL && !IS_JURY) {
        error("access denied to clarifications: you seem to be team nor jury");
    }
    echo "<table class=\"list sortable\">\n<thead>\n<tr>" . (IS_JURY ? "<th scope=\"col\">ID</th>" : "") . (IS_JURY && count($cids) > 1 ? "<th scope=\"col\">contest</th>" : "") . "<th scope=\"col\">time</th>" . "<th scope=\"col\">from</th>" . "<th scope=\"col\">to</th><th scope=\"col\">subject</th>" . "<th scope=\"col\">text</th>" . (IS_JURY ? "<th scope=\"col\">answered</th><th scope=\"col\">by</th>" : "") . "</tr>\n</thead>\n<tbody>\n";
    while ($clar = $clars->next()) {
        // check viewing permission for teams
        if (!IS_JURY && !canViewClarification($team, $clar)) {
            continue;
        }
        $clar['clarid'] = (int) $clar['clarid'];
        $link = '<a href="clarification.php?id=' . urlencode($clar['clarid']) . '">';
        if (isset($clar['unread'])) {
            echo '<tr class="unread">';
        } else {
            echo '<tr>';
        }
        if (IS_JURY) {
            echo '<td>' . $link . $clar['clarid'] . '</a></td>';
        }
        echo IS_JURY && count($cids) > 1 ? '<td>' . $link . $clar['contestshortname'] . '</a></td>' : '';
        echo '<td>' . $link . printtime($clar['submittime']) . '</a></td>';
        if ($clar['sender'] == NULL) {
            $sender = 'Jury';
            if ($clar['recipient'] == NULL) {
                $recipient = 'All';
            } else {
                $recipient = htmlspecialchars($clar['toname']);
            }
        } else {
            $sender = htmlspecialchars($clar['fromname']);
            $recipient = 'Jury';
        }
        echo '<td>' . $link . $sender . '</a></td>' . '<td>' . $link . $recipient . '</a></td>';
        echo '<td>' . $link;
        if (is_null($clar['probid'])) {
            echo "general";
        } else {
            echo "problem " . $clar['shortname'];
        }
        echo "</a></td>";
        echo '<td class="clartext">' . $link . summarizeClarification($clar['body']) . "</a></td>";
        if (IS_JURY) {
            unset($answered, $jury_member);
            $claim = FALSE;
            $answered = printyn($clar['answered']);
            if (empty($clar['jury_member'])) {
                $jury_member = '&nbsp;';
            } else {
                $jury_member = htmlspecialchars($clar['jury_member']);
            }
            if (!$clar['answered']) {
                if (empty($clar['jury_member'])) {
                    $claim = TRUE;
                } else {
                    $answered = 'claimed';
                }
            }
            echo "<td>{$link} {$answered}</a></td><td>";
            if ($claim && isset($clar['sender'])) {
                echo "<a class=\"button\" href=\"clarification.php?claim=1&amp;id=" . htmlspecialchars($clar['clarid']) . "\">claim</a>";
            } else {
                if (!$clar['answered'] && $jury_member == $username) {
                    echo "<a class=\"button\" href=\"clarification.php?unclaim=1&amp;id=" . htmlspecialchars($clar['clarid']) . "\">unclaim</a>";
                } else {
                    echo "{$link} {$jury_member}</a>";
                }
            }
            echo "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
示例#9
0
 echo '<tr' . ($inout == 'output' ? ' class="testcase-middle"' : '') . '>';
 if ($inout == 'input') {
     echo "<td rowspan=\"2\" class=\"testrank\">" . "<a href=\"./testcase.php?probid=" . urlencode($probid) . "&amp;rank={$rank}&amp;move=up\">&uarr;</a>{$rank}" . "<a href=\"./testcase.php?probid=" . urlencode($probid) . "&amp;rank={$rank}&amp;move=down\">&darr;</a></td>";
 }
 echo "<td class=\"filename\"><a href=\"./testcase.php?probid=" . urlencode($probid) . "&amp;rank={$rank}&amp;fetch=" . $inout . "\">" . filebase($probid, $rank) . substr($inout, 0, -3) . "</a></td>" . "<td class=\"size\">" . printsize($row["size_{$inout}"]) . "</td>" . "<td class=\"md5\">" . htmlspecialchars($row["md5sum_{$inout}"]) . "</td>";
 if (IS_ADMIN) {
     echo "<td>" . addFileField("update_" . $inout . "[{$rank}]") . "</td>";
 }
 if ($inout == 'input') {
     if (IS_ADMIN) {
         echo "<td rowspan=\"2\"\tclass=\"testsample\" onclick=\"editTcSample({$rank})\">" . addSelect("sample[{$rank}]", array("no", "yes"), $row['sample'], true) . "</td>";
         // hide sample dropdown field if javascript is enabled
         echo "<script type=\"text/javascript\" language=\"JavaScript\">" . "hideTcSample({$rank}, '" . printyn($row['sample']) . "');</script>";
         echo "<td class=\"testdesc\" onclick=\"editTcDesc({$rank})\">" . "<textarea id=\"tcdesc_{$rank}\" name=\"description[{$rank}]\" cols=\"50\" rows=\"1\">" . htmlspecialchars($row['description']) . "</textarea></td>" . "<td rowspan=\"2\" class=\"editdel\">" . "<a href=\"delete.php?table=testcase&amp;testcaseid={$row['testcaseid']}&amp;referrer=" . urlencode('testcase.php?probid=' . $probid) . "\">" . "<img src=\"../images/delete.png\" alt=\"delete\"" . " title=\"delete this testcase\" class=\"picto\" /></a></td>";
     } else {
         echo "<td rowspan=\"2\" align=\"testsample\">" . printyn($row['issample']) . "</td>";
         echo "<td class=\"testdesc\">" . htmlspecialchars($row['description']) . "</td>";
     }
 } else {
     echo '<td class="testimage filename">';
     if ($row['size_image']) {
         echo "<a href=\"./testcase.php?probid=" . urlencode($probid) . "&amp;rank={$rank}&amp;fetch=image\">" . filebase($probid, $rank) . $row['image_type'] . "</a>";
     } else {
         echo '<span class="nodata">No image.</span>';
     }
     if (IS_ADMIN) {
         echo '&nbsp;' . addFileField("update_image[{$rank}]");
     }
     echo "</td>";
 }
 echo "</tr>\n";
示例#10
0
/**
 * Print a list of submissions from contests contained in the $cdatas
 * contest data array, either all or only those that match
 * <key> [= <value>] pairs specified in $restrictions:
 *  - 'verified'  if set, only list submissions that are verified
 *  - 'judged'    if set, only list submissions with completed judgings
 *  - 'teamid', 'probid', 'langid', 'categoryid', 'judgehost' can be
 *    set to an ID to filter on that respective team, language, etc.
 * Output is limited to the number $limit, or unlimited by default.
 * If $highlight is a submission ID, then that one is highlighted.
 */
function putSubmissions($cdatas, $restrictions, $limit = 0, $highlight = null)
{
    global $DB, $username;
    /* We need two kind of queries: one for all submissions, and one
     * with the results for the valid ones.
     */
    $cids = array_keys($cdatas);
    $verifyclause = '';
    if (isset($restrictions['verified'])) {
        if ($restrictions['verified']) {
            $verifyclause = 'AND (j.verified = 1) ';
        } else {
            $verifyclause = 'AND (j.verified = 0 OR (j.verified IS NULL AND s.judgehost IS NULL)) ';
        }
    }
    $judgedclause = '';
    if (isset($restrictions['judged'])) {
        if ($restrictions['judged']) {
            $judgedclause = 'AND (j.result IS NOT NULL) ';
        } else {
            $judgedclause = 'AND (j.result IS NULL) ';
        }
    }
    $rejudgingclause = '';
    if (isset($restrictions['rejudgingdiff'])) {
        if ($restrictions['rejudgingdiff']) {
            $rejudgingclause = 'AND (j.result != jold.result) ';
        } else {
            $rejudgingclause = 'AND (j.result = jold.result) ';
        }
    }
    if (isset($restrictions['old_result']) && !isset($restrictions['rejudgingid'])) {
        error('cannot specify restriction on old_result without specifying a rejudgingid');
    }
    // Special case the rejudgingid restriction by showing the
    // corresponding judging and the old (active) judging result:
    $sqlbody = 'FROM submission s
	     LEFT JOIN team           t  USING (teamid)
	     LEFT JOIN problem        p  USING (probid)
	     LEFT JOIN contestproblem cp USING (probid, cid)
	     LEFT JOIN language       l  USING (langid) ' . (isset($restrictions['rejudgingid']) ? 'LEFT JOIN judging        j    ON (s.submitid = j.submitid    AND j.rejudgingid = %i)
	     LEFT JOIN judging        jold ON (j.prevjudgingid IS NULL AND s.submitid = jold.submitid AND jold.valid = 1 OR j.prevjudgingid = jold.judgingid) ' : 'LEFT JOIN judging        j    ON (s.submitid = j.submitid    AND j.valid = 1) %_ ') . 'WHERE s.cid IN (%Ai) ' . $verifyclause . $judgedclause . $rejudgingclause . (isset($restrictions['teamid']) ? 'AND s.teamid = %i ' : '%_ ') . (isset($restrictions['categoryid']) ? 'AND t.categoryid = %i ' : '%_ ') . (isset($restrictions['probid']) ? 'AND s.probid = %i ' : '%_ ') . (isset($restrictions['langid']) ? 'AND s.langid = %s ' : '%_ ') . (isset($restrictions['judgehost']) ? 'AND s.judgehost = %s ' : '%_ ') . (isset($restrictions['rejudgingid']) ? 'AND (s.rejudgingid = %i OR ' . '     j.rejudgingid = %i) ' : '%_ %_ ') . (isset($restrictions['old_result']) ? 'AND jold.result = %s ' : '%_ ') . (isset($restrictions['result']) ? 'AND j.result = %s ' : '%_ ');
    // No contests; automatically nothing found and the query can not be run...
    if (empty($cids)) {
        echo "<p class=\"nodata\">No submissions</p>\n\n";
        return;
    }
    $res = $DB->q('SELECT s.submitid, s.teamid, s.probid, s.langid, s.cid,
	               s.submittime, s.judgehost, s.valid, t.name AS teamname,
	               cp.shortname, p.name AS probname, l.name AS langname,
	               j.result, j.judgehost, j.verified, j.jury_member, j.seen ' . (isset($restrictions['rejudgingid']) ? ', jold.result AS oldresult ' : '') . $sqlbody . 'ORDER BY s.submittime DESC, s.submitid DESC ' . ($limit > 0 ? 'LIMIT 0, %i' : '%_'), @$restrictions['rejudgingid'], $cids, @$restrictions['teamid'], @$restrictions['categoryid'], @$restrictions['probid'], @$restrictions['langid'], @$restrictions['judgehost'], @$restrictions['rejudgingid'], @$restrictions['rejudgingid'], @$restrictions['old_result'], @$restrictions['result'], $limit);
    // nothing found...
    if ($res->count() == 0) {
        echo "<p class=\"nodata\">No submissions</p>\n\n";
        return;
    }
    if (IS_JURY) {
        echo addForm('submission.php');
    }
    // print the table with the submissions.
    // table header
    echo "<table class=\"list sortable\">\n<thead>\n<tr>" . (IS_JURY ? "<th scope=\"col\" class=\"sorttable_numeric\">ID</th>" : '') . (IS_JURY && count($cids) > 1 ? "<th scope=\"col\" class=\"sorttable_numeric\">contest</th>" : '') . "<th scope=\"col\">time</th>" . (IS_JURY ? "<th scope=\"col\">team</th>" : '') . "<th scope=\"col\">problem</th>" . "<th scope=\"col\">lang</th>" . "<th scope=\"col\">result</th>" . (IS_JURY ? "<th scope=\"col\">verified</th><th scope=\"col\">by</th>" : '') . (IS_JURY && isset($restrictions['rejudgingid']) ? "<th scope=\"col\">old result</th>" : '') . "</tr>\n</thead>\n<tbody>\n";
    // print each row with links to detailed information
    $iseven = $subcnt = $corcnt = $igncnt = $vercnt = $quecnt = 0;
    while ($row = $res->next()) {
        $sid = (int) $row['submitid'];
        // always provide link if this is Jury. For team, provide link
        // to a different page, provided that the result is actually
        // present and valid.
        if (IS_JURY) {
            // If rejudging list, link to the new rejudging:
            $linkurl = 'submission.php?id=' . $sid . (isset($restrictions['rejudgingid']) ? '&amp;rejudgingid=' . $restrictions['rejudgingid'] : '');
            $link = ' href="' . $linkurl . '"';
        } elseif ($row['submittime'] < $cdatas[$row['cid']]['endtime'] && $row['result'] && $row['valid'] && (!dbconfig_get('verification_required', 0) || $row['verified'])) {
            $link = ' href="submission_details.php?id=' . $sid . '"';
        } else {
            $link = '';
        }
        echo "<tr class=\"" . ($iseven ? 'roweven' : 'rowodd');
        $iseven = !$iseven;
        if ($row['valid']) {
            $subcnt++;
        } else {
            $igncnt++;
            echo ' sub_ignore';
        }
        if ($sid == $highlight) {
            echo ' highlight';
        }
        if (!IS_JURY && !$row['seen']) {
            echo ' unseen';
        }
        echo '">';
        if (IS_JURY) {
            echo "<td><a{$link}>s{$sid}</a></td>";
        }
        if (IS_JURY && count($cids) > 1) {
            echo "<td><a{$link}>c{$row['cid']}</a></td>";
        }
        echo "<td><a{$link}>" . printtime($row['submittime']) . "</a></td>";
        if (IS_JURY) {
            echo '<td title="t' . htmlspecialchars($row['teamid']) . '">' . "<a{$link}>" . htmlspecialchars(str_cut($row['teamname'], 30)) . '</a></td>';
        }
        echo '<td class="probid" title="' . htmlspecialchars($row['probname']) . '">' . "<a{$link}>" . htmlspecialchars($row['shortname']) . '</a></td>';
        echo '<td class="langid" title="' . htmlspecialchars($row['langname']) . '">' . "<a{$link}>" . htmlspecialchars($row['langid']) . '</a></td>';
        echo "<td class=\"result\"><a{$link}>";
        if (difftime($row['submittime'], $cdatas[$row['cid']]['endtime']) >= 0) {
            echo printresult('too-late');
            if (IS_JURY && $row['result']) {
                echo " (" . printresult($row['result']) . ")";
            }
        } else {
            if (!$row['result'] || !IS_JURY && !$row['verified'] && dbconfig_get('verification_required', 0)) {
                echo printresult($row['judgehost'] || !IS_JURY ? '' : 'queued');
            } else {
                echo printresult($row['result']);
            }
        }
        echo "</a></td>";
        if (IS_JURY) {
            // only display verification if we're done with judging
            unset($verified, $jury_member);
            $claim = FALSE;
            if (empty($row['result'])) {
                $verified = '&nbsp;';
                $jury_member = '&nbsp;';
            } else {
                $verified = printyn($row['verified']);
                if (empty($row['jury_member'])) {
                    $jury_member = '&nbsp;';
                } else {
                    $jury_member = htmlspecialchars($row['jury_member']);
                }
                if (!$row['verified']) {
                    $vercnt++;
                    if (empty($row['jury_member'])) {
                        $claim = TRUE;
                    } else {
                        $verified = 'claimed';
                    }
                }
            }
            echo "<td><a{$link}>{$verified}</a></td><td>";
            if ($claim) {
                echo "<a class=\"button\" href=\"{$linkurl}&amp;claim=1\">claim</a>";
            } else {
                if (!$row['verified'] && $jury_member == $username) {
                    echo "<a class=\"button\" href=\"{$linkurl}&amp;unclaim=1\">unclaim</a>";
                } else {
                    echo "<a{$link}>{$jury_member}</a>";
                }
            }
            echo "</td>";
            if (isset($restrictions['rejudgingid'])) {
                echo "<td class=\"result\"><a href=\"submission.php?id={$sid}\">" . printresult($row['oldresult']) . "</a></td>";
            }
        }
        echo "</tr>\n";
        if ($row['result'] == 'correct') {
            $corcnt++;
        }
    }
    echo "</tbody>\n</table>\n\n";
    if (IS_JURY) {
        echo addEndForm();
        if ($limit > 0) {
            $query_extras = array('subcnt' => '', 'corcnt' => ' AND j.result LIKE \'correct\'', 'igncnt' => ' AND s.valid = 0', 'vercnt' => ' AND verified = 0 AND result IS NOT NULL', 'quecnt' => ' AND result IS NULL');
            foreach ($query_extras as $cnt => $query_extra) {
                ${$cnt} = $DB->q('VALUE SELECT count(s.submitid) ' . $sqlbody . $query_extra, @$restrictions['rejudgingid'], $cids, @$restrictions['teamid'], @$restrictions['categoryid'], @$restrictions['probid'], @$restrictions['langid'], @$restrictions['judgehost'], @$restrictions['rejudgingid'], @$restrictions['rejudgingid'], @$restrictions['old_result'], @$restrictions['result']);
            }
        }
        echo "<p>Total correct: {$corcnt}, submitted: {$subcnt}";
        if ($vercnt > 0) {
            echo ", unverified: {$vercnt}";
        }
        if ($igncnt > 0) {
            echo ", ignored: {$igncnt}";
        }
        if ($quecnt > 0) {
            echo ", judgement pending: {$quecnt}";
        }
        echo "</p>\n\n";
    }
    return;
}
示例#11
0
if (isset($_POST['answer']) && isset($_POST['answered'])) {
    $answered = (int) $_POST['answered'];
    $DB->q('UPDATE clarification SET answered = %i, jury_member = ' . ($answered ? '%s ' : 'NULL %_ ') . 'WHERE clarid = %i', $answered, $jury_member, $respid);
    auditlog('clarification', $respid, 'marked ' . ($answered ? 'answered' : 'unanswered'));
    // redirect back to the original location
    header('Location: clarification.php?id=' . $id);
    exit;
}
require_once LIBWWWDIR . '/header.php';
require LIBWWWDIR . '/clarification.php';
if (!$isgeneral) {
    // display clarification thread
    echo "<h1>Clarification {$id}</h1>\n\n";
    if (!$req['answered']) {
        echo addForm($pagename . '?id=' . urlencode($id));
        echo "<p>Claimed: " . "<strong>" . printyn(!empty($req['jury_member'])) . "</strong>";
        if (empty($req['jury_member'])) {
            echo '; ';
        } else {
            echo ', by ' . specialchars($req['jury_member']) . '; ' . addSubmit('unclaim', 'unclaim') . ' or ';
        }
        echo addSubmit('claim', 'claim') . '</p>' . addEndForm();
    }
    if (!empty($req['respid'])) {
        $orig = $DB->q('MAYBETUPLE SELECT q.*, t.name AS name FROM clarification q
	                LEFT JOIN team t ON (t.teamid = q.sender)
	                WHERE q.clarid = %i', $respid);
        echo '<p>See the <a href="clarification.php?id=' . $respid . '">original clarification ' . $respid . '</a> by ' . ($orig['sender'] == NULL ? 'Jury' : '<a href="team.php?id=' . urlencode($orig['sender']) . '">' . specialchars($orig['name'] . " (t" . $orig['sender'] . ")") . '</a>') . "</p>\n\n";
    }
    putClarification($id, NULL);
    // Display button to (un)set request as 'answered'
示例#12
0
    if (empty($restrictions[$type])) {
        echo "<td class=\"nodata\">none</td></tr>\n";
    } else {
        $first = true;
        foreach ($restrictions[$type] as $val) {
            if (!$first) {
                echo '<tr><td></td>';
            }
            $first = false;
            echo "<td>" . $lists[$type][$val] . "</td></tr>\n";
        }
    }
}
echo '<tr><td>Rejudge by same judgehost:</td><td>' . printyn(!isset($restrictions['rejudge_own']) || (bool) $restrictions['rejudge_own']) . "</td></tr>\n";
echo "</table>\n\n";
if (IS_ADMIN) {
    echo "<p>" . editLink('judgehost_restriction', $data['restrictionid']) . "\n" . delLink('judgehost_restriction', 'restrictionid', $data['restrictionid'], $data['name']) . "</p>\n\n";
}
echo "<h2>Judgehosts having restriction " . specialchars($data['name']) . "</h2>\n\n";
$judgehosts = $DB->q('SELECT hostname, active FROM judgehost WHERE restrictionid = %i', $id);
if ($judgehosts->count() == 0) {
    echo "<p class=\"nodata\">no judgehosts</p>\n\n";
} else {
    echo "<table class=\"list\">\n<thead>\n" . "<tr><th scope=\"col\">hostname</th><th scope=\"col\">active</th></tr>\n" . "</thead>\n<tbody>\n";
    while ($judgehost = $judgehosts->next()) {
        $link = '<a href="judgehost.php?id=' . urlencode($judgehost['hostname']) . '">';
        echo "<tr" . ($judgehost['active'] ? '' : ' class="disabled"') . "><td>" . $link . specialchars($judgehost['hostname']) . "</a></td><td>" . $link . printyn($judgehost['active']) . "</a></td></tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
require LIBWWWDIR . '/footer.php';
示例#13
0
    echo "<p class=\"nodata\">No problems added yet</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">probid</th>";
    echo "<th scope=\"col\">name</th>";
    echo "<th scope=\"col\">shortname</th>";
    echo "<th scope=\"col\">points</th>";
    echo "<th scope=\"col\">allow<br />submit</th>";
    echo "<th scope=\"col\">allow<br />judge</th>";
    echo "<th class=\"sorttable_nosort\" scope=\"col\">colour</th>\n";
    echo "<th scope=\"col\">lazy eval</th>\n";
    echo "</tr>\n</thead>\n<tbody>\n";
    $iseven = false;
    foreach ($res as $row) {
        $link = '<a href="problem.php?id=' . urlencode($row['probid']) . '">';
        echo '<tr class="' . ($iseven ? 'roweven' : 'rowodd') . '">' . "<td class=\"tdright\">" . $link . "p" . (int) $row['probid'] . "</a></td>\n";
        echo "<td>" . $link . htmlspecialchars($row['name']) . "</a></td>\n";
        echo "<td>" . $link . htmlspecialchars($row['shortname']) . "</a></td>\n";
        echo "<td>" . $link . htmlspecialchars($row['points']) . "</a></td>\n";
        echo "<td class=\"tdcenter\">" . $link . printyn($row['allow_submit']) . "</a></td>\n";
        echo "<td class=\"tdcenter\">" . $link . printyn($row['allow_judge']) . "</a></td>\n";
        echo !empty($row['color']) ? '<td title="' . htmlspecialchars($row['color']) . '">' . $link . '<div class="circle" style="background-color: ' . htmlspecialchars($row['color']) . ';"></div></a></td>' : '<td>' . $link . '&nbsp;</a></td>';
        echo "<td>" . $link . (isset($row['lazy_eval_results']) ? printyn($row['lazy_eval_results']) : '-') . "</a></td>\n";
        if (IS_ADMIN) {
            echo "<td>" . delLinkMultiple('contestproblem', array('cid', 'probid'), array($id, $row['probid']), 'contest.php?id=' . $id) . "</td>";
        }
        $iseven = !$iseven;
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
require LIBWWWDIR . '/footer.php';
示例#14
0
?>
<table>
<tr><td>ID/extension:</td><td><?php 
echo specialchars($data['langid']);
?>
</td></tr>
<tr><td>Name:        </td><td><?php 
echo specialchars($data['name']);
?>
</td></tr>
<tr><td>Allow submit:</td><td><?php 
echo printyn($data['allow_submit']) . ' ' . addSubmit('toggle', 'cmd[toggle_submit]', "return confirm('" . ($data['allow_submit'] ? 'Disallow' : 'Allow') . " submissions for this language?')");
?>
</td></tr>
<tr><td>Allow judge: </td><td><?php 
echo printyn($data['allow_judge']) . ' ' . addSubmit('toggle', 'cmd[toggle_judge]', "return confirm('" . ($data['allow_judge'] ? 'Disallow' : 'Allow') . " judging for this language?')");
?>
</td></tr>
<tr><td>Time factor:  </td><td><?php 
echo specialchars($data['time_factor']);
?>
 &times;</td></tr>
<tr><td>Compile script:</td><td class="filename">
<?php 
if (empty($data['compile_script'])) {
    echo '<span class="nodata">none specified</span>';
} else {
    echo '<a href="executable.php?id=' . urlencode($data['compile_script']) . '">' . specialchars($data['compile_script']) . '</a>';
}
?>
</td></tr>