git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@43 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2007-07-05 12:01:32 +00:00
parent c5af16a7b2
commit aaa22e0ae7
3 changed files with 18 additions and 10 deletions

View file

@ -78,9 +78,9 @@ foreach ($row["fields"] as $field) {
<td><input type="checkbox" name="fields[<?php echo $i; ?>][extra]" value="auto_increment" /></td>
</tr>
</table>
<p><input type="submit" name="add" value="<?php echo lang('Add row'); ?>" /></p>
<p>
<input type="submit" value="<?php echo lang('Save'); ?>" />
<?php if (strlen($_GET["create"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>" /><?php } ?>
</p>
<p><input type="submit" name="add" value="<?php echo lang('Add row'); ?>" /></p>
</form>

View file

@ -2,7 +2,7 @@
$index_types = array("PRIMARY", "UNIQUE", "INDEX", "FULLTEXT");
$indexes = indexes($_GET["indexes"]);
$fields = array_keys(fields($_GET["indexes"]));
if ($_POST) {
if ($_POST && !$_POST["add"]) {
$alter = array();
foreach ($_POST["indexes"] as $index) {
if (in_array($index["type"], $index_types)) {
@ -36,7 +36,9 @@ if ($_POST) {
page_header(lang('Indexes') . ': ' . htmlspecialchars($_GET["indexes"]));
if ($_POST) {
echo "<p class='error'>" . lang('Unable to operate indexes') . ": " . htmlspecialchars($error) . "</p>\n";
if (!$_POST["add"]) {
echo "<p class='error'>" . lang('Unable to operate indexes') . ": " . htmlspecialchars($error) . "</p>\n";
}
$row = $_POST;
} else {
$row = array("indexes" => $indexes);
@ -47,18 +49,23 @@ if ($_POST) {
<?php
$j = 0;
foreach ($row["indexes"] as $index) {
echo "<tr><td><select name='indexes[$j][type]'><option></option>" . optionlist($index_types, $index["type"], "not_vals") . "</select></td><td>";
ksort($index["columns"]);
foreach ($index["columns"] as $i => $column) {
echo "<select name='indexes[$j][columns][$i]'><option></option>" . optionlist($fields, $column, "not_vals") . "</select>";
if ($index["type"] || array_filter($index["columns"], 'strlen')) {
echo "<tr><td><select name='indexes[$j][type]'><option></option>" . optionlist($index_types, $index["type"], "not_vals") . "</select></td><td>";
ksort($index["columns"]);
foreach ($index["columns"] as $i => $column) {
if (strlen($column)) {
echo "<select name='indexes[$j][columns][$i]'><option></option>" . optionlist($fields, $column, "not_vals") . "</select>";
}
}
echo "<select name='indexes[$j][columns][" . ($i+1) . "]'><option></option>" . optionlist($fields, array(), "not_vals") . "</select>";
echo "</td></tr>\n";
$j++;
}
echo "<select name='indexes[$j][columns][" . ($i+1) . "]'><option></option>" . optionlist($fields, array(), "not_vals") . "</select>";
echo "</td></tr>\n";
$j++;
}
//! JavaScript for adding more indexes and columns
?>
<tr><td><select name="indexes[<?php echo $j; ?>][type]"><option></option><?php echo optionlist($index_types, array(), "not_vals"); ?></select></td><td><select name="indexes[<?php echo $j; ?>][columns][1]"><option></option><?php echo optionlist($fields, array(), "not_vals"); ?></select></td></tr>
</table>
<p><input type="submit" value="<?php echo lang('Alter indexes'); ?>" /></p>
<p><input type="submit" name="add" value="<?php echo lang('Add next'); ?>" /></p>
</form>

View file

@ -61,6 +61,7 @@ function lang($idf = null) {
'Indexes' => 'Indexy',
'Unable to operate indexes' => 'Nepodařilo se zpracovat indexy',
'Alter indexes' => 'Změnit indexy',
'Add next' => 'Přidat další',
'Language' => 'Jazyk',
'Select' => 'Vypsat',
'New item' => 'Nová položka',