Display edit form after error in clone or multi-edit

This commit is contained in:
Jakub Vrana 2014-02-24 23:59:12 -08:00
parent 9567e5cb1a
commit 7da82a12a6
4 changed files with 21 additions and 20 deletions

View file

@ -59,14 +59,6 @@ if ($_POST && !$error && !isset($_GET["select"])) {
}
}
$table_name = $adminer->tableName(table_status1($TABLE, true));
page_header(
($update ? lang('Edit') : lang('Insert')),
$error,
array("select" => array($TABLE, $table_name)),
$table_name
);
$row = null;
if ($_POST["save"]) {
$row = (array) $_POST["fields"];
@ -118,12 +110,4 @@ if (!support("table") && !$fields) {
}
}
if ($row === false) {
echo "<p class='error'>" . lang('No rows.') . "\n";
}
?>
<div id="message"></div>
<?php
edit_form($fields, $row, $update);
edit_form($TABLE, $fields, $row, $update);

View file

@ -1249,14 +1249,26 @@ function on_help($command, $side = 0) {
}
/** Print edit data form
* @param string
* @param array
* @param mixed
* @param bool
* @return null
*/
function edit_form($fields, $row, $update) {
global $adminer, $jush, $token;
function edit_form($TABLE, $fields, $row, $update) {
global $adminer, $jush, $token, $error;
$table_name = $adminer->tableName(table_status1($TABLE, true));
page_header(
($update ? lang('Edit') : lang('Insert')),
$error,
array("select" => array($TABLE, $table_name)),
$table_name
);
if ($row === false) {
echo "<p class='error'>" . lang('No rows.') . "\n";
}
?>
<div id="message"></div>
<form action="" method="post" enctype="multipart/form-data" id="form">
<?php
if (!$fields) {

View file

@ -139,7 +139,11 @@ if ($_POST && !$error) {
}
}
queries_redirect(remove_from_uri($_POST["all"] && $_POST["delete"] ? "page" : ""), $message, $result);
//! display edit page in case of an error
if (!$_POST["delete"]) {
edit_form($TABLE, $fields, (array) $_POST["fields"], !$_POST["clone"]);
page_footer();
exit;
}
} elseif (!$_POST["import"]) { // modify
if (!$_POST["val"]) {

View file

@ -1,4 +1,5 @@
Adminer 4.0.4-dev:
Display edit form after error in clone or multi-edit
Display time of the select command
Improve gzip export ratio (bug #387)
MySQL: Fix editing rows by binary values, bug since Adminer 3.7.1