RFE #1435922 [gui] navigation frame shows listing of databases when none selected
[phpmyadmin/last10db.git] / tbl_row_action.php
blob577c9c3df0b9528bb01b025e7eff2c75e463229f
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
8 /**
11 require_once './libraries/common.inc.php';
12 require_once './libraries/mysql_charsets.lib.php';
14 /**
15 * Avoids undefined variables
17 if (!isset($pos)) {
18 $pos = 0;
21 /**
22 * No rows were selected => show again the query and tell that user.
24 if ((!isset($rows_to_delete) || !is_array($rows_to_delete)) && !isset($mult_btn)) {
25 $disp_message = $strNoRowsSelected;
26 $disp_query = '';
27 require './sql.php';
28 require_once './libraries/footer.inc.php';
31 /**
32 * Drop multiple rows if required
35 // workaround for IE problem:
36 if (isset($submit_mult_delete_x)) {
37 $submit_mult = 'row_delete';
38 } elseif (isset($submit_mult_change_x)) {
39 $submit_mult = 'row_edit';
40 } elseif (isset($submit_mult_export_x)) {
41 $submit_mult = 'row_export';
44 // garvin: If the 'Ask for confirmation' button was pressed, this can only come from 'delete' mode,
45 // so we set it straight away.
46 if (isset($mult_btn)) {
47 $submit_mult = 'row_delete';
50 switch($submit_mult) {
51 case 'row_delete':
52 case 'row_edit':
53 case 'row_export':
54 // leave as is
55 break;
57 case $GLOBALS['strExport']:
58 $submit_mult = 'row_export';
59 break;
61 case $GLOBALS['strDelete']:
62 case $GLOBALS['strKill']:
63 $submit_mult = 'row_delete';
64 break;
66 default:
67 case $GLOBALS['strEdit']:
68 $submit_mult = 'row_edit';
69 break;
72 if ($submit_mult == 'row_edit') {
73 $js_to_run = 'tbl_change.js';
76 if ($submit_mult == 'row_delete' || $submit_mult == 'row_export') {
77 $js_to_run = 'functions.js';
80 require_once './libraries/header.inc.php';
82 if (!empty($submit_mult)) {
83 switch($submit_mult) {
84 case 'row_edit':
85 $primary_key = array();
86 // garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the
87 // indicating primary key. Then we built the array which is used for the tbl_change.php script.
88 foreach ($rows_to_delete AS $i_primary_key => $del_query) {
89 $primary_key[] = urldecode($i_primary_key);
92 $active_page = 'tbl_change.php';
93 include './tbl_change.php';
94 break;
96 case 'row_export':
97 // Needed to allow SQL export
98 $single_table = TRUE;
100 $primary_key = array();
101 //$sql_query = urldecode($sql_query);
102 // garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the
103 // indicating primary key. Then we built the array which is used for the tbl_change.php script.
104 foreach ($rows_to_delete AS $i_primary_key => $del_query) {
105 $primary_key[] = urldecode($i_primary_key);
108 $active_page = 'tbl_export.php';
109 include './tbl_export.php';
110 break;
112 case 'row_delete':
113 default:
114 $action = 'tbl_row_action.php';
115 $err_url = 'tbl_row_action.php?' . PMA_generate_common_url($db, $table);
116 if (!isset($mult_btn)) {
117 $original_sql_query = $sql_query;
118 $original_url_query = $url_query;
119 $original_pos = $pos;
121 require './libraries/mult_submits.inc.php';
122 $url_query = PMA_generate_common_url($db, $table)
123 . '&amp;goto=tbl_sql.php';
127 * Show result of multi submit operation
129 // sql_query is not set when user does not confirm multi-delete
130 if ((!empty($submit_mult) || isset($mult_btn)) && ! empty($sql_query)) {
131 $disp_message = $strSuccess;
132 $disp_query = $sql_query;
135 if (isset($original_sql_query)) {
136 $sql_query = $original_sql_query;
139 if (isset($original_url_query)) {
140 $url_query = $original_url_query;
143 if (isset($original_pos)) {
144 $pos = $original_pos;
147 // this is because sql.php could call tbl_structure
148 // which would think it needs to call mult_submits.inc.php:
149 unset($submit_mult);
150 unset($mult_btn);
152 $active_page = 'sql.php';
153 require './sql.php';
156 * Displays the footer
158 require_once './libraries/footer.inc.php';
159 break;