?> <tr><td><label for="data_0__timelimit_">Timelimit:</label></td> <td><?php echo addInputField('number', 'data[0][timelimit]', @$row['timelimit'], ' min="1" max="10000" required'); ?> sec</td></tr> <tr><td><label for="data_0__memlimit_">Memory limit:</label></td> <td><?php echo addInputField('number', 'data[0][memlimit]', @$row['memlimit']); ?> kB (leave empty for default)</td></tr> <tr><td><label for="data_0__outputlimit_">Output limit:</label></td> <td><?php echo addInputField('number', 'data[0][outputlimit]', @$row['outputlimit']); ?> kB (leave empty for default)</td></tr> <tr><td><label for="data_0__problemtext_">Problem text:</label></td> <td><?php echo addFileField('data[0][problemtext]', 30, ' accept="text/plain,text/html,application/pdf"'); if (!empty($row['problemtext_type'])) { echo addCheckBox('unset[0][problemtext]') . '<label for="unset_0__problemtext_">delete</label>'; } ?> </td></tr> <tr><td><label for="data_0__special_run_">Run script:</label></td> <td> <?php
return; } $title = "Configuration"; require LIBWWWDIR . '/header.php'; // Check admin rights after header to generate valid HTML page requireAdmin(); echo "<h1>Configuration settings</h1>\n\n"; echo addForm($pagename) . "<table>\n<thead>\n" . "<tr class=\"thleft\"><th>Option</th><th>Value(s)</th><th>Description</th></tr>\n" . "</thead>\n<tbody>\n"; $extra = ' class="config_input"'; foreach ($LIBDBCONFIG as $key => $data) { switch (@$data['type']) { case 'bool': $editfield = addRadioButton('config_' . $key, (bool) $data['value'] == true, 1) . "<label for=\"config_{$key}1\">yes</label>" . addRadioButton('config_' . $key, (bool) $data['value'] == false, 0) . "<label for=\"config_{$key}0\">no</label>"; break; case 'int': $editfield = addInputField('number', 'config_' . $key, $data['value'], $extra); break; case 'string': $editfield = addInput('config_' . $key, $data['value'], 0, 0, $extra); break; case 'array_val': case 'array_keyval': $editfield = ''; $i = 0; foreach ($data['value'] as $k => $v) { if ($data['type'] == 'array_keyval') { $editfield .= addInput("config_{$key}[{$i}][key]", $k, 0, 0, $extra); $editfield .= addInput("config_{$key}[{$i}][val]", $v, 0, 0, $extra); } else { $editfield .= addInput("config_{$key}[{$i}]", $v, 0, 0, $extra); }
/** * File upload field */ function addFileField($name, $dummy = null, $extraattr = "") { return addInputField('file', $name, null, $extraattr); }
</td></tr> <tr><td><label for="data_0__email_">Email:</label></td> <td><?php echo addInputField('email', 'data[0][email]', @$row['email'], ' size="35" maxlength="255" autocomplete="off"'); ?> </td></tr> <tr><td><label for="data_0__password_">Password:</label></td><td><?php if (!empty($row['password'])) { echo "<em>set</em>"; } else { echo "<em>not set</em>"; } ?> - to change: <?php echo addInputField('password', 'data[0][password]', "", ' size="19" maxlength="255"'); ?> </td></tr> <tr><td><label for="data_0__ip_address_">IP Address:</label></td> <td><?php echo addInput('data[0][ip_address]', @$row['ip_address'], 35, 255); ?> </td></tr> <tr><td><label for="data_0__enabled_">Enabled:</label></td> <td><?php echo addRadioButton('data[0][enabled]', !isset($row['']) || $row['enabled'], 1); ?> <label for="data_0__enabled_1">yes</label> <?php echo addRadioButton('data[0][enabled]', isset($row['enabled']) && !$row['enabled'], 0);
if (!$row) { error("Missing or invalid category id"); } echo "<tr><td>Category ID:</td><td>" . addHidden('keydata[0][categoryid]', $row['categoryid']) . specialchars($row['categoryid']) . "</td></tr>\n"; } ?> <tr><td><label for="data_0__name_">Description:</label></td> <td><?php echo addInput('data[0][name]', @$row['name'], 15, 255, 'required'); ?> </td></tr> <tr><td><label for="data_0__sortorder_">Sort order:</label></td> <td><?php echo addInputField('number', 'data[0][sortorder]', empty($row['sortorder']) ? 0 : $row['sortorder'], ' size="3" maxlength="2"'); ?> </td></tr> <tr><td><label for="data_0__color_">Colour:</label></td> <td><?php echo addInput('data[0][color]', @$row['color'], 15, 25, 'class="color {required:false,adjust:false,hash:true,caps:false}"'); ?> <a target="_blank" href="http://www.w3schools.com/cssref/css_colornames.asp"><img src="../images/b_help.png" class="smallpicto" alt="?" /></a></td></tr> <tr><td>Visible:</td> <td><?php echo addRadioButton('data[0][visible]', !isset($row['visible']) || $row['visible'], 1); ?>
/** * Form reset button, $value = caption */ function addReset($value) { return addInputField('reset', null, $value); }
/** * Form reset button * @param string $sValue button name * @param array $aAttribs (since 1.5.1) extra attributes * @return string html formated reset input field */ function addReset($sValue, $aAttribs = array()) { $aAttribs['value'] = $sValue; // add default css if (!isset($aAttribs['class'])) { $aAttribs['class'] = 'sqmresetfield'; } return addInputField('reset', $aAttribs); }
echo addRadioButton("data[0][mapping][0][extra][{id}][allow_judge]", true, 1); ?> <label for='data_0__mapping__0__extra__{id}__allow_judge_1'>yes</label> <?php echo addRadioButton("data[0][mapping][0][extra][{id}][allow_judge]", false, 0); ?> <label for='data_0__mapping__0__extra__{id}__allow_judge_0'>no</label> </td> <td> <?php echo addInput("data[0][mapping][0][extra][{id}][color]", '{color}', 15, 25, 'class="color {required:false,adjust:false,hash:true,caps:false}"'); ?> </td> <td> <?php echo addInputField('number', "data[0][mapping][0][extra][{id}][lazy_eval_results]", '{lazy_eval_results}', ' min="0" max="1"'); ?> </td> </tr> </script> <table id="problems_table"> <thead> <tr> <th>ID</th> <th>name</th> <th>short name</th> <th>points</th> <th>allow submit</th> <th>allow judge</th> <th>color <a target="_blank" href="http://www.w3schools.com/cssref/css_colornames.asp">
?> <label for="data_0__allow_submit_0">no</label></td></tr> <tr><td>Allow judge:</td> <td><?php echo addRadioButton('data[0][allow_judge]', !isset($row['allow_judge']) || $row['allow_judge'], 1); ?> <label for="data_0__allow_judge_1">yes</label> <?php echo addRadioButton('data[0][allow_judge]', isset($row['allow_judge']) && !$row['allow_judge'], 0); ?> <label for="data_0__allow_judge_0">no</label></td></tr> <tr><td><label for="data_0__time_factor_">Time factor:</label></td> <td><?php echo addInputField('number', 'data[0][time_factor]', isset($row['time_factor']) ? $row['time_factor'] : 1, ' min="0" step="any" required'); ?> ×</td></tr> <tr><td><label for="data_0__compile_script_">Compile script:</label></td> <td> <?php $execmap = $DB->q("KEYVALUETABLE SELECT execid,description FROM executable\n\t\t\tWHERE type = 'compile'\n\t\t\tORDER BY execid"); $execmap[''] = 'none'; echo addSelect('data[0][compile_script]', $execmap, @$row['compile_script'], True); ?> </td></tr> <tr><td><label for="data_0__extensions_">Extensions:</label></td> <td><?php echo addInput('data[0][extensions]', @$row['extensions'], 20, 255, 'required'); ?> (as JSON encoded array, for example <kbd>["cpp","cc","c++"]</kbd>)</td></tr>
?> <label for="data_0__allow_submit_0">no</label></td></tr> <tr><td>Allow judge:</td> <td><?php echo addRadioButton('data[0][allow_judge]', !isset($row['allow_judge']) || $row['allow_judge'], 1); ?> <label for="data_0__allow_judge_1">yes</label> <?php echo addRadioButton('data[0][allow_judge]', isset($row['allow_judge']) && !$row['allow_judge'], 0); ?> <label for="data_0__allow_judge_0">no</label></td></tr> <tr><td><label for="data_0__time_factor_">Time factor:</label></td> <td><?php echo addInputField('number', 'data[0][time_factor]', @$row['time_factor'], ' min="0" step="any"'); ?> x</td></tr> <tr><td><label for="data_0__compile_script_">Compile script:</label></td> <td> <?php $execmap = $DB->q("KEYVALUETABLE SELECT execid,description FROM executable\n\t\t\tWHERE type = 'compile'\n\t\t\tORDER BY execid"); $execmap[''] = 'none'; echo addSelect('data[0][compile_script]', $execmap, @$row['compile_script'], True); ?> </td></tr> <tr><td><label for="data_0__extensions_">Extensions:</label></td> <td><?php echo addInput('data[0][extensions]', @$row['extensions'], 20, 255, 'required'); ?> (as JSON encoded array)</td></tr>