Example #1
0
<td><?php 
    echo addInput('data[0][name]', @$row['name'], 40, 255, 'required');
    ?>
</td></tr>

<tr><td><label for="data_0__country_">Country:</label></td>
<td><?php 
    echo addInput('data[0][country]', @$row['country'], 4, 3, 'pattern="[A-Z]{3}" title="three uppercase letters (ISO-3166-1 alpha-3)"');
    ?>
<a target="_blank"
href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Current_codes"><img
src="../images/b_help.png" class="smallpicto" alt="?" /></a></td></tr>

<tr><td><label for="data_0__comments_">Comments:</label></td>
<td><?php 
    echo addTextArea('data[0][comments]', @$row['comments']);
    ?>
</td></tr>

</table>

<?php 
    echo addHidden('cmd', $cmd) . addHidden('table', 'team_affiliation') . addHidden('referrer', @$_GET['referrer']) . addSubmit('Save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate') . addEndForm();
    require LIBWWWDIR . '/footer.php';
    exit;
}
$data = $DB->q('MAYBETUPLE SELECT * FROM team_affiliation WHERE affilid = %s', $id);
if (!$data) {
    error("Missing or invalid affiliation id");
}
$affillogo = "../images/affiliations/" . urlencode($data['affilid']) . ".png";
Example #2
0
/**
 * update event info
 * @return void
 * @access private
 */
function update_event_form()
{
    global $color, $editor_size, $year, $day, $month, $hour, $minute, $calendardata;
    $tmparray = $calendardata["{$month}{$day}{$year}"]["{$hour}{$minute}"];
    $tab = '    ';
    echo "\n<form name=\"eventupdate\" action=\"event_edit.php\" method=\"post\">\n" . $tab . addHidden('year', $year) . $tab . addHidden('month', $month) . $tab . addHidden('day', $day) . $tab . addHidden('hour', $hour) . $tab . addHidden('minute', $minute) . $tab . addHidden('updated', 'yes') . html_tag('tr') . html_tag('td', _("Date:"), 'right', $color[4]) . "\n" . html_tag('td', '', 'left', $color[4]) . "      <select name=\"event_year\">\n";
    select_option_year($year);
    echo "      </select>\n" . "      &nbsp;&nbsp;\n" . "      <select name=\"event_month\">\n";
    select_option_month($month);
    echo "      </select>\n" . "      &nbsp;&nbsp;\n" . "      <select name=\"event_day\">\n";
    select_option_day($day);
    echo "      </select>\n" . "      </td></tr>\n" . html_tag('tr') . html_tag('td', _("Time:"), 'right', $color[4]) . "\n" . html_tag('td', '', 'left', $color[4]) . "      <select name=\"event_hour\">\n";
    select_option_hour($hour);
    echo "      </select>\n" . "      &nbsp;:&nbsp;\n" . "      <select name=\"event_minute\">\n";
    select_option_minute($minute);
    echo "      </select>\n" . "      </td></tr>\n" . html_tag('tr') . html_tag('td', _("Length:"), 'right', $color[4]) . "\n" . html_tag('td', '', 'left', $color[4]) . "      <select name=\"event_length\">\n";
    select_option_length($tmparray['length']);
    echo "      </select>\n" . "      </td></tr>\n" . html_tag('tr') . html_tag('td', _("Priority:"), 'right', $color[4]) . "\n" . html_tag('td', '', 'left', $color[4]) . "      <select name=\"event_priority\">\n";
    select_option_priority($tmparray['priority']);
    echo "      </select>\n" . "      </td></tr>\n" . html_tag('tr') . html_tag('td', _("Title:"), 'right', $color[4]) . "\n" . html_tag('td', addInput('event_title', $tmparray['title'], 30, 50), 'left', $color[4]) . "\n</tr>\n" . html_tag('tr') . html_tag('td', addTextArea('event_text', $tmparray['message'], $editor_size, 5), 'left', $color[4], 'colspan="2"') . '</tr>' . html_tag('tr') . html_tag('td', addSubmit(_("Update Event"), 'send'), 'left', $color[4], 'colspan="2"') . "</tr></form>\n";
}
Example #3
0
/**
 * Output a form to send a new clarification.
 * Set respid to a clarid, to make only responses to same
 * sender(s)/recipient(s) or ALL selectable.
 */
