Remember export and import options

This commit is contained in:
Jakub Vrana 2011-07-13 13:08:20 +02:00
parent 9e0e161253
commit ead05e6839
2 changed files with 7 additions and 5 deletions

View file

@ -7,6 +7,7 @@ $foreign_keys = column_foreign_keys($TABLE);
if ($table_status["Oid"] == "t") {
$indexes[] = array("type" => "PRIMARY", "columns" => array("oid"));
}
parse_str($_COOKIE["adminer_import"], $adminer_import);
$rights = array(); // privilege => 0
$columns = array(); // selectable columns
@ -53,6 +54,7 @@ if ($_POST && !$error) {
}
}
if ($_POST["export"]) {
cookie("adminer_import", "output=" . urlencode($_POST["output"]) . "&format=" . urlencode($_POST["format"]));
dump_headers($TABLE);
$adminer->dumpTable($TABLE, "");
if (!is_array($_POST["check"]) || $unselected === array()) {
@ -141,6 +143,7 @@ if ($_POST && !$error) {
}
} elseif (is_string($file = get_file("csv_file", true))) {
//! character set
cookie("adminer_import", "output=" . urlencode($adminer_import["output"]) . "&format=" . urlencode($_POST["separator"]));
$result = true;
$cols = array_keys($fields);
preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~', $file, $matches);
@ -367,8 +370,6 @@ if (!$columns) {
echo "</table>\n";
}
parse_str($_COOKIE["adminer_export"], $adminer_export);
if ($rows || $page) {
$exact_count = true;
if ($_GET["page"] != "last" && +$limit && count($group) >= count($select) && ($found_rows >= $limit || $page)) {
@ -407,15 +408,15 @@ if (!$columns) {
}
print_fieldset("export", lang('Export'));
$output = $adminer->dumpOutput();
echo ($output ? html_select("output", $output, $adminer_export["output"]) . " " : "");
echo html_select("format", $adminer->dumpFormat(), $adminer_export["format"]);
echo ($output ? html_select("output", $output, $adminer_import["output"]) . " " : "");
echo html_select("format", $adminer->dumpFormat(), $adminer_import["format"]);
echo " <input type='submit' name='export' value='" . lang('Export') . "' onclick='eventStop(event);'>\n";
echo "</div></fieldset>\n";
}
if ($adminer->selectImportPrint()) {
print_fieldset("import", lang('Import'), !$rows);
echo "<input type='file' name='csv_file'> ";
echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_export["format"], 1); // 1 - select
echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_import["format"], 1); // 1 - select
echo " <input type='submit' name='import' value='" . lang('Import') . "'>";
echo "<input type='hidden' name='token' value='$token'>\n";
echo "</div></fieldset>\n";

View file

@ -9,6 +9,7 @@ Display default column value in table overview
Display column collation in tooltip
Keyboard shortcuts: Alt+Shift+1 for homepage, Ctrl+Shift+Enter for Save and continue edit
Show only errors with Webserver file SQL command
Remember select export and import options
Display error with all wrong SQL commands (MySQL)
Display foreign keys from other schemas (PostgreSQL)
Pagination support (Oracle)