From f38c0a1f13db559e39081cf78cf30ce1c64c50cd Mon Sep 17 00:00:00 2001 From: Peter Knut Date: Sun, 17 Mar 2024 21:12:35 +0100 Subject: [PATCH] Set saving to file as a default export option --- adminer/dump.inc.php | 9 +++++---- adminer/include/adminer.inc.php | 3 ++- adminer/include/functions.inc.php | 2 +- adminer/select.inc.php | 6 +++--- changes.txt | 1 + 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/adminer/dump.inc.php b/adminer/dump.inc.php index e81f80fd..eaf5a462 100644 --- a/adminer/dump.inc.php +++ b/adminer/dump.inc.php @@ -147,16 +147,14 @@ if ($jush == "sql") { //! use insertUpdate() in all drivers } parse_str($_COOKIE["adminer_export"], $row); if (!$row) { - $row = array("output" => "text", "format" => "sql", "db_style" => (DB != "" ? "" : "CREATE"), "table_style" => "DROP+CREATE", "data_style" => "INSERT"); + $row = array("output" => "file", "format" => "sql", "db_style" => (DB != "" ? "" : "CREATE"), "table_style" => "DROP+CREATE", "data_style" => "INSERT"); } if (!isset($row["events"])) { // backwards compatibility $row["routines"] = $row["events"] = ($_GET["dump"] == ""); $row["triggers"] = $row["table_style"]; } -echo "" . lang('Output') . "" . html_select("output", $adminer->dumpOutput(), $row["output"], 0) . "\n"; // 0 - radio - -echo "" . lang('Format') . "" . html_select("format", $adminer->dumpFormat(), $row["format"], 0) . "\n"; // 0 - radio +echo "" . lang('Format') . "" . html_select("format", $adminer->dumpFormat(), $row["format"], false) . "\n"; // false = radio echo ($jush == "sqlite" ? "" : "" . lang('Database') . "" . html_select('db_style', $db_style, $row["db_style"]) . (support("routine") ? checkbox("routines", 1, $row["routines"], lang('Routines')) : "") @@ -169,6 +167,9 @@ echo "" . lang('Tables') . "" . html_select('table_style', $table_st ; echo "" . lang('Data') . "" . html_select('data_style', $data_style, $row["data_style"]); + +echo "" . lang('Output') . "" . html_select("output", $adminer->dumpOutput(), $row["output"], false) . "\n"; // false = radio + ?>

diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index b114b5b9..1a32f79a 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -755,10 +755,11 @@ class Adminer { * @return array */ function dumpOutput() { - $return = array('text' => lang('open'), 'file' => lang('save')); + $return = array('file' => lang('save'), 'text' => lang('open')); if (function_exists('gzencode')) { $return['gz'] = 'gzip'; } + return $return; } diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 50965e6b..aa3b3678 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -213,7 +213,7 @@ function optionlist($options, $selected = null, $use_keys = false) { * @param string * @param array * @param string -* @param string true for no onchange, false for radio +* @param string|bool true for no onchange, false for radio * @param string * @return string */ diff --git a/adminer/select.inc.php b/adminer/select.inc.php index a556b3e4..74626ec1 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -568,9 +568,9 @@ if (!$columns && support("table")) { } if ($format) { print_fieldset("export", lang('Export') . " "); - $output = $adminer->dumpOutput(); - echo ($output ? html_select("output", $output, $adminer_import["output"]) . " " : ""); echo html_select("format", $format, $adminer_import["format"]); + $output = $adminer->dumpOutput(); + echo ($output ? " " . html_select("output", $output, $adminer_import["output"]) : ""); echo " \n"; echo "\n"; } @@ -586,7 +586,7 @@ if (!$columns && support("table")) { echo script("qsl('a').onclick = partial(toggle, 'import');", ""); echo ""; echo ""; diff --git a/changes.txt b/changes.txt index 46695fdf..0c660240 100644 --- a/changes.txt +++ b/changes.txt @@ -5,6 +5,7 @@ Adminer 4.9.0-dev: - Update hydra and pepa-lintha-dark themes. - Elasticsearch 5: Make unusable driver usable again, move it to plugins. - Add new Elasticsearch 7 driver. +- Set saving to file as a default export option. Adminer 4.8.2 (released 2024-03-16): Support multi-line table comments