Browse files

Add next

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@43 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent c5af16a commit aaa22e0ae7e37e337f411b00234663ba0596e2fa jakubvrana committed Jul 5, 2007
Showing with 18 additions and 10 deletions.
  1. +1 −1 create.inc.php
  2. +16 −9 indexes.inc.php
  3. +1 −0 lang.inc.php
View
2 create.inc.php
@@ -78,9 +78,9 @@
<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
25 indexes.inc.php
@@ -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 @@
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 @@
<?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
1 lang.inc.php
@@ -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',

0 comments on commit aaa22e0

Please sign in to comment.