function putClarificationForm($action, $respid = NULL, $onlycontest = NULL)
{
    $cdatas = getCurContests(TRUE);
    if (isset($onlycontest)) {
        $cdatas = array($onlycontest => $cdatas[$onlycontest]);
    }
    $cids = array_keys($cdatas);
    if (empty($cids)) {
        echo '<p class="nodata">No active contests</p>';
        return;
    }
    require_once 'forms.php';
    global $DB;
    ?>

<script type="text/javascript">
<!--
function confirmClar() {
<?php 
    if (IS_JURY) {
        ?>
	var sendto_field = document.forms['sendclar'].sendto;
	var sendto = sendto_field.value;
	var sendto_text = sendto_field.options[sendto_field.selectedIndex].text;

	if ( sendto=='domjudge-must-select' ) {
		alert('You must select a recipient for this clarification.');
		return false;
	}
	return confirm("Send clarification to " + sendto_text + "?");
<?php 
    } else {
        ?>
	return confirm("Send clarification request to Jury?");
<?php 
    }
    ?>
}
// -->
</script>

<?php 
    echo addForm($action, 'post', 'sendclar');
    echo "<table>\n";
    if ($respid) {
        $clar = $DB->q('MAYBETUPLE SELECT c.*, t.name AS toname, f.name AS fromname
		                FROM clarification c
		                LEFT JOIN team t ON (t.teamid = c.recipient)
		                LEFT JOIN team f ON (f.teamid = c.sender)
		                WHERE c.clarid = %i', $respid);
    }
    if (IS_JURY) {
        // list all possible recipients in the "sendto" box
        echo "<tr><td><b><label for=\"sendto\">Send to</label>:</b></td><td>\n";
        if (!empty($respid)) {
            echo addHidden('id', $respid);
        }
        $options = array('domjudge-must-select' => '(select...)', '' => 'ALL');
        if (!$respid) {
            $teams = $DB->q('KEYVALUETABLE SELECT teamid, name
			                 FROM team
			                 ORDER BY categoryid ASC, team.name COLLATE utf8_general_ci ASC');
            $options += $teams;
        } else {
            if ($clar['sender']) {
                $options[$clar['sender']] = $clar['fromname'] . ' (t' . $clar['sender'] . ')';
            } else {
                if ($clar['recipient']) {
                    $options[$clar['recipient']] = $clar['toname'] . ' (t' . $clar['recipient'] . ')';
                }
            }
        }
        echo addSelect('sendto', $options, 'domjudge-must-select', true);
        echo "</td></tr>\n";
    } else {
        echo "<tr><td><b>To:</b></td><td>Jury</td></tr>\n";
    }
    // Select box for a specific problem (only when the contest
    // has started) or general issue.
    $options = array();
    foreach ($cdatas as $cid => $cdata) {
        $row = $DB->q('TUPLE SELECT CONCAT(cid, "-general") AS c
		               FROM contest WHERE cid = %i', $cid);
        if (IS_JURY && count($cdatas) > 1) {
            $options[$row['c']] = "{$cdata['shortname']} - General issue";
        } else {
            $options[$row['c']] = "General issue";
        }
        if (difftime($cdata['starttime'], now()) <= 0) {
            $problem_options = $DB->q('KEYVALUETABLE SELECT CONCAT(cid, "-", probid),
				                             CONCAT(shortname, ": ", name) as name
				        FROM problem
				        INNER JOIN contestproblem USING (probid)
				        WHERE cid = %i AND allow_submit = 1
				        ORDER BY shortname ASC', $cid);
            if (IS_JURY && count($cdatas) > 1) {
                foreach ($problem_options as &$problem_option) {
                    $problem_option = $cdata['shortname'] . ' - ' . $problem_option;
                }
                unset($problem_option);
            }
            $options += $problem_options;
        }
    }
    echo "<tr><td><b>Subject:</b></td><td>\n" . addSelect('problem', $options, $respid ? $clar['cid'] . '-' . $clar['probid'] : 'general', true) . "</td></tr>\n";
    ?>
<tr>
<td><b><label for="bodytext">Text</label>:</b></td>
<td><?php 
    $body = "";
    if ($respid) {
        $text = explode("\n", wrap_unquoted($clar['body']), 75);
        foreach ($text as $line) {
            $body .= "> {$line}\n";
        }
    }
    echo addTextArea('bodytext', $body, 80, 10, 'required');
    ?>
</td></tr>
<tr>
<td>&nbsp;</td>
<td><?php 
    echo addSubmit('Send', 'submit', 'return confirmClar()');
    ?>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
<!--
document.forms['sendclar'].bodytext.focus();
document.forms['sendclar'].bodytext.select();
// -->
</script>
<?php 
}
Example #4
0
        continue;
        // skip directory entries
    }
    $content = $zip->getFromIndex($j);
    if (!mb_check_encoding($content, 'ASCII')) {
        $skippedBinary[] = $filename;
        if ($edit_mode) {
            echo addHidden("skipped[{$j}]", 1);
        }
        continue;
        // skip binary files
    }
    $html .= '<div class="tabbertab' . ((int) @$_GET['rank'] === $j ? ' tabbertabdefault' : '') . '">' . '<h2 class="filename"><a id="source' . $j . '"></a>' . htmlspecialchars($filename) . "</h2>\n\n";
    // FIXME: skip files based on size?
    if ($edit_mode) {
        $html .= addTextArea('texta' . $j, $content, 120, 40) . "<br/>\n";
    } else {
        $html .= "<a href=\"show_executable.php?id=" . urlencode($id) . "&amp;fetch=" . $j . "\">" . "<img class=\"picto\" src=\"../images/b_save.png\" alt=\"download\" title=\"download\" /></a> " . "<a href=\"show_executable.php?edit_source=1&id=" . urlencode($id) . "&amp;rank=" . $j . "\">" . "<img class=\"picto\" src=\"../images/edit.png\" alt=\"edit\" title=\"edit\" />" . "</a>\n\n";
    }
    $html .= '<div class="editor" id="editor' . $j . '">' . htmlspecialchars($content) . '</div>';
    $html .= '<script>' . "\n";
    if ($edit_mode) {
        $html .= 'var textarea = document.getElementById("texta' . $j . '");' . "\n" . 'textarea.style.display = \'none\';' . "\n";
    }
    $html .= 'var editor' . $j . ' = ace.edit("editor' . $j . '");' . "\n" . 'editor' . $j . '.setTheme("ace/theme/eclipse");' . "\n" . 'editor' . $j . '.setOptions({ maxLines: Infinity });';
    if ($edit_mode) {
        $html .= 'editor' . $j . '.getSession().setValue(textarea.value);' . 'editor' . $j . '.getSession().on(\'change\', function(){' . 'var textarea = document.getElementById("texta' . $j . '");' . 'textarea.value = editor' . $j . '.getSession().getValue();' . '});';
    }
    $html .= 'function modefunc' . $j . '() {' . "\n" . '    var modelist = ace.require(\'ace/ext/modelist\');' . "\n" . '    var filePath = "' . $filename . '";' . "\n" . '    var mode = modelist.getModeForPath(filePath).mode;' . "\n" . '    editor' . $j . '.getSession().setMode(mode);' . "\n" . '    editor' . $j . '.setReadOnly(' . (isset($_GET['edit_source']) ? 'false' : 'true') . ');' . "\n" . '};' . ' modefunc' . $j . '();' . "\n" . '</script>';
    $html .= '</div>';
}
Example #5
0
 /**
  * Creates textarea
  * @return string html formated textarea field
  */
 function createWidget_TextArea()
 {
     switch ($this->size) {
         case SMOPT_SIZE_TINY:
             $rows = 3;
             $cols = 10;
             break;
         case SMOPT_SIZE_SMALL:
             $rows = 4;
             $cols = 30;
             break;
         case SMOPT_SIZE_LARGE:
             $rows = 10;
             $cols = 60;
             break;
         case SMOPT_SIZE_HUGE:
             $rows = 20;
             $cols = 80;
             break;
         case SMOPT_SIZE_NORMAL:
         default:
             $rows = 5;
             $cols = 50;
     }
     return addTextArea('new_' . $this->name, $this->value, $cols, $rows, $this->aExtraAttribs);
 }
Example #6
0
if (empty($submission)) {
    error("Submission {$id} not found");
}
$title = 'Edit Source: s' . $id;
require LIBWWWDIR . '/header.php';
echo '<h2><a id="source"></a>Edit submission ' . "<a href=\"submission.php?id={$id}\">s{$id}</a> source files</h2>\n\n";
echo addForm($pagename, 'post', null, 'multipart/form-data');
$sources = $DB->q('TABLE SELECT *
                   FROM submission_file
                   LEFT JOIN submission USING(submitid)
                   WHERE submitid = %i ORDER BY rank', $id);
echo '<script type="text/javascript" src="../js/tabber.js"></script>' . '<script src="../js/ace/ace.js" type="text/javascript" charset="utf-8"></script>' . '<div class="tabber">';
foreach ($sources as $sourcedata) {
    echo '<div class="tabbertab' . ($_GET['rank'] === $sourcedata['rank'] ? ' tabbertabdefault' : '') . '">';
    echo '<h2 class="filename">' . specialchars($sourcedata['filename']) . '</h2>';
    echo addTextArea('source' . $sourcedata['rank'], $sourcedata['sourcecode'], 120, 40) . "<br />\n";
    $editor = 'editor' . specialchars($sourcedata['rank']);
    $langid = langidToAce($submission['langid']);
    echo '<div class="editor" id="' . $editor . '"></div>';
    echo '<script>' . 'var textarea = document.getElementById("source' . specialchars($sourcedata['rank']) . '");' . 'textarea.style.display = \'none\';' . 'var ' . $editor . ' = ace.edit("' . $editor . '");' . $editor . '.setTheme("ace/theme/eclipse");' . $editor . '.getSession().setValue(textarea.value);' . $editor . '.getSession().on(\'change\', function(){' . 'var textarea = document.getElementById("source' . specialchars($sourcedata['rank']) . '");' . 'textarea.value = ' . $editor . '.getSession().getValue();' . '});' . $editor . '.setOptions({ maxLines: Infinity });' . $editor . '.setReadOnly(false);' . $editor . '.getSession().setMode("ace/mode/' . $langid . '");' . '</script>';
    echo "</div>\n";
}
echo "</div>\n";
$probs = $DB->q('KEYVALUETABLE SELECT probid, name FROM problem
                 INNER JOIN contestproblem USING (probid)
                 WHERE allow_submit = 1 AND cid = %i ORDER BY name', $submission['cid']);
$langs = $DB->q('KEYVALUETABLE SELECT langid, name FROM language
                 WHERE allow_submit = 1 ORDER BY name');
echo addSelect('probid', $probs, $submission['probid'], true);
echo addSelect('langid', $langs, $submission['langid'], true);
echo addHidden('teamid', $submission['teamid']);