Esempio n. 1
0
        $classes = array();
        if (!isset($activecontests[$row['probid']])) {
            $classes[] = 'disabled';
        }
        $link = '<a href="problem.php?id=' . urlencode($row['probid']) . '">';
        echo "<tr class=\"" . implode(' ', $classes) . "\"><td>" . $link . "p" . specialchars($row['probid']) . "</a>" . "</td><td>" . $link . specialchars($row['name']) . "</a>" . "</td><td>" . $link . specialchars(isset($activecontests[$row['probid']]) ? $activecontests[$row['probid']] : 0) . "</a>" . "</td><td>" . $link . (int) $row['timelimit'] . "</a>" . "</td><td>" . $link . (isset($row['memlimit']) ? (int) $row['memlimit'] : 'default') . "</a>" . "</td><td>" . $link . (isset($row['outputlimit']) ? (int) $row['outputlimit'] : 'default') . "</a>" . "</td><td><a href=\"testcase.php?probid=" . $row['probid'] . "\">" . $row['testcases'] . "</a></td>";
        if (!empty($row['problemtext_type'])) {
            echo '<td title="view problem description">' . '<a href="problem.php?id=' . urlencode($row['probid']) . '&amp;cmd=viewtext"><img src="../images/' . urlencode($row['problemtext_type']) . '.png" alt="problem text" /></a></td>';
        } else {
            echo '<td></td>';
        }
        if (IS_ADMIN) {
            echo '<td title="export problem as zip-file">' . exportLink($row['probid']) . '</td>' . "<td class=\"editdel\">" . editLink('problem', $row['probid']) . "&nbsp;" . delLink('problem', 'probid', $row['probid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('problem') . "</p>\n\n";
    if (class_exists("ZipArchive")) {
        $selected_cid = $cid === null ? -1 : $cid;
        $contests = $DB->q("KEYVALUETABLE SELECT cid,\n\t\t                    CONCAT('c', cid, ': ', shortname, ' - ', name) FROM contest");
        $values = array(-1 => 'Do not link to a contest');
        foreach ($contests as $cid => $contest) {
            $values[$cid] = $contest;
        }
        echo "\n" . addForm('problem.php', 'post', null, 'multipart/form-data') . 'Contest: ' . addSelect('contest', $values, $selected_cid, true) . 'Problem archive(s): ' . addFileField('problem_archive[]', null, ' required multiple accept="application/zip"') . addSubmit('Upload', 'upload') . addEndForm() . "\n";
    }
}
require LIBWWWDIR . '/footer.php';
Esempio n. 2
0
    echo addInput('data[0][special_compare_args]', @$row['special_compare_args'], 30, 255);
    ?>
</td></tr>

</table>

<?php 
    echo addHidden('cmd', $cmd) . addHidden('table', 'problem') . addHidden('referrer', @$_GET['referrer']) . addSubmit('Save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate') . addEndForm();
    if (class_exists("ZipArchive")) {
        $selected_cid = $cid === null ? -1 : $cid;
        $contests = $DB->q("KEYVALUETABLE SELECT cid, CONCAT('c', cid, ': ' , shortname, ' - ', name) FROM contest");
        $values = array(-1 => 'Do not add / update contest data');
        foreach ($contests as $cid => $contest) {
            $values[$cid] = $contest;
        }
        echo "<br /><em>or</em><br /><br />\n" . addForm($pagename, 'post', null, 'multipart/form-data') . addHidden('id', @$row['probid']) . 'Contest: ' . addSelect('contest', $values, $selected_cid, true) . '<label for="problem_archive__">Upload problem archive:</label>' . addFileField('problem_archive[]') . addSubmit('Upload', 'upload') . addEndForm();
    }
    require LIBWWWDIR . '/footer.php';
    exit;
}
$data = $DB->q('TUPLE SELECT p.probid,p.name,
                             p.timelimit,p.memlimit,p.outputlimit,
                             p.special_run,p.special_compare,p.special_compare_args,
                             p.problemtext_type, count(rank) AS ntestcases
                FROM problem p
                LEFT JOIN testcase USING (probid)
                WHERE probid = %i GROUP BY probid', $id);
if (!$data) {
    error("Missing or invalid problem id");
}
if (!isset($data['memlimit'])) {
            // Our color field can be both a HTML color name and an RGB value,
            // so we output it only in the human-readable field "color" and
            // leave the field "rgb" unset.
            $problem['color'] = $prob['color'];
            $contest_data['problems'][] = $problem;
        }
    }
    $yaml = Spyc::YAMLDump($contest_data);
    echo $yaml;
    header('Content-type: text/x-yaml');
    header('Content-Disposition: attachment; filename="contest.yaml"');
    exit;
}
$title = "Import / export configuration";
require LIBWWWDIR . '/header.php';
echo "<h1>Import / export configuration</h1>\n\n";
if (isset($_GET['import-ok'])) {
    echo msgbox("Import successful!", "The file " . specialchars(@$_GET['file']) . " is successfully imported.");
}
echo "<h2>Import from YAML</h2>\n\n";
echo addForm('impexp_contestyaml.php', 'post', null, 'multipart/form-data');
echo msgbox("Please note!", "Importing a contest.yaml may overwrite some settings " . "(e.g. penalty time, clarification categories, clarification answers, etc.)." . "This action can not be undone!");
echo addFileField('import_config');
echo addSubmit('Import', 'import') . addEndForm();
echo "<h2>Export to YAML</h2>\n\n";
echo addForm('impexp_contestyaml.php');
echo '<label for="contest">Select contest: </label>';
$contests = $DB->q("KEYVALUETABLE SELECT cid, name FROM contest");
echo addSelect('contest', $contests, null, true);
echo addSubmit('Export', 'export') . addEndForm();
require LIBWWWDIR . '/footer.php';
Esempio n. 4
0
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
$title = 'Executables';
require LIBWWWDIR . '/header.php';
echo "<h1>Executables</h1>\n\n";
// Select all data, sort problems from the current contest on top.
$res = $DB->q('SELECT execid, description, md5sum, type, OCTET_LENGTH(zipfile) AS size
               FROM executable ORDER BY execid');
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No executables defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">type</th>" . "<th scope=\"col\">description</th>" . "<th scope=\"col\">size</th><th scope=\"col\">md5</th>" . "<th></th><th></th></tr></thead>\n<tbody>\n";
    $lastcid = -1;
    while ($row = $res->next()) {
        $link = '<a href="executable.php?id=' . urlencode($row['execid']) . '">';
        echo "<tr><td class=\"execid\">" . $link . htmlspecialchars($row['execid']) . "</a>" . "</td><td>" . $link . htmlspecialchars($row['type']) . "</a>" . "</td><td>" . $link . htmlspecialchars(str_cut($row['description'], 40)) . "</a>" . "</td><td class=\"size\">" . $link . printsize($row['size']) . "</a>" . "</td><td class=\"md5\">" . $link . htmlspecialchars($row['md5sum']) . "</a>" . "</td>";
        if (IS_ADMIN) {
            echo '<td title="export executable as zip-file"><a href="executable.php?fetch&amp;id=' . urlencode($row['execid']) . '"><img src="../images/b_save.png" alt="export" /></a></td>' . "<td class=\"editdel\">" . editLink('executable', $row['execid']) . "&nbsp;" . delLink('executable', 'execid', $row['execid']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('executable') . "</p>\n\n";
    if (class_exists("ZipArchive")) {
        echo "\n" . addForm('executable.php', 'post', null, 'multipart/form-data') . 'Executable archive(s): ' . addSelect('type', $executable_types) . addFileField('executable_archive[]', null, ' required multiple accept="application/zip"') . addSubmit('Upload', 'upload') . addEndForm() . "\n";
    }
}
require LIBWWWDIR . '/footer.php';
Esempio n. 5
0
?>
<h1>Import and Export</h1>

<h2>Import / Export via file up/download</h2>

<ul>
<li><a href="impexp_contestyaml.php">Contest data (contest.yaml)</a></li>
<li><a href="problems.php">Problem archive</a></li>
<li>Tab separated, export:
	<a href="impexp_tsv.php?act=ex&amp;fmt=groups">groups.tsv</a>,
	<a href="impexp_tsv.php?act=ex&amp;fmt=teams">teams.tsv</a>,
	<a href="impexp_tsv.php?act=ex&amp;fmt=scoreboard">scoreboard.tsv</a>,
	<a href="impexp_tsv.php?act=ex&amp;fmt=results">results.tsv</a>
<li>
<?php 
echo addForm('impexp_tsv.php', 'post', null, 'multipart/form-data') . 'Tab separated, import: ' . '<label for="fmt">type:</label> ' . addSelect('fmt', array('groups', 'teams', 'accounts')) . ', <label for="tsv">file:</label>' . addFileField('tsv') . addHidden('act', 'im') . addSubmit('import') . addEndForm();
?>
</li>
</ul>

<h2>Import teams / Upload standings from / to icpc.baylor.edu</h2>

<p>
Create a "Web Services Token" with appropriate rights in the "Export" section
for your contest at <a
href="https://icpc.baylor.edu/login">https://icpc.baylor.edu/login</a>. You can
find the Contest ID (e.g. <code>Southwestern-Europe-2014</code>) in the URL.
</p>

<?php 
echo addForm("impexp_baylor.php");
Esempio n. 6
0
    }
    echo "</script>\n\n";
    ?>
<h3>Create new testcase</h3>

<table>
<tr><td>Input testdata: </td><td><?php 
    echo addFileField('add_input');
    ?>
</td></tr>
<tr><td>Output testdata:</td><td><?php 
    echo addFileField('add_output');
    ?>
</td></tr>
<tr><td>Sample testcase:</td><td><?php 
    echo addSelect('add_sample', array("no", "yes"), 0, true);
    ?>
</td></tr>
<tr><td>Description:    </td><td><?php 
    echo addInput('add_desc', '', 30);
    ?>
</td></tr>
<tr><td>Image:          </td><td><?php 
    echo addFileField('add_image');
    ?>
</td></tr>
</table>
<?php 
    echo "<br />" . addSubmit('Submit all changes') . addEndForm();
}
require LIBWWWDIR . '/footer.php';
Esempio n. 7
0
        if ($data['type'] == 'run') {
            $res = $DB->q('SELECT probid AS id FROM problem
	               WHERE special_run = %s ORDER BY probid', $data['execid']);
            $page = "problem";
            $prefix = "p";
        }
    }
}
$used = FALSE;
if (($data['type'] == 'compare' || $data['type'] == 'run') && dbconfig_get('default_' . $data['type']) == $data['execid']) {
    $used = TRUE;
    echo '<em>default ' . $data['type'] . '</em> ';
}
while ($row = $res->next()) {
    $used = TRUE;
    echo '<a href="' . $page . '.php?id=' . $row['id'] . '">' . $prefix . $row['id'] . '</a> ';
}
if (!$used) {
    echo "<span class=\"nodata\">none</span>";
}
?>
</td></tr>
<?php 
if (IS_ADMIN && class_exists("ZipArchive")) {
    echo '<tr>' . '<td>Executable archive:</td>' . '<td>' . addFileField('executable_archive[]') . addSubmit('Upload', 'upload') . '</td>' . "</tr>\n";
}
echo "</table>\n" . addEndForm();
if (IS_ADMIN) {
    echo "<p>" . '<a href="executable.php?fetch&amp;id=' . urlencode($id) . '"><img src="../images/b_save.png" ' . ' title="export executable as zip-file" alt="export" /></a>' . editLink('executable', $id) . "\n" . delLink('executable', 'execid', $id) . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';