From 7a4a72e955117a71843fcfc34ca9132b8271dedb Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Wed, 2 Nov 2005 14:35:26 +0000 Subject: [PATCH] - fixed html output of table - used fieldset for forms --- ChangeLog | 5 +- tbl_relation.php | 229 +++++++++++++++++++++-------------------------- 2 files changed, 108 insertions(+), 126 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc6df1139..895fa6f30 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,12 +5,15 @@ phpMyAdmin - Changelog $Id$ $Source$ -2005-11-01 Sebastian Mendel +2005-11-02 Sebastian Mendel * libraries/dbg/setup.php: - display error in error box - fixed 'not defined function' * libraries/dbg/profiling.php: - minor fixes: html output, speed, rtl lang + * tbl_realtion.php: + - fixed html output of table + - used fieldset for forms 2005-11-01 Marc Delisle * server_privileges.php: undefined variable when changing a password diff --git a/tbl_relation.php b/tbl_relation.php index 036fd69e8..6962d9184 100644 --- a/tbl_relation.php +++ b/tbl_relation.php @@ -5,7 +5,6 @@ /** * Gets some core libraries */ -require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/common.lib.php'); require_once('./tbl_properties_common.php'); $url_query .= '&goto=tbl_properties.php'; @@ -30,16 +29,16 @@ require_once('./libraries/relation.lib.php'); $options_array = array('CASCADE' => 'CASCADE', 'SET_NULL' => 'SET NULL', 'NO_ACTION' => 'NO ACTION', 'RESTRICT' => 'RESTRICT'); - /** - * Generate dropdown choices - * - * @param string Message to display - * @param string Name of the field + * @param array Choices for dropdown + * @return string The existing value (for selected) + * + * @access public + */ function PMA_generate_dropdown($dropdown_question,$radio_name,$choices,$selected_value) { global $font_smallest; @@ -103,7 +102,7 @@ if (isset($destination) && $cfgRelation['relwork']) { . '\'' . PMA_sqlAddslashes($foreign_db) . '\', ' . '\'' . PMA_sqlAddslashes($foreign_table) . '\',' . '\'' . PMA_sqlAddslashes($foreign_field) . '\')'; - } else if ($existrel[$master_field]['foreign_db'] . '.' .$existrel[$master_field]['foreign_table'] . '.' . $existrel[$master_field]['foreign_field'] != $foreign_string) { + } elseif ($existrel[$master_field]['foreign_db'] . '.' .$existrel[$master_field]['foreign_table'] . '.' . $existrel[$master_field]['foreign_field'] != $foreign_string) { $upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['relation']) . ' SET' . ' foreign_db = \'' . PMA_sqlAddslashes($foreign_db) . '\', ' . ' foreign_table = \'' . PMA_sqlAddslashes($foreign_table) . '\', ' @@ -112,7 +111,7 @@ if (isset($destination) && $cfgRelation['relwork']) { . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'' . ' AND master_field = \'' . PMA_sqlAddslashes($master_field) . '\''; } // end if... else.... - } else if (isset($existrel[$master_field])) { + } elseif (isset($existrel[$master_field])) { $upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation']) . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\'' @@ -158,7 +157,7 @@ if (isset($destination_innodb)) { // end repeated code - } else if (($existrel_innodb[$master_field]['foreign_db'] . '.' .$existrel_innodb[$master_field]['foreign_table'] . '.' . $existrel_innodb[$master_field]['foreign_field'] != $foreign_string) + } elseif (($existrel_innodb[$master_field]['foreign_db'] . '.' .$existrel_innodb[$master_field]['foreign_table'] . '.' . $existrel_innodb[$master_field]['foreign_field'] != $foreign_string) || ( ${$master_field . '_on_delete'} != (!empty($existrel_innodb[$master_field]['on_delete']) ? $existrel_innodb[$master_field]['on_delete'] : '')) || ( ${$master_field . '_on_update'} != (!empty($existrel_innodb[$master_field]['on_update']) ? $existrel_innodb[$master_field]['on_update'] : '')) ) { @@ -193,7 +192,7 @@ if (isset($destination_innodb)) { } } // end if... else.... - } else if (isset($existrel_innodb[$master_field])) { + } elseif (isset($existrel_innodb[$master_field])) { if (PMA_MYSQL_INT_VERSION >= 40013) { $upd_query = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP FOREIGN KEY ' @@ -314,7 +313,7 @@ if ($cfgRelation['relwork'] || $tbl_type=='INNODB') { $selectboxall_innodb[$field_full] = $field_v; } - } else if (isset($curr_field['Non_unique']) && $curr_field['Non_unique'] == 0 && $seen_a_primary==FALSE) { + } elseif (isset($curr_field['Non_unique']) && $curr_field['Non_unique'] == 0 && $seen_a_primary==FALSE) { // if we can't find a primary key we take any unique one // (in fact, we show all segments of unique keys // and all unique keys) @@ -326,7 +325,7 @@ if ($cfgRelation['relwork'] || $tbl_type=='INNODB') { } // for InnoDB, any index is allowed - } else if ($tbl_type=='INNODB' && isset($curr_table[1]) && $curr_table[1]=='InnoDB') { + } elseif ($tbl_type=='INNODB' && isset($curr_table[1]) && $curr_table[1]=='InnoDB') { $field_full = $db . '.' . $curr_field['Table'] . '.' . $curr_field['Column_name']; $field_v = $curr_field['Table'] . '->' . $curr_field['Column_name']; $selectboxall_innodb[$field_full] = $field_v; @@ -338,8 +337,7 @@ if ($cfgRelation['relwork'] || $tbl_type=='INNODB') { unset($fi_rs); // Mike Beck - 24.07.02: i've been asked to add all keys of the // current table (see bug report #574851) - } - else if ($curr_table[0] == $table) { + } elseif ($curr_table[0] == $table) { PMA_DBI_select_db($db); // need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli @@ -371,48 +369,42 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) { $save_row[] = $row; } $saved_row_cnt = count($save_row); - echo $tbl_type=='INNODB' ? '' : '' . "\n" - . ' - - - - - - - - + ?> + + - - - -
' . "\n\n"; -?> - - - - - - - - ' .$strInternalRelations; - if ($tbl_type=='INNODB') { - echo ' ' . PMA_showHint($strInternalNotNecessary); - } - echo ''; - } + ?> +
+ + +
+ + ' . $strInternalRelations; if ($tbl_type=='INNODB') { - echo ''; + echo PMA_showHint( $strInternalNotNecessary ); } - ?> + echo ''; + } + if ( $tbl_type=='INNODB' ) { + echo ''; + } + ?> - - + ?> + + - - '; if (!empty($save_row[$i]['Key'])) { - ?> - - '; - } // end if (a key exists) - } // end if (InnoDB) - ?> - + PMA_generate_dropdown('ON UPDATE', + htmlspecialchars($save_row[$i]['Field']) . '_on_update', + $options_array, + isset($existrel_innodb[$myfield]['on_update']) ? $existrel_innodb[$myfield]['on_update']: '' ); + echo '' . "\n"; + } else { + echo $strNoIndex; + } // end if (a key exists) + echo ' '; + } // end if (InnoDB) + ?> '; - } - } - - echo $tbl_type=='INNODB' ? '' : "\n\n" . ' ' . "\n"; + + echo '
InnoDB'; - if (PMA_MYSQL_INT_VERSION < 40013) { - echo ' (**)'; - } - echo 'InnoDB'; + if (PMA_MYSQL_INT_VERSION < 40013) { + echo '(**)'; + } + echo '
+ - + ?> + - - + + + + ' . "\n" + .'' . "\n"; - PMA_generate_dropdown('ON UPDATE', - htmlspecialchars($save_row[$i]['Field']) . '_on_update', - $options_array, - (isset($existrel_innodb[$myfield]['on_update']) ? $existrel_innodb[$myfield]['on_update']: '') ); - - } else { - echo '' . PMA_showHint($strNoIndex) . '
' . "\n"; + echo '' . "\n"; + if ($cfgRelation['displaywork']) { // Get "display_field" infos $disp = PMA_getDisplayField($db, $table); - - ?> - -
- -
- + ' . htmlspecialchars($row['Field']) . ''. "\n"; } // end while - ?> - -
- -
+ ?> +
+ +
- -' + .'** ' . sprintf($strUpgrade, 'MySQL', '4.0.13') + .''; +} /** * Displays the footer