Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
bc276389cb
@ -243,14 +243,21 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = PMA_messages.strTruncateTableStrongWarning + ' ' +
|
||||
PMA_sprintf(PMA_messages.strDoYouReally, 'TRUNCATE ' + escapeHtml(curr_table_name));
|
||||
var question = PMA_messages.strTruncateTableStrongWarning + ' '
|
||||
+ PMA_sprintf(PMA_messages.strDoYouReally, 'TRUNCATE ' + escapeHtml(curr_table_name))
|
||||
+ getForeignKeyCheckbox();
|
||||
|
||||
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
|
||||
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function (data) {
|
||||
var params = {
|
||||
'is_js_confirmed' : 1,
|
||||
'ajax_request' : true,
|
||||
'fk_checks': $(this).find('#fk_checks').is(':checked') ? 1 : 0
|
||||
};
|
||||
|
||||
$.get(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
// Adjust table statistics
|
||||
@ -305,12 +312,19 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
question =
|
||||
PMA_sprintf(PMA_messages.strDoYouReally, 'DROP VIEW ' + escapeHtml(curr_table_name));
|
||||
}
|
||||
question += getForeignKeyCheckbox();
|
||||
|
||||
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
|
||||
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
|
||||
$.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function (data) {
|
||||
var params = {
|
||||
'is_js_confirmed' : 1,
|
||||
'ajax_request' : true,
|
||||
'fk_checks': $(this).find('#fk_checks').is(':checked') ? 1 : 0
|
||||
};
|
||||
|
||||
$.get(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
toggleRowColors($curr_row.next());
|
||||
|
||||
@ -1675,6 +1675,23 @@ function pdfPaperSize(format, axis)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get checkbox for foreign key checks
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getForeignKeyCheckbox() {
|
||||
default_fk_check_value = PMA_commonParams.get('default_fk_check_value');
|
||||
var html = "";
|
||||
html += "<div>";
|
||||
html += "<input type=\"hidden\" name=\"fk_checks\" value=\"0\" />";
|
||||
html += "<input type=\"checkbox\" name=\"fk_checks\""
|
||||
+ " id=\"fk_checks\"" + (default_fk_check_value ? " checked=\"checked\"" : "") + " />";
|
||||
html += "<label for=\"fk_checks\">" + PMA_messages.strForeignKeyCheck + "</label>";
|
||||
html += "</div>";
|
||||
return html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
@ -1723,15 +1740,9 @@ AJAX.registerOnload('functions.js', function () {
|
||||
var sql_query = $form.find("input[name='sql_query']").val().trim();
|
||||
var $inner_sql = $(this).parent().prev().find('code.sql');
|
||||
var old_text = $inner_sql.html();
|
||||
var default_fk_check_value = $form.find("input[name='default_fk_check_value']").val() == 'true';
|
||||
|
||||
var new_content = "<textarea name=\"sql_query_edit\" id=\"sql_query_edit\">" + sql_query + "</textarea>\n";
|
||||
new_content += "<div>";
|
||||
new_content += "<input type=\"hidden\" name=\"fk_checks\" value=\"0\" />";
|
||||
new_content += "<input type=\"checkbox\" name=\"fk_checks\""
|
||||
+ " id=\"fk_checks\"" + (default_fk_check_value ? " checked=\"checked\"" : "") + " />";
|
||||
new_content += "<label for=\"fk_checks\">" + PMA_messages.strForeignKeyCheck + "</label>";
|
||||
new_content += "</div>";
|
||||
new_content += getForeignKeyCheckbox();
|
||||
new_content += "<input type=\"submit\" id=\"sql_query_edit_save\" class=\"button btnSave\" value=\"" + PMA_messages.strGo + "\"/>\n";
|
||||
new_content += "<input type=\"button\" id=\"sql_query_edit_discard\" class=\"button btnDiscard\" value=\"" + PMA_messages.strCancel + "\"/>\n";
|
||||
var $editor_area = $('div#inline_editor');
|
||||
|
||||
@ -254,7 +254,8 @@ class PMA_Header
|
||||
'pftext' => $pftext,
|
||||
'confirm' => $GLOBALS['cfg']['Confirm'],
|
||||
'LoginCookieValidity' => $GLOBALS['cfg']['LoginCookieValidity'],
|
||||
'logged_in' => isset($GLOBALS['userlink']) ? true : false
|
||||
'logged_in' => isset($GLOBALS['userlink']) ? true : false,
|
||||
'default_fk_check_value' => PMA_Util::getDefaultFKCheckValue() ? 1 : 0
|
||||
);
|
||||
if (isset($GLOBALS['cfg']['Server'])
|
||||
&& isset($GLOBALS['cfg']['Server']['auth_type'])
|
||||
|
||||
@ -1291,11 +1291,6 @@ class PMA_Util
|
||||
'profiling', __('Profiling'), isset($_SESSION['profiling']), true
|
||||
);
|
||||
}
|
||||
|
||||
// Pass default foreign_key_checks
|
||||
$default_fk_check_value = $GLOBALS['dbi']->getVariable('FOREIGN_KEY_CHECKS') == 'ON';
|
||||
$retval .= '<input type="hidden" disabled name="default_fk_check_value"'
|
||||
. 'value="' . ($default_fk_check_value ? 'true' : 'false') . '"/>';
|
||||
$retval .= '</form>';
|
||||
|
||||
/**
|
||||
@ -3206,6 +3201,15 @@ class PMA_Util
|
||||
}
|
||||
}
|
||||
|
||||
public static function getDefaultFKCheckValue() {
|
||||
if ($GLOBALS['cfg']['DefaultForeignKeyChecks'] === 'enable') {
|
||||
return true;
|
||||
} else if ($GLOBALS['cfg']['DefaultForeignKeyChecks'] === 'disable') {
|
||||
return false;
|
||||
}
|
||||
return ($GLOBALS['dbi']->getVariable('FOREIGN_KEY_CHECKS') == 'ON');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML for Foreign key check checkbox
|
||||
*
|
||||
@ -3213,13 +3217,7 @@ class PMA_Util
|
||||
*/
|
||||
public static function getFKCheckbox()
|
||||
{
|
||||
if ($GLOBALS['cfg']['DefaultForeignKeyChecks'] === 'enable') {
|
||||
$checked = true;
|
||||
} else if ($GLOBALS['cfg']['DefaultForeignKeyChecks'] === 'disable') {
|
||||
$checked = false;
|
||||
} else {
|
||||
$checked = $GLOBALS['dbi']->getVariable('FOREIGN_KEY_CHECKS') == 'ON';
|
||||
}
|
||||
$checked = self::getDefaultFKCheckValue();
|
||||
$html = '<input type="hidden" name="fk_checks" value="0" />';
|
||||
$html .= '<input type="checkbox" name="fk_checks"'
|
||||
. ' id="fk_checks" value="1"'
|
||||
|
||||
@ -125,6 +125,10 @@ $GLOBALS['dummy_queries'] = array(
|
||||
'query' => 'SHOW VARIABLES LIKE \'language\';',
|
||||
'result' => array(),
|
||||
),
|
||||
array(
|
||||
'query' => 'SHOW SESSION VARIABLES LIKE \'FOREIGN_KEY_CHECKS\';',
|
||||
'result' => array('foreign_key_checks', 'ON'),
|
||||
),
|
||||
array(
|
||||
'query' => 'SHOW TABLES FROM `pma_test`;',
|
||||
'result' => array(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user