bug #1227710, unsaved relations lost when changing field to display

This commit is contained in:
Marc Delisle
2005-07-11 17:55:41 +00:00
parent d1027c518e
commit 6950dc7100
2 changed files with 163 additions and 176 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2005-07-11 Marc Delisle <lem9@users.sourceforge.net>
* tbl_relations.php: bug #1227710, unsaved relations lost when changing
field to display
2005-07-11 Michal Čihař <michal@cihar.com>
* db_operations.php: Allow adding DROP TABLE when copying database (RFE
#1235761).

View File

@@ -87,10 +87,8 @@ if ($cfgRelation['displaywork']) {
$disp = PMA_getDisplayField($db, $table);
}
// updates for internal relations or innodb?
if (isset($submit_rel) && $submit_rel == 'true') {
// u p d a t e s f o r I n t e r n a l r e l a t i o n s
if ($cfgRelation['relwork']) {
if (isset($destination) && $cfgRelation['relwork']) {
foreach ($destination AS $master_field => $foreign_string) {
if ($foreign_string != 'nix') {
@@ -219,13 +217,11 @@ if (isset($submit_rel) && $submit_rel == 'true') {
} // end while
} // end if isset($destination_innodb)
} // end if (updates for internal relations or InnoDB)
// U p d a t e s f o r d i s p l a y f i e l d
if ($cfgRelation['displaywork']
&& isset($submit_show) && $submit_show == 'true') {
&& isset($display_field)) {
if ($disp) {
if ($display_field != '') {
@@ -253,14 +249,13 @@ if ($cfgRelation['displaywork']
} // end if
// If we did an update, refresh our data
if (isset($submit_rel) && $submit_rel == 'true') {
if ($cfgRelation['relwork']) {
if (isset($destination) && $cfgRelation['relwork']) {
$existrel = PMA_getForeigners($db, $table, '', 'internal');
}
if ($tbl_type=='INNODB') {
if (isset($destination_innodb) && $tbl_type=='INNODB') {
$existrel_innodb = PMA_getForeigners($db, $table, '', 'innodb');
}
}
if ($cfgRelation['displaywork']) {
$disp = PMA_getDisplayField($db, $table);
}
@@ -269,6 +264,14 @@ if ($cfgRelation['displaywork']) {
/**
* Dialog
*/
// common form
echo '<form method="post" action="tbl_relation.php">' . "\n";
echo PMA_generate_common_hidden_inputs($db, $table);
// relations
if ($cfgRelation['relwork'] || $tbl_type=='INNODB') {
// To choose relations we first need all tables names in current db
// and if PMA version permits and the main table is innodb,
@@ -372,10 +375,6 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
. ' <tr><td valign="top">' . "\n\n";
?>
<form method="post" action="tbl_relation.php">
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="submit_rel" value="true" />
<table cellpadding="2" cellspacing="1">
<tr>
<th colspan="<?php echo $tbl_type=='INNODB' ? '4' : '2'; ?>" align="center" class="tblHeaders"><b><?php echo $strLinksTo; ?></b></th>
@@ -510,41 +509,32 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
} // end for
echo "\n";
?>
<tr>
<td colspan="<?php echo $tbl_type=='INNODB' ? '4' : '2'; ?>" align="center" class="tblFooters">
<input type="submit" value="<?php echo ' ' . $strGo . ' '; ?>" />
</td>
</tr>
</table>
<?php
if ($tbl_type=='INNODB') {
if (PMA_MYSQL_INT_VERSION < 40013) {
echo '** ' . sprintf($strUpgrade, 'MySQL', '4.0.13') . '<br />';
}
}
?>
</form>
<?php
echo $tbl_type=='INNODB' ? '' : "\n\n" . ' </td>' . "\n";
if ($cfgRelation['displaywork']) {
echo $tbl_type=='INNODB' ? '' : ' <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>' . "\n"
. ' <td valign="top" align="center">' . "\n\n";
// Get "display_field" infos
$disp = PMA_getDisplayField($db, $table);
echo "\n";
?>
<form method="post" action="tbl_relation.php">
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="submit_show" value="true" />
<p><b><?php echo $strChangeDisplay . ': '; ?></b><br />
<select name="display_field" onchange="this.form.submit();" style="vertical-align: middle">
<tr>
<td height="5"></td>
</tr>
<tr>
<td class="tblHeaders">
<b><?php echo $strChangeDisplay . ': '; ?></b>
</td>
</tr>
<tr>
<td>
<select name="display_field" style="vertical-align: middle">
<option value="">---</option>
<?php
echo "\n";
foreach ($save_row AS $row) {
echo ' <option value="' . htmlspecialchars($row['Field']) . '"';
if (isset($disp) && $row['Field'] == $disp) {
@@ -554,25 +544,18 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
} // end while
?>
</select>
<script type="text/javascript" language="javascript">
<!--
// Fake js to allow the use of the <noscript> tag
//-->
</script>
<noscript>
<input type="submit" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
</noscript>
</p>
</td>
</tr>
<tr>
<td colspan="<?php echo $tbl_type=='INNODB' ? '4' : '2'; ?>" align="center" class="tblFooters">
<input type="submit" value="<?php echo ' ' . $strSave . ' '; ?>" />
</td>
</tr>
</table>
</form>
<?php
echo $tbl_type=='INNODB' ? '' : "\n\n" . ' </td>' . "\n";
} // end if (displayworks)
// comments handling removed from this page; now only available on
// the field properties page
echo $tbl_type=='INNODB' ? '' : "\n\n" . ' </td></tr>' . "\n"
. '</table>' . "\n\n";
} // end if (we have columns in this table)