radio buttons for indexes

This commit is contained in:
Marc Delisle
2002-02-10 03:17:11 +00:00
parent f924fd6569
commit 579387e7c4
4 changed files with 37 additions and 7 deletions

View File

@@ -10,6 +10,8 @@ $Source$
495360 (cookie with domain), experimental, thanks to 495360 (cookie with domain), experimental, thanks to
Piotr Roszatycki (d3xter) and Christoph (certelt). Piotr Roszatycki (d3xter) and Christoph (certelt).
* tbl_properties.inc.php3: clarifications * tbl_properties.inc.php3: clarifications
* tbl_create.php3, tbl_addfield.php3, tbl_properties.inc.php3:
radio buttons for indexes.
2002-02-09 Lo<4C>c Chapeaux <lolo@phpheaven.net> 2002-02-09 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* libraries/functions.js: improved the "mark row" feature (it wasn't * libraries/functions.js: improved the "mark row" feature (it wasn't

View File

@@ -28,8 +28,20 @@ $err_url = 'tbl_properties.php3'
if (isset($submit)) { if (isset($submit)) {
$query = ''; $query = '';
// Builds the field creation statement and alters the table // transform the radio button field_key into 3 arrays
$field_cnt = count($field_name); $field_cnt = count($field_name);
for ($i = 0; $i < $field_cnt; ++$i) {
if (${'field_key_'.$i} == 'primary_'.$i) {
$field_primary[]=$i;
}
if (${'field_key_'.$i} == 'index_'.$i) {
$field_index[]=$i;
}
if (${'field_key_'.$i} == 'unique_'.$i) {
$field_unique[]=$i;
}
}
// Builds the field creation statement and alters the table
for ($i = 0; $i < $field_cnt; ++$i) { for ($i = 0; $i < $field_cnt; ++$i) {
if (get_magic_quotes_gpc()) { if (get_magic_quotes_gpc()) {
$field_name[$i] = stripslashes($field_name[$i]); $field_name[$i] = stripslashes($field_name[$i]);

View File

@@ -34,9 +34,21 @@ mysql_select_db($db);
if (isset($submit)) { if (isset($submit)) {
$sql_query = $query_cpy = ''; $sql_query = $query_cpy = '';
// transform the radio button field_key into 3 arrays
$field_cnt = count($field_name);
for ($i = 0; $i < $field_cnt; ++$i) {
if (${'field_key_'.$i} == 'primary_'.$i) {
$field_primary[]=$i;
}
if (${'field_key_'.$i} == 'index_'.$i) {
$field_index[]=$i;
}
if (${'field_key_'.$i} == 'unique_'.$i) {
$field_unique[]=$i;
}
}
// Builds the fields creation statements // Builds the fields creation statements
$fields_cnt = count($field_name); for ($i = 0; $i < $field_cnt; $i++) {
for ($i = 0; $i < $fields_cnt; $i++) {
if (empty($field_name[$i])) { if (empty($field_name[$i])) {
continue; continue;
} }
@@ -87,7 +99,7 @@ if (isset($submit)) {
$sql_query .= $query; $sql_query .= $query;
$query_cpy .= "\n" . ' ' . $query; $query_cpy .= "\n" . ' ' . $query;
} // end for } // end for
unset($fields_cnt); unset($field_cnt);
unset($query); unset($query);
$sql_query = ereg_replace(', $', '', $sql_query); $sql_query = ereg_replace(', $', '', $sql_query);
$query_cpy = ereg_replace(', $', '', $query_cpy); $query_cpy = ereg_replace(', $', '', $query_cpy);

View File

@@ -42,6 +42,7 @@ if (!$is_backup) {
echo " <th>$strPrimary</th>\n"; echo " <th>$strPrimary</th>\n";
echo " <th>$strIndex</th>\n"; echo " <th>$strIndex</th>\n";
echo " <th>$strUnique</th>\n"; echo " <th>$strUnique</th>\n";
echo " <th>---</th>\n";
echo " <th>$strIdxFulltext</th>\n"; echo " <th>$strIdxFulltext</th>\n";
} }
?> ?>
@@ -235,13 +236,16 @@ for ($i = 0 ; $i < $num_fields; $i++) {
echo "\n"; echo "\n";
?> ?>
<td align="center" bgcolor="<?php echo $bgcolor; ?>"> <td align="center" bgcolor="<?php echo $bgcolor; ?>">
<input type="checkbox" name="field_primary[]" value="<?php echo $i; ?>"<?php echo $checked_primary; ?> /> <input type="radio" name="field_key_<?php echo $i; ?>" value="primary_<?php echo $i; ?>"<?php echo $checked_primary; ?> />
</td> </td>
<td align="center" bgcolor="<?php echo $bgcolor; ?>"> <td align="center" bgcolor="<?php echo $bgcolor; ?>">
<input type="checkbox" name="field_index[]" value="<?php echo $i; ?>"<?php echo $checked_index; ?> /> <input type="radio" name="field_key_<?php echo $i; ?>" value="index_<?php echo $i; ?>"<?php echo $checked_index; ?> />
</td> </td>
<td align="center" bgcolor="<?php echo $bgcolor; ?>"> <td align="center" bgcolor="<?php echo $bgcolor; ?>">
<input type="checkbox" name="field_unique[]" value="<?php echo $i; ?>"<?php echo $checked_unique; ?> /> <input type="radio" name="field_key_<?php echo $i; ?>" value="unique_<?php echo $i; ?>"<?php echo $checked_unique; ?> />
</td>
<td align="center" bgcolor="<?php echo $bgcolor; ?>">
<input type="radio" name="field_key_<?php echo $i; ?>" value="none_<?php echo $i; ?>" />
</td> </td>
<?php <?php
if (PMA_MYSQL_INT_VERSION >= 32323) { if (PMA_MYSQL_INT_VERSION >= 32323) {