Support for exporting selected rows (RFE #927554) [still missing images/button_export.png, waiting for somebody to make it :-)].

This commit is contained in:
Michal Čihař
2004-04-15 16:13:45 +00:00
parent 8de779e4f1
commit 34b8c3217e
4 changed files with 46 additions and 1 deletions

View File

@@ -5,6 +5,12 @@ phpMyAdmin - Changelog
$Id$
$Source$
2004-04-15 Michal Cihar <michal@cihar.com>
* 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 <om@omnis.ch>
* left.php: RFE #859208, Logout button in left frame

View File

@@ -1805,9 +1805,14 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
. '<img src="./images/button_drop.png" title="' . $delete_text . '" alt="' . $delete_text . '" width="11" height="13" />' . (($propicon == 'both') ? '&nbsp;' . $delete_text : '') . "\n"
. '</button>';
echo '&nbsp;<button class="mult_submit" type="submit" name="submit_mult" value="row_export" title="' . $GLOBALS['strExport'] . '">' . "\n"
. '<img src="./images/button_export.png" title="' . $GLOBALS['strExport'] . '" alt="' . $GLOBALS['strExport'] . '" width="11" height="13" />' . (($propicon == 'both') ? '&nbsp;' . $GLOBALS['strExport'] : '') . "\n"
. '</button>';
} else {
echo ' <input type="image" name="submit_mult_edit" value="row_edit" title="' . $GLOBALS['strEdit'] . '" src="./images/button_edit.png" />' . (($propicon == 'both') ? '&nbsp;' . $GLOBALS['strEdit'] : '');
echo '&nbsp;<input type="image" name="submit_mult" value="row_delete" title="' . $delete_text . '" src="./images/button_drop.png" />' . (($propicon == 'both') ? '&nbsp;' . $delete_text : '');
echo '&nbsp;<input type="image" name="submit_mult_export" value="row_export" title="' . $GLOBALS['strExport'] . '" src="./images/button_export.png" />' . (($propicon == 'both') ? '&nbsp;' . $GLOBALS['strExport'] : '');
}
echo "\n";
} else {

View File

@@ -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'];
}

View File

@@ -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))