mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
Split helper html_radios
This commit is contained in:
@@ -167,9 +167,9 @@ if (!isset($row["events"])) { // backwards compatibility
|
|||||||
$row["triggers"] = $row["table_style"];
|
$row["triggers"] = $row["table_style"];
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<tr><th>" . lang('Output') . "<td>" . html_select("output", $adminer->dumpOutput(), $row["output"], 0) . "\n"; // 0 - radio
|
echo "<tr><th>" . lang('Output') . "<td>" . html_radios("output", $adminer->dumpOutput(), $row["output"]) . "\n";
|
||||||
|
|
||||||
echo "<tr><th>" . lang('Format') . "<td>" . html_select("format", $adminer->dumpFormat(), $row["format"], 0) . "\n"; // 0 - radio
|
echo "<tr><th>" . lang('Format') . "<td>" . html_radios("format", $adminer->dumpFormat(), $row["format"]) . "\n";
|
||||||
|
|
||||||
echo (JUSH == "sqlite" ? "" : "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, $row["db_style"])
|
echo (JUSH == "sqlite" ? "" : "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, $row["db_style"])
|
||||||
. (support("type") ? checkbox("types", 1, $row["types"], lang('User types')) : "")
|
. (support("type") ? checkbox("types", 1, $row["types"], lang('User types')) : "")
|
||||||
|
@@ -94,8 +94,8 @@ if (support("scheme")) {
|
|||||||
$j = 0;
|
$j = 0;
|
||||||
foreach ($row["source"] as $key => $val) {
|
foreach ($row["source"] as $key => $val) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td>" . html_select("source[" . (+$key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreignAddRow.call(this);" : 1), "label-source");
|
echo "<td>" . html_select("source[" . (+$key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreignAddRow.call(this);" : ""), "label-source");
|
||||||
echo "<td>" . html_select("target[" . (+$key) . "]", $target, $row["target"][$key], 1, "label-target");
|
echo "<td>" . html_select("target[" . (+$key) . "]", $target, $row["target"][$key], "", "label-target");
|
||||||
$j++;
|
$j++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -217,22 +217,29 @@ function optionlist($options, $selected = null, $use_keys = false) {
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Generate HTML <select>
|
||||||
|
* @param string
|
||||||
|
* @param array
|
||||||
|
* @param string
|
||||||
|
* @param string
|
||||||
|
* @param string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function html_select($name, $options, $value = "", $onchange = "", $labelled_by = "") {
|
||||||
|
return "<select name='" . h($name) . "'"
|
||||||
|
. ($labelled_by ? " aria-labelledby='$labelled_by'" : "")
|
||||||
|
. ">" . optionlist($options, $value) . "</select>"
|
||||||
|
. ($onchange ? script("qsl('select').onchange = function () { $onchange };", "") : "")
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
/** Generate HTML radio list
|
/** Generate HTML radio list
|
||||||
* @param string
|
* @param string
|
||||||
* @param array
|
* @param array
|
||||||
* @param string
|
* @param string
|
||||||
* @param string true for no onchange, false for radio
|
|
||||||
* @param string
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function html_select($name, $options, $value = "", $onchange = true, $labelled_by = "") {
|
function html_radios($name, $options, $value = "") {
|
||||||
if ($onchange) {
|
|
||||||
return "<select name='" . h($name) . "'"
|
|
||||||
. ($labelled_by ? " aria-labelledby='$labelled_by'" : "")
|
|
||||||
. ">" . optionlist($options, $value) . "</select>"
|
|
||||||
. (is_string($onchange) ? script("qsl('select').onchange = function () { $onchange };", "") : "")
|
|
||||||
;
|
|
||||||
}
|
|
||||||
$return = "";
|
$return = "";
|
||||||
foreach ($options as $key => $val) {
|
foreach ($options as $key => $val) {
|
||||||
$return .= "<label><input type='radio' name='" . h($name) . "' value='" . h($key) . "'" . ($key == $value ? " checked" : "") . ">" . h($val) . "</label>";
|
$return .= "<label><input type='radio' name='" . h($name) . "' value='" . h($key) . "'" . ($key == $value ? " checked" : "") . ">" . h($val) . "</label>";
|
||||||
|
@@ -126,7 +126,7 @@ if ($primary) {
|
|||||||
$j = 1;
|
$j = 1;
|
||||||
foreach ($row["indexes"] as $index) {
|
foreach ($row["indexes"] as $index) {
|
||||||
if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) {
|
if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) {
|
||||||
echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow.call(this);" : 1), "label-type");
|
echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow.call(this);" : ""), "label-type");
|
||||||
|
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
ksort($index["columns"]);
|
ksort($index["columns"]);
|
||||||
|
@@ -587,7 +587,7 @@ if (!$columns && support("table")) {
|
|||||||
echo script("qsl('a').onclick = partial(toggle, 'import');", "");
|
echo script("qsl('a').onclick = partial(toggle, 'import');", "");
|
||||||
echo "<span id='import'" . ($_POST["import"] ? "" : " class='hidden'") . ">: ";
|
echo "<span id='import'" . ($_POST["import"] ? "" : " class='hidden'") . ">: ";
|
||||||
echo "<input type='file' name='csv_file'> ";
|
echo "<input type='file' name='csv_file'> ";
|
||||||
echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_import["format"], 1); // 1 - select
|
echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_import["format"]);
|
||||||
echo " <input type='submit' name='import' value='" . lang('Import') . "'>";
|
echo " <input type='submit' name='import' value='" . lang('Import') . "'>";
|
||||||
echo "</span>";
|
echo "</span>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
Reference in New Issue
Block a user