Conditional Ajax for DROP DATABASE
Remove duplicate logic for confirmations
This commit is contained in:
@@ -446,7 +446,7 @@ echo __('Remove database');
|
|||||||
'db' => NULL,
|
'db' => NULL,
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" onclick="return confirmLinkDropDB(this, '<?php echo PMA_jsFormat($this_sql_query); ?>')">
|
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'id="drop_db_anchor"' : ''); ?>>
|
||||||
<?php echo __('Drop the database (DROP)'); ?></a>
|
<?php echo __('Drop the database (DROP)'); ?></a>
|
||||||
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'DROP_DATABASE'); ?>
|
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'DROP_DATABASE'); ?>
|
||||||
</li>
|
</li>
|
||||||
|
@@ -110,31 +110,6 @@ function selectContent( element, lock, only_once ) {
|
|||||||
element.select();
|
element.select();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a confirmation box before submitting a "DROP DATABASE" query.
|
|
||||||
* This function is called while clicking links
|
|
||||||
*
|
|
||||||
* @param object the link
|
|
||||||
* @param object the sql query to submit
|
|
||||||
*
|
|
||||||
* @return boolean whether to run the query or not
|
|
||||||
*/
|
|
||||||
function confirmLinkDropDB(theLink, theSqlQuery)
|
|
||||||
{
|
|
||||||
// Confirmation is not required in the configuration file
|
|
||||||
// or browser is Opera (crappy js implementation)
|
|
||||||
if (PMA_messages['strDoYouReally'] == '' || typeof(window.opera) != 'undefined') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var is_confirmed = confirm(PMA_messages['strDropDatabaseStrongWarning'] + '\n' + PMA_messages['strDoYouReally'] + ' :\n' + theSqlQuery);
|
|
||||||
if (is_confirmed) {
|
|
||||||
theLink.href += '&is_js_confirmed=1';
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_confirmed;
|
|
||||||
} // end of the 'confirmLinkDropDB()' function
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a confirmation box before to submit a "DROP/DELETE/ALTER" query.
|
* Displays a confirmation box before to submit a "DROP/DELETE/ALTER" query.
|
||||||
* This function is called while clicking links
|
* This function is called while clicking links
|
||||||
|
Reference in New Issue
Block a user