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> <td><input type="checkbox" name="fields[<?php echo $i; ?>][extra]" value="auto_increment" /></td>
</tr> </tr>
</table> </table>
<p><input type="submit" name="add" value="<?php echo lang('Add row'); ?>" /></p>
<p> <p>
<input type="submit" value="<?php echo lang('Save'); ?>" /> <input type="submit" value="<?php echo lang('Save'); ?>" />
<?php if (strlen($_GET["create"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>" /><?php } ?> <?php if (strlen($_GET["create"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>" /><?php } ?>
</p> </p>
<p><input type="submit" name="add" value="<?php echo lang('Add row'); ?>" /></p>
</form> </form>

View file

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

View file

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