diff --git a/ChangeLog b/ChangeLog index 6bfaf3070..4deb6b360 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,12 @@ phpMyAdmin - Changelog $Id$ $Source$ +2004-04-15 Michal Cihar + * tbl_properties_export.php, tbl_row_delete.php, + libraries/display_tbl.lib.php: Support for exporting selected rows (RFE + #927554) [still missing images/button_export.png, waiting for somebody + to make it :-)]. + 2004-04-15 Olivier Mueller * left.php: RFE #859208, Logout button in left frame diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 1544cd44c..23e8e93e9 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -1805,9 +1805,14 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) . '' . $delete_text . '' . (($propicon == 'both') ? ' ' . $delete_text : '') . "\n" . ''; + echo ' '; + } else { echo ' ' . (($propicon == 'both') ? ' ' . $GLOBALS['strEdit'] : ''); echo ' ' . (($propicon == 'both') ? ' ' . $delete_text : ''); + echo ' ' . (($propicon == 'both') ? ' ' . $GLOBALS['strExport'] : ''); } echo "\n"; } else { diff --git a/tbl_properties_export.php b/tbl_properties_export.php index 98d266f55..6a077054c 100644 --- a/tbl_properties_export.php +++ b/tbl_properties_export.php @@ -41,6 +41,21 @@ if (isset($sql_query)) { if (!empty($analyzed_sql[0]['where_clause'])) { $sql_query .= ' WHERE ' . $analyzed_sql[0]['where_clause']; } + if (isset($primary_key)) { + if (empty($analyzed_sql[0]['where_clause'])) { + $sql_query .= ' WHERE '; + } else { + $sql_query .= ' AND ( '; + } + $conj = ''; + foreach($primary_key AS $i => $key) { + $sql_query .= $conj . '( ' . $key . ' ) '; + $conj = 'OR '; + } + if (!empty($analyzed_sql[0]['where_clause'])) { + $sql_query .= ' ) '; + } + } if (!empty($analyzed_sql[0]['group_by_clause'])) { $sql_query .= ' GROUP BY ' . $analyzed_sql[0]['group_by_clause']; } diff --git a/tbl_row_delete.php b/tbl_row_delete.php index d85eed51e..f90ed4090 100644 --- a/tbl_row_delete.php +++ b/tbl_row_delete.php @@ -14,6 +14,8 @@ if (isset($submit_mult_x)) { $submit_mult = 'row_delete'; } elseif (isset($submit_mult_edit_x)) { $submit_mult = 'row_edit'; +} elseif (isset($submit_mult_export_x)) { + $submit_mult = 'row_export'; } // garvin: If the 'Ask for confirmation' button was pressed, this can only come from 'delete' mode, @@ -26,7 +28,7 @@ if ($submit_mult == 'row_edit') { $js_to_run = 'tbl_change.js'; } -if ($submit_mult == 'row_delete') { +if ($submit_mult == 'row_delete' || $submit_mult == 'row_export') { $js_to_run = 'functions.js'; } @@ -47,6 +49,23 @@ if (!empty($submit_mult)) { } break; + case 'row_export': + if (isset($rows_to_delete) && is_array($rows_to_delete)) { + // Needed to allow SQL export + $single_table = TRUE; + + $primary_key = array(); + $sql_query = urldecode($sql_query); + // garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the + // indicating primary key. Then we built the array which is used for the tbl_change.php script. + foreach($rows_to_delete AS $i_primary_key => $del_query) { + $primary_key[] = urldecode($i_primary_key); + } + + include './tbl_properties_export.php'; + } + break; + case 'row_delete': default: if ((isset($rows_to_delete) && is_array($rows_to_delete))