Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: tbl_row_action.php,v 2.17 2005/07/10 19:38:54 nijel Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 require_once('./libraries/grab_globals.lib.php'); 00005 require_once('./libraries/common.lib.php'); 00006 require_once('./libraries/mysql_charsets.lib.php'); 00007 00011 if ((!isset($rows_to_delete) || !is_array($rows_to_delete)) && !isset($mult_btn)) { 00012 $disp_message = $strNoRowsSelected; 00013 $disp_query = ''; 00014 require('./sql.php'); 00015 require_once('./footer.inc.php'); 00016 } 00017 00022 // workaround for IE problem: 00023 if (isset($submit_mult_delete_x)) { 00024 $submit_mult = 'row_delete'; 00025 } elseif (isset($submit_mult_change_x)) { 00026 $submit_mult = 'row_edit'; 00027 } elseif (isset($submit_mult_export_x)) { 00028 $submit_mult = 'row_export'; 00029 } 00030 00031 // garvin: If the 'Ask for confirmation' button was pressed, this can only come from 'delete' mode, 00032 // so we set it straight away. 00033 if (isset($mult_btn)) { 00034 $submit_mult = 'row_delete'; 00035 } 00036 00037 switch($submit_mult) { 00038 case 'row_delete': 00039 case 'row_edit': 00040 case 'row_export': 00041 // leave as is 00042 break; 00043 00044 case $GLOBALS['strExport']: 00045 $submit_mult = 'row_export'; 00046 break; 00047 00048 case $GLOBALS['strDelete']: 00049 case $GLOBALS['strKill']: 00050 $submit_mult = 'row_delete'; 00051 break; 00052 00053 default: 00054 case $GLOBALS['strEdit']: 00055 $submit_mult = 'row_edit'; 00056 break; 00057 } 00058 00059 if ($submit_mult == 'row_edit') { 00060 $js_to_run = 'tbl_change.js'; 00061 } 00062 00063 if ($submit_mult == 'row_delete' || $submit_mult == 'row_export') { 00064 $js_to_run = 'functions.js'; 00065 } 00066 00067 require_once('./header.inc.php'); 00068 00069 if (!empty($submit_mult)) { 00070 switch($submit_mult) { 00071 case 'row_edit': 00072 $primary_key = array(); 00073 // garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the 00074 // indicating primary key. Then we built the array which is used for the tbl_change.php script. 00075 foreach ($rows_to_delete AS $i_primary_key => $del_query) { 00076 $primary_key[] = urldecode($i_primary_key); 00077 } 00078 00079 $active_page = 'tbl_change.php'; 00080 include './tbl_change.php'; 00081 break; 00082 00083 case 'row_export': 00084 // Needed to allow SQL export 00085 $single_table = TRUE; 00086 00087 $primary_key = array(); 00088 $sql_query = urldecode($sql_query); 00089 // garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the 00090 // indicating primary key. Then we built the array which is used for the tbl_change.php script. 00091 foreach ($rows_to_delete AS $i_primary_key => $del_query) { 00092 $primary_key[] = urldecode($i_primary_key); 00093 } 00094 00095 $active_page = 'tbl_properties_export.php'; 00096 include './tbl_properties_export.php'; 00097 break; 00098 00099 case 'row_delete': 00100 default: 00101 $action = 'tbl_row_action.php'; 00102 $err_url = 'tbl_row_action.php?' . PMA_generate_common_url($db, $table); 00103 if (!isset($mult_btn)) { 00104 $original_sql_query = $sql_query; 00105 $original_url_query = $url_query; 00106 $original_pos = $pos; 00107 } 00108 require('./mult_submits.inc.php'); 00109 $url_query = PMA_generate_common_url($db, $table) 00110 . '&goto=tbl_properties.php'; 00111 00112 00116 // sql_query is not set when user does not confirm multi-delete 00117 if ((!empty($submit_mult) || isset($mult_btn)) && isset($sql_query)) { 00118 $disp_message = $strSuccess; 00119 $disp_query = $sql_query; 00120 } 00121 00122 if (isset($original_sql_query)) { 00123 $sql_query = $original_sql_query; 00124 } 00125 00126 if (isset($original_url_query)) { 00127 $url_query = $original_url_query; 00128 } 00129 00130 if (isset($original_pos)) { 00131 $pos = $original_pos; 00132 } 00133 00134 // this is because sql.php could call tbl_properties_structure 00135 // which would think it needs to call mult_submits.inc.php: 00136 unset($submit_mult); 00137 unset($mult_btn); 00138 00139 $active_page = 'sql.php'; 00140 require('./sql.php'); 00141 00145 require_once('./footer.inc.php'); 00146 break; 00147 } 00148 } 00149 ?>