Removed inline calls to confirmLink() for Empty/Drop Table actions in libraries/tbl_links.inc.php

This commit is contained in:
ninadsp
2010-07-11 23:14:41 +05:30
parent a180017106
commit dd58a5bc23
2 changed files with 61 additions and 3 deletions

View File

@@ -1871,4 +1871,62 @@ $(document).ready(function() {
} }
}) // end create table form submit button actions }) // end create table form submit button actions
}, 'top.frame_content'); //end $(document).ready for 'Create Table' }, 'top.frame_content'); //end $(document).ready for 'Create Table'
/**
* jQuery coding for Empty Table and Drop Table. Used wherever libraries/
* tbl_links.inc.php is used.
*/
$(document).ready(function() {
//Empty Table
$("#empty_table_anchor").live('click', function(event) {
event.preventDefault();
var question = 'TRUNCATE TABLE ' + window.parent.table;
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$("#topmenucontainer")
.next('div')
.remove()
.end()
.after(data.sql_query);
}
else {
PMA_ajaxShowMessage(data.error);
}
}) // end $.get
})
}) // end Empty Table
//Drop Table
$("#drop_table_anchor").live('click', function(event) {
event.preventDefault();
var question = 'DROP TABLE/VIEW ' + window.parent.table;
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$("#topmenucontainer")
.next('div')
.remove()
.end()
.after(data.sql_query);
window.parent.table = '';
window.parent.refreshNavigation();
}
else {
PMA_ajaxShowMessage(data.error);
}
}) // end $.get
})
})
}); //end $(document).ready() for libraries/tbl_links.inc.php

View File

@@ -98,7 +98,7 @@ if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_
$tabs['empty']['args']['reload'] = 1; $tabs['empty']['args']['reload'] = 1;
$tabs['empty']['args']['sql_query'] = 'TRUNCATE TABLE ' . PMA_backquote($table); $tabs['empty']['args']['sql_query'] = 'TRUNCATE TABLE ' . PMA_backquote($table);
$tabs['empty']['args']['zero_rows'] = sprintf(__('Table %s has been emptied'), htmlspecialchars($table)); $tabs['empty']['args']['zero_rows'] = sprintf(__('Table %s has been emptied'), htmlspecialchars($table));
$tabs['empty']['attr'] = 'onclick="return confirmLink(this, \'TRUNCATE TABLE ' . PMA_jsFormat($table) . '\')"'; $tabs['empty']['id'] = 'empty_table_anchor';
$tabs['empty']['args']['goto'] = 'tbl_structure.php'; $tabs['empty']['args']['goto'] = 'tbl_structure.php';
$tabs['empty']['class'] = 'caution'; $tabs['empty']['class'] = 'caution';
$tabs['empty']['icon'] = 'b_empty.png'; $tabs['empty']['icon'] = 'b_empty.png';
@@ -131,7 +131,7 @@ if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
$tabs['drop']['args']['sql_query'] = $drop_command . ' ' . PMA_backquote($table); $tabs['drop']['args']['sql_query'] = $drop_command . ' ' . PMA_backquote($table);
$tabs['drop']['args']['goto'] = 'db_structure.php'; $tabs['drop']['args']['goto'] = 'db_structure.php';
$tabs['drop']['args']['zero_rows'] = sprintf(($tbl_is_view ? __('View %s has been dropped') : __('Table %s has been dropped')), htmlspecialchars($table)); $tabs['drop']['args']['zero_rows'] = sprintf(($tbl_is_view ? __('View %s has been dropped') : __('Table %s has been dropped')), htmlspecialchars($table));
$tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"'; $tabs['drop']['id'] = 'drop_table_anchor';
unset($drop_command); unset($drop_command);
$tabs['drop']['class'] = 'caution'; $tabs['drop']['class'] = 'caution';
} }