diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index 814e6778..97dc62d8 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -260,7 +260,7 @@ echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?> " . " " : ""); - echo ($orig == "" || support("drop_col") ? "" : ""); + echo ($orig == "" || support("drop_col") ? "" : ""); echo "\n"; } } diff --git a/adminer/indexes.inc.php b/adminer/indexes.inc.php index 8ca12c61..bc4291f8 100644 --- a/adminer/indexes.inc.php +++ b/adminer/indexes.inc.php @@ -12,7 +12,7 @@ if ($jush == "sqlite") { // doesn't support primary key } $row = $_POST; -if ($_POST && !$error && !$_POST["add"]) { +if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) { $alter = array(); foreach ($row["indexes"] as $index) { $name = $index["name"]; @@ -94,23 +94,27 @@ if (!$row) {
- +
 
" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow(this);" : 1)) . ""; - ksort($index["columns"]); - - $i = 1; - foreach ($index["columns"] as $key => $column) { - echo "" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "');"); - echo ($jush == "sql" || $jush == "mssql" ? "" : ""); - echo ($jush != "sql" ? checkbox("indexes[$j][descs][$i]", 1, $index["descs"][$key], lang('descending')) : ""); - echo " "; - $i++; + if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) { + echo "
" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow(this);" : 1)); + + echo ""; + ksort($index["columns"]); + $i = 1; + foreach ($index["columns"] as $key => $column) { + echo "" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "');"); + echo ($jush == "sql" || $jush == "mssql" ? "" : ""); + echo ($jush != "sql" ? checkbox("indexes[$j][descs][$i]", 1, $index["descs"][$key], lang('descending')) : ""); + echo " "; + $i++; + } + + echo "\n"; + echo "\n"; } - - echo "\n"; $j++; } ?> diff --git a/adminer/static/editing.js b/adminer/static/editing.js index 4fc0233c..807c7f4a 100644 --- a/adminer/static/editing.js +++ b/adminer/static/editing.js @@ -335,10 +335,11 @@ function editingAddRow(button, focus) { /** Remove table row for field * @param HTMLInputElement +* @param string * @return boolean */ -function editingRemoveRow(button) { - var field = formField(button.form, button.name.replace(/drop_col(.+)/, 'fields$1[field]')); +function editingRemoveRow(button, name) { + var field = formField(button.form, button.name.replace(/drop_col(.+)/, name)); field.parentNode.removeChild(field); parentTag(button, 'tr').style.display = 'none'; return true; diff --git a/changes.txt b/changes.txt index aa1bf0f0..ca1c3d56 100644 --- a/changes.txt +++ b/changes.txt @@ -3,6 +3,7 @@ Save and continue edit by AJAX Add a new column in alter table on key press Mark length as required for strings Add label to database selection +Add button for dropping an index PostgreSQL: Fix handling of nextval() default values Adminer 3.7.1 (released 2013-06-29):