Add button for dropping an index
This commit is contained in:
parent
2f1b337d9e
commit
1a0ba88f8d
|
@ -260,7 +260,7 @@ echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input nam
|
||||||
. "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'> "
|
. "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'> "
|
||||||
. "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'> "
|
. "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'> "
|
||||||
: "");
|
: "");
|
||||||
echo ($orig == "" || support("drop_col") ? "<input type='image' class='icon' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick='return !editingRemoveRow(this);'>" : "");
|
echo ($orig == "" || support("drop_col") ? "<input type='image' class='icon' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick=\"return !editingRemoveRow(this, 'fields\$1[field]');\">" : "");
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ if ($jush == "sqlite") { // doesn't support primary key
|
||||||
}
|
}
|
||||||
$row = $_POST;
|
$row = $_POST;
|
||||||
|
|
||||||
if ($_POST && !$error && !$_POST["add"]) {
|
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
|
||||||
$alter = array();
|
$alter = array();
|
||||||
foreach ($row["indexes"] as $index) {
|
foreach ($row["indexes"] as $index) {
|
||||||
$name = $index["name"];
|
$name = $index["name"];
|
||||||
|
@ -94,23 +94,27 @@ if (!$row) {
|
||||||
|
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<table cellspacing="0" class="nowrap">
|
<table cellspacing="0" class="nowrap">
|
||||||
<thead><tr><th><?php echo lang('Index Type'); ?><th><?php echo lang('Column (length)'); ?><th><?php echo lang('Name'); ?></thead>
|
<thead><tr><th><?php echo lang('Index Type'); ?><th><?php echo lang('Column (length)'); ?><th><?php echo lang('Name'); ?><th> </thead>
|
||||||
<?php
|
<?php
|
||||||
$j = 1;
|
$j = 1;
|
||||||
foreach ($row["indexes"] as $index) {
|
foreach ($row["indexes"] as $index) {
|
||||||
echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow(this);" : 1)) . "<td>";
|
if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) {
|
||||||
ksort($index["columns"]);
|
echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow(this);" : 1));
|
||||||
|
|
||||||
$i = 1;
|
echo "<td>";
|
||||||
foreach ($index["columns"] as $key => $column) {
|
ksort($index["columns"]);
|
||||||
echo "<span>" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "');");
|
$i = 1;
|
||||||
echo ($jush == "sql" || $jush == "mssql" ? "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "'>" : "");
|
foreach ($index["columns"] as $key => $column) {
|
||||||
echo ($jush != "sql" ? checkbox("indexes[$j][descs][$i]", 1, $index["descs"][$key], lang('descending')) : "");
|
echo "<span>" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "');");
|
||||||
echo " </span>";
|
echo ($jush == "sql" || $jush == "mssql" ? "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "'>" : "");
|
||||||
$i++;
|
echo ($jush != "sql" ? checkbox("indexes[$j][descs][$i]", 1, $index["descs"][$key], lang('descending')) : "");
|
||||||
|
echo " </span>";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<td><input name='indexes[$j][name]' value='" . h($index["name"]) . "' autocapitalize='off'>\n";
|
||||||
|
echo "<td><input type='image' class='icon' name='drop_col[$j]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick=\"return !editingRemoveRow(this, 'indexes\$1[type]');\">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<td><input name='indexes[$j][name]' value='" . h($index["name"]) . "' autocapitalize='off'>\n";
|
|
||||||
$j++;
|
$j++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -335,10 +335,11 @@ function editingAddRow(button, focus) {
|
||||||
|
|
||||||
/** Remove table row for field
|
/** Remove table row for field
|
||||||
* @param HTMLInputElement
|
* @param HTMLInputElement
|
||||||
|
* @param string
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function editingRemoveRow(button) {
|
function editingRemoveRow(button, name) {
|
||||||
var field = formField(button.form, button.name.replace(/drop_col(.+)/, 'fields$1[field]'));
|
var field = formField(button.form, button.name.replace(/drop_col(.+)/, name));
|
||||||
field.parentNode.removeChild(field);
|
field.parentNode.removeChild(field);
|
||||||
parentTag(button, 'tr').style.display = 'none';
|
parentTag(button, 'tr').style.display = 'none';
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -3,6 +3,7 @@ Save and continue edit by AJAX
|
||||||
Add a new column in alter table on key press
|
Add a new column in alter table on key press
|
||||||
Mark length as required for strings
|
Mark length as required for strings
|
||||||
Add label to database selection
|
Add label to database selection
|
||||||
|
Add button for dropping an index
|
||||||
PostgreSQL: Fix handling of nextval() default values
|
PostgreSQL: Fix handling of nextval() default values
|
||||||
|
|
||||||
Adminer 3.7.1 (released 2013-06-29):
|
Adminer 3.7.1 (released 2013-06-29):
|
||||||
|
|
Loading…
Reference in a new issue