]> git.joonet.de Git - adminer.git/commitdiff
Add next
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 5 Jul 2007 12:01:32 +0000 (12:01 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 5 Jul 2007 12:01:32 +0000 (12:01 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@43 7c3ca157-0c34-0410-bff1-cbf682f78f5c

create.inc.php
indexes.inc.php
lang.inc.php

index 4985fc03358eb98600fa52d49f724f909082be5d..bfa626576e0d4f01d7bac3fd6450059597fab580 100644 (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>
index 4e063052a432feb5e641c226c6ad25ed363d0c75..494d3afdb633a932b2bcbc2f9d7d0a27e598ebae 100644 (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>
index 2350d6b42b2020e729980f67727c3c4088208302..90dc6a72db871e43fec631a60e4c7b7c69974a50 100644 (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',