diff --git a/libraries/server_synchronize.lib.php b/libraries/server_synchronize.lib.php index 5525fbade..4bd06bc7c 100644 --- a/libraries/server_synchronize.lib.php +++ b/libraries/server_synchronize.lib.php @@ -1416,13 +1416,24 @@ function PMA_syncDisplayHeaderTargetAndMatchingTables($trg_db, $matching_tables) echo ''; $odd_row = false; foreach ($matching_tables as $tbl_name) { - $odd_row = ! $odd_row; - echo ' - ' .$tbl_name . ''; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo ' ' .$tbl_name . ''; echo ''; } return $odd_row; } + +/** + * PMA_syncDisplayBeginTableRow() displays the TR tag for alternating colors + * + * @param boolean $odd_row current status of the toggle + * @return boolean $odd_row final status of the toggle +*/ +function PMA_syncDisplayBeginTableRow($odd_row) { + $odd_row = ! $odd_row; + echo ''; + return $odd_row; +} ?> diff --git a/server_synchronize.php b/server_synchronize.php index 6aab6daf0..1a6f0661c 100644 --- a/server_synchronize.php +++ b/server_synchronize.php @@ -316,11 +316,8 @@ if ((isset($_REQUEST['submit_connect']))) { /** * Displays the name of the matching table */ - $odd_row = ! $odd_row; - echo ' - ' . $matching_tables[$i]. "\n" . ' + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo '' . $matching_tables[$i]. "\n" . ' '; /** * Calculating the number of alter columns, number of columns to be added, number of columns to be removed, @@ -378,11 +375,8 @@ if ((isset($_REQUEST['submit_connect']))) { * Displays the tables' names present in source but missing from target */ for ($j = 0; $j < count($source_tables_uncommon); $j++) { - $odd_row = !$odd_row; - echo ' - + ' .$source_tables_uncommon[$j]. "\n" . ' '; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo ' + ' .$source_tables_uncommon[$j]. "\n" . ' '; echo 'Click to Select'; } foreach ($target_tables_uncommon as $tbl_nc_name) { - $odd_row = ! $odd_row; - echo ' -       '; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo '      '; echo ''; } /** @@ -414,19 +405,13 @@ if ((isset($_REQUEST['submit_connect']))) { $odd_row = PMA_syncDisplayHeaderTargetAndMatchingTables($trg_db, $matching_tables); foreach ($source_tables_uncommon as $tbl_nc_name) { - $odd_row = ! $odd_row; - echo ' - ' .$tbl_nc_name . "\n" . ' (' . $GLOBALS['strNotPresent'] . ') + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo '' .$tbl_nc_name . "\n" . ' (' . $GLOBALS['strNotPresent'] . ') '; } foreach ($target_tables_uncommon as $tbl_nc_name) { - $odd_row = ! $odd_row; - echo ' - - ' .$tbl_nc_name . ''; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo ' - ' .$tbl_nc_name . ''; echo ''; } echo ''; @@ -732,11 +717,8 @@ if (isset($_REQUEST['Table_ids'])) { PMA_syncDisplayHeaderSource($src_db); $odd_row = false; for($i = 0; $i < count($matching_tables); $i++) { - $odd_row = !$odd_row; - echo ' - ' . $matching_tables[$i]. "\n" . ' + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo '' . $matching_tables[$i]. "\n" . ' '; $num_alter_cols = 0; @@ -811,11 +793,8 @@ if (isset($_REQUEST['Table_ids'])) { $_SESSION['insert_array'] = $insert_array; for ($j = 0; $j < count($source_tables_uncommon); $j++) { - $odd_row = ! $odd_row; - echo ' - + ' .$source_tables_uncommon[$j]. "\n" . ' + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo ' + ' .$source_tables_uncommon[$j]. "\n" . ' '; /** * Display the difference only when it has not been applied @@ -859,20 +838,14 @@ if (isset($_REQUEST['Table_ids'])) { * Displaying the target database tables */ foreach ($target_tables_uncommon as $tbl_nc_name) { - $odd_row = ! $odd_row; - echo ' -       '; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo '      '; echo ''; } echo ''; $odd_row = PMA_syncDisplayHeaderTargetAndMatchingTables($trg_db, $matching_tables); foreach ($source_tables_uncommon as $tbl_nc_name) { - $odd_row = ! $odd_row; - echo ''; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); if (in_array($tbl_nc_name, $uncommon_tables)) { echo '' .$tbl_nc_name . "\n" . ' (' . $GLOBALS['strNotPresent'] . ')'; } else { @@ -882,11 +855,8 @@ if (isset($_REQUEST['Table_ids'])) { '; } foreach ($target_tables_uncommon as $tbl_nc_name) { - $odd_row = ! $odd_row; - echo ' - - ' .$tbl_nc_name . ''; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo ' - ' .$tbl_nc_name . ''; echo ''; } echo ' @@ -989,47 +959,32 @@ if (isset($_REQUEST['synchronize_db'])) { $odd_row = false; for($i = 0; $i < count($matching_tables); $i++) { - $odd_row = !$odd_row; - echo ' - ' . $matching_tables[$i]. "\n" . ' + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo '' . $matching_tables[$i]. "\n" . ' '; } for ($j = 0; $j < count($source_tables_uncommon); $j++) { - $odd_row = ! $odd_row; - echo ' - + ' .$source_tables_uncommon[$j]. "\n" . ' '; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo ' + ' .$source_tables_uncommon[$j]. "\n" . ' '; echo ' '; } foreach ($target_tables_uncommon as $tbl_nc_name) { - $odd_row = ! $odd_row; - echo ' -       '; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo '      '; echo ''; } echo ''; $odd_row = PMA_syncDisplayHeaderTargetAndMatchingTables($trg_db, $matching_tables); foreach ($source_tables_uncommon as $tbl_nc_name) { - $odd_row = !$odd_row; - echo ' - ' .$tbl_nc_name . "\n" . ' + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo '' .$tbl_nc_name . "\n" . ' '; } foreach ($target_tables_uncommon as $tbl_nc_name) { - $odd_row = ! $odd_row; - echo ' - ' .$tbl_nc_name . ''; + $odd_row = PMA_syncDisplayBeginTableRow($odd_row); + echo ' ' .$tbl_nc_name . ''; echo ''; } echo ' ';