Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-08-25 14:12:50 +02:00
commit 57fc1b3dde
19 changed files with 354 additions and 307 deletions

View File

@ -25,7 +25,7 @@ AJAX.registerTeardown('db_central_columns.js', function () {
$('.edit_cancel_form').unbind('click');
$('#table-select').unbind('change');
$('#column-select').unbind('change');
$("#add_col_div>a").unbind('click');
$("#add_col_div").find(">a").unbind('click');
$('#add_new').unbind('submit');
$('#multi_edit_central_columns').unbind('submit');
$("select.default_type").unbind('change');
@ -35,9 +35,9 @@ AJAX.registerTeardown('db_central_columns.js', function () {
AJAX.registerOnload('db_central_columns.js', function () {
$('#tableslistcontainer input,#tableslistcontainer select,#tableslistcontainer .default_value,#tableslistcontainer .open_enum_editor').hide();
$('#tableslistcontainer .checkall').show();
$('#tableslistcontainer .checkall_box').show();
if ($('#table_columns tbody tr').length > 0) {
$('#tableslistcontainer').find('.checkall').show();
$('#tableslistcontainer').find('.checkall_box').show();
if ($('#table_columns').find('tbody tr').length > 0) {
$("#table_columns").tablesorter({
headers: {
0: {sorter: false},
@ -46,7 +46,7 @@ AJAX.registerOnload('db_central_columns.js', function () {
}
});
}
$('#tableslistcontainer button[name="delete_central_columns"]').click(function(event){
$('#tableslistcontainer').find('button[name="delete_central_columns"]').click(function(event){
event.preventDefault();
var multi_delete_columns = $('.checkall:checkbox:checked').serialize();
if(multi_delete_columns === ''){
@ -57,7 +57,7 @@ AJAX.registerOnload('db_central_columns.js', function () {
$("#del_col_name").val(multi_delete_columns);
$("#del_form").submit();
});
$('#tableslistcontainer button[name="edit_central_columns"]').click(function(event){
$('#tableslistcontainer').find('button[name="edit_central_columns"]').click(function(event){
event.preventDefault();
var editColumnList = $('.checkall:checkbox:checked').serialize();
if(editColumnList === ''){
@ -77,12 +77,12 @@ AJAX.registerOnload('db_central_columns.js', function () {
AJAX.source = $(this);
$.post('db_central_columns.php', multi_column_edit_data, AJAX.responseHandler);
});
$('#add_new td').each(function(){
$('#add_new').find('td').each(function(){
if ($(this).attr('name') !== 'undefined') {
$(this).find('input,select:first').attr('name', $(this).attr('name'));
}
});
$("#add_new #field_0_0").attr('required','required');
$("#field_0_0").attr('required','required');
$('#add_new input[type="text"], #add_new input[type="number"], #add_new select')
.css({
'width' : '10em',
@ -129,7 +129,7 @@ AJAX.registerOnload('db_central_columns.js', function () {
$('#edit_' + rownum).show();
$('#f_' + rownum + ' td span').show();
$('#f_' + rownum + ' input, #f_' + rownum + ' select,#f_'+rownum+' .default_value, #f_' + rownum + ' .open_enum_editor').hide();
$('#tableslistcontainer .checkall').show();
$('#tableslistcontainer').find('.checkall').show();
});
$('.edit_save_form').click(function(event) {
//alert(1);
@ -177,7 +177,7 @@ AJAX.registerOnload('db_central_columns.js', function () {
$('#edit_' + rownum).show();
$('#f_' + rownum + ' td span').show();
$('#f_' + rownum + ' input, #f_' + rownum + ' select,#f_' + rownum + ' .default_value, #f_' + rownum + ' .open_enum_editor').hide();
$('#tableslistcontainer .checkall').show();
$('#tableslistcontainer').find('.checkall').show();
},
error: function() {
PMA_ajaxShowMessage(
@ -191,7 +191,7 @@ AJAX.registerOnload('db_central_columns.js', function () {
});
$('#table-select').change(function(e) {
var selectvalue = $(this).val();
var default_column_select = $('#column-select option:first');
var default_column_select = $('#column-select').find('option:first');
var href = "db_central_columns.php";
var params = {
'ajax_request' : true,
@ -215,18 +215,19 @@ AJAX.registerOnload('db_central_columns.js', function () {
$("#add_column").submit();
}
});
$("#add_col_div>a").click(function(event){
$("#add_col_div").find(">a").click(function(event){
$('#add_new').slideToggle("slow");
if($("#add_col_div>a span").html() === '+') {
$("#add_col_div>a span").html('-');
var $addColDivLinkSpan = $("#add_col_div").find(">a span");
if($addColDivLinkSpan.html() === '+') {
$addColDivLinkSpan.html('-');
} else {
$("#add_col_div>a span").html('+');
$addColDivLinkSpan.html('+');
}
});
$('#add_new').submit(function(event){
$('#add_new').toggle();
});
$("#tableslistcontainer select.default_type").change(function () {
$("#tableslistcontainer").find("select.default_type").change(function () {
if ($(this).val() === 'USER_DEFINED') {
$(this).siblings('.default_value').attr('name','col_default');
$(this).attr('name','col_default_sel');

View File

@ -67,7 +67,7 @@ AJAX.registerOnload('db_qbe.js', function () {
* Ajax event handlers for 'Delete bookmark'
*/
$(document).on('click', "#deleteSearch", function (event) {
var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $("#searchId option:selected").text());
var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $("#searchId").find("option:selected").text());
if (!confirm(question)) {
return false;
}

View File

@ -49,7 +49,7 @@ function PMA_adjustTotals() {
/**
* @var $allTr jQuery object that references all the rows in the list of tables
*/
var $allTr = $("#tablesForm table.data tbody:first tr");
var $allTr = $("#tablesForm").find("table.data tbody:first tr");
// New summary values for the table
var tableSum = $allTr.size();
var rowsSum = 0;
@ -142,7 +142,7 @@ function PMA_adjustTotals() {
*/
function PMA_fetchRealRowCount($target)
{
var $throbber = $('#pma_navigation .throbber')
var $throbber = $('#pma_navigation').find('.throbber')
.first()
.clone()
.css({visibility: 'visible', display: 'inline-block'})

View File

@ -12,8 +12,9 @@ AJAX.registerTeardown('db_tracking.js', function () {
*/
AJAX.registerOnload('db_tracking.js', function () {
$('#versions tr:first th').append($('<div class="sorticon"></div>'));
$('#versions').tablesorter({
var $versions = $('#versions');
$versions.find('tr:first th').append($('<div class="sorticon"></div>'));
$versions.tablesorter({
sortList: [[1, 0]],
headers: {
0: {sorter: false},
@ -24,8 +25,9 @@ AJAX.registerOnload('db_tracking.js', function () {
}
});
$('#noversions tr:first th').append($('<div class="sorticon"></div>'));
$('#noversions').tablesorter({
var $noVersions = $('#noversions');
$noVersions.find('tr:first th').append($('<div class="sorticon"></div>'));
$noVersions.tablesorter({
sortList: [[1, 0]],
headers: {
0: {sorter: false},
@ -33,10 +35,12 @@ AJAX.registerOnload('db_tracking.js', function () {
}
});
var $body = $('body');
/**
* Handles multi submit for tracked tables
*/
$('body').on('click', '#trackedForm.ajax button[name="submit_mult"], #trackedForm.ajax input[name="submit_mult"]', function (e) {
$body.on('click', '#trackedForm.ajax button[name="submit_mult"], #trackedForm.ajax input[name="submit_mult"]', function (e) {
e.preventDefault();
var $button = $(this);
var $form = $button.parent('form');
@ -59,7 +63,7 @@ AJAX.registerOnload('db_tracking.js', function () {
/**
* Handles multi submit for untracked tables
*/
$('body').on('click', '#untrackedForm.ajax button[name="submit_mult"], #untrackedForm.ajax input[name="submit_mult"]', function (e) {
$body.on('click', '#untrackedForm.ajax button[name="submit_mult"], #untrackedForm.ajax input[name="submit_mult"]', function (e) {
e.preventDefault();
var $button = $(this);
var $form = $button.parent('form');
@ -72,7 +76,7 @@ AJAX.registerOnload('db_tracking.js', function () {
/**
* Ajax Event handler for 'Delete tracking'
*/
$('body').on('click', 'a.delete_tracking_anchor.ajax', function (e) {
$body.on('click', 'a.delete_tracking_anchor.ajax', function (e) {
e.preventDefault();
var $anchor = $(this);
var question = PMA_messages.strDeleteTrackingData;

View File

@ -92,7 +92,7 @@ function createTemplate(name)
if (response.success === true) {
$('#templateName').val('');
$('#template').html(response.data);
$("#template option").each(function() {
$("#template").find("option").each(function() {
if ($(this).text() == name) {
$(this).prop('selected', true);
}
@ -205,7 +205,7 @@ function deleteTemplate(id)
PMA_ajaxShowMessage();
$.post('tbl_export.php', params, function (response) {
if (response.success === true) {
$('#template option[value="' + id + '"]').remove();
$('#template').find('option[value="' + id + '"]').remove();
PMA_ajaxShowMessage(PMA_messages.strTemplateDeleted);
} else {
PMA_ajaxShowMessage(response.error, false);
@ -284,8 +284,8 @@ AJAX.registerOnload('export.js', function () {
* according to the currently selected plugin from the dropdown list
*/
$("#plugins").change(function () {
$("#format_specific_opts div.format_specific_options").hide();
var selected_plugin_name = $("#plugins option:selected").val();
$("#format_specific_opts").find("div.format_specific_options").hide();
var selected_plugin_name = $("#plugins").find("option:selected").val();
$("#" + selected_plugin_name + "_options").show();
});
@ -337,7 +337,7 @@ function setup_table_structure_or_data() {
if ($("input[name='export_type']").val() != 'database') {
return;
}
var pluginName = $("#plugins option:selected").val();
var pluginName = $("#plugins").find("option:selected").val();
var formElemName = pluginName + "_structure_or_data";
var force_structure_or_data = !($("input[name='" + formElemName + "_default']").length);
@ -412,14 +412,15 @@ function toggle_structure_data_opts()
*/
function toggle_save_to_file()
{
var $ulSaveAsfile = $("#ul_save_asfile");
if (!$("#radio_dump_asfile").prop("checked")) {
$("#ul_save_asfile > li").fadeTo('fast', 0.4);
$("#ul_save_asfile > li > input").prop('disabled', true);
$("#ul_save_asfile > li> select").prop('disabled', true);
$ulSaveAsfile.find("> li").fadeTo('fast', 0.4);
$ulSaveAsfile.find("> li > input").prop('disabled', true);
$ulSaveAsfile.find("> li > select").prop('disabled', true);
} else {
$("#ul_save_asfile > li").fadeTo('fast', 1);
$("#ul_save_asfile > li > input").prop('disabled', false);
$("#ul_save_asfile > li> select").prop('disabled', false);
$ulSaveAsfile.find("> li").fadeTo('fast', 1);
$ulSaveAsfile.find("> li > input").prop('disabled', false);
$ulSaveAsfile.find("> li > select").prop('disabled', false);
}
}
@ -434,16 +435,17 @@ AJAX.registerOnload('export.js', function () {
function toggle_sql_include_comments()
{
$("#checkbox_sql_include_comments").change(function () {
var $ulIncludeComments = $("#ul_include_comments");
if (!$("#checkbox_sql_include_comments").prop("checked")) {
$("#ul_include_comments > li").fadeTo('fast', 0.4);
$("#ul_include_comments > li > input").prop('disabled', true);
$ulIncludeComments.find("> li").fadeTo('fast', 0.4);
$ulIncludeComments.find("> li > input").prop('disabled', true);
} else {
// If structure is not being exported, the comment options for structure should not be enabled
if ($("#radio_sql_structure_or_data_data").prop("checked")) {
$("#text_sql_header_comment").removeProp('disabled').parent("li").fadeTo('fast', 1);
} else {
$("#ul_include_comments > li").fadeTo('fast', 1);
$("#ul_include_comments > li > input").removeProp('disabled');
$ulIncludeComments.find("> li").fadeTo('fast', 1);
$ulIncludeComments.find("> li > input").removeProp('disabled');
}
}
});
@ -539,12 +541,25 @@ function toggle_table_select(row) {
}
AJAX.registerOnload('export.js', function () {
/**
* For SQL plugin, if "CREATE TABLE options" is checked/unchecked, check/uncheck each of its sub-options
*/
var $create = $("#checkbox_sql_create_table_statements");
var $create_options = $("#ul_create_table_statements").find("input");
$create.change(function () {
$create_options.prop('checked', $(this).prop("checked"));
});
$create_options.change(function () {
if ($create_options.is(":checked")) {
$create.prop('checked', true);
}
});
/**
* Disables the view output as text option if the output must be saved as a file
*/
$("#plugins").change(function () {
var active_plugin = $("#plugins option:selected").val();
var active_plugin = $("#plugins").find("option:selected").val();
var force_file = $("#force_file_" + active_plugin).val();
if (force_file == "true") {
if ($("#radio_dump_asfile").prop('checked') !== true) {
@ -643,7 +658,7 @@ function toggle_quick_or_custom()
$("#output").show();
$("#format_specific_opts").show();
$("#output_quick_export").hide();
var selected_plugin_name = $("#plugins option:selected").val();
var selected_plugin_name = $("#plugins").find("option:selected").val();
$("#" + selected_plugin_name + "_options").show();
} else { // quick
$("#databases_and_tables").hide();
@ -745,7 +760,7 @@ function createAliasModal(event) {
});
$('#alias_modal').parent().appendTo($('form[name="dump"]'));
};
$('#alias_modal input[type="text"]').prop('disabled', false);
$('#alias_modal').find('input[type="text"]').prop('disabled', false);
$('#alias_modal').dialog({
width: Math.min($(window).width() - 100, 700),
maxHeight: $(window).height(),
@ -778,7 +793,7 @@ AJAX.registerOnload('export.js', function () {
$("input[type='radio'][name='quick_or_custom']").change(toggle_quick_or_custom);
$("#scroll_to_options_msg").hide();
$("#format_specific_opts div.format_specific_options")
$("#format_specific_opts").find("div.format_specific_options")
.hide()
.css({
"border": 0,

View File

@ -371,8 +371,9 @@ function PMA_current_version(data)
if (latest === current) {
version_information_message = ' (' + PMA_messages.strUpToDate + ')';
}
$('#li_pma_version span.latest').remove();
$('#li_pma_version').append(version_information_message);
var $liPmaVersion = $('#li_pma_version');
$liPmaVersion.find('span.latest').remove();
$liPmaVersion.append(version_information_message);
}
}
@ -756,9 +757,10 @@ function checkTableEditForm(theForm, fieldsCnt)
}
// at least this section is under jQuery
if ($("input.textfield[name='table']").val() === "") {
var $input = $("input.textfield[name='table']");
if ($input.val() === "") {
alert(PMA_messages.strFormEmpty);
$("input.textfield[name='table']").focus();
$input.focus();
return false;
}
@ -1038,8 +1040,9 @@ function PMA_handleSimulateQueryButton()
query = $('#sqlquery').val();
}
var $simulateDml = $('#simulate_dml');
if (update_re.test(query) || delete_re.test(query)) {
if (! $('#simulate_dml').length) {
if (! $simulateDml.length) {
$('#button_submit_query')
.before('<input type="button" id="simulate_dml"' +
'tabindex="199" value="' +
@ -1047,8 +1050,8 @@ function PMA_handleSimulateQueryButton()
'" />');
}
} else {
if ($('#simulate_dml').length) {
$('#simulate_dml').remove();
if ($simulateDml.length) {
$simulateDml.remove();
}
}
}
@ -1260,8 +1263,9 @@ function refreshLayout()
var $elm = $('#pdflayout');
var orientation = $('#orientation_opt').val();
var paper = 'A4';
if ($('#paper_opt').length == 1) {
paper = $('#paper_opt').val();
var $paperOpt = $('#paper_opt');
if ($paperOpt.length == 1) {
paper = $paperOpt.val();
}
var posa = 'y';
var posb = 'x';
@ -1833,8 +1837,9 @@ AJAX.registerOnload('functions.js', function () {
});
$(document).on('click', "input#sql_query_edit_discard", function () {
$('div#inline_editor_outer').siblings('code.sql').show();
$('div#inline_editor_outer').remove();
var $divEditor = $('div#inline_editor_outer');
$divEditor.siblings('code.sql').show();
$divEditor.remove();
});
$('input.sqlbutton').click(function (evt) {
@ -1845,9 +1850,10 @@ AJAX.registerOnload('functions.js', function () {
$(document).on('change', '#parameterized', updateQueryParameters);
if ($('#input_username')) {
if ($('#input_username').val() === '') {
$('#input_username').focus();
var $inputUsername = $('#input_username');
if ($inputUsername) {
if ($inputUsername.val() === '') {
$inputUsername.focus();
} else {
$('#input_password').focus();
}
@ -2777,8 +2783,9 @@ AJAX.registerOnload('functions.js', function () {
.html('');
PMA_ajaxShowMessage(data.message);
// Only if the create table dialog (distinct panel) exists
if ($("#create_table_dialog").length > 0) {
$("#create_table_dialog").dialog("close").remove();
var $createTableDialog = $("#create_table_dialog");
if ($createTableDialog.length > 0) {
$createTableDialog.dialog("close").remove();
}
$('#tableslistcontainer').before(data.formatted_sql);
@ -2867,8 +2874,9 @@ AJAX.registerOnload('functions.js', function () {
//User wants to add more fields to the table
$.post($form.attr('action'), $form.serialize() + "&submit_num_fields=1", function (data) {
if (typeof data !== 'undefined' && data.success) {
$("#page_content").html(data.message);
PMA_highlightSQL($('#page_content'));
var $pageContent = $("#page_content");
$pageContent.html(data.message);
PMA_highlightSQL($pageContent);
PMA_verifyColumnsProperties();
PMA_hideShowConnection($('.create_table_form select[name=tbl_storage_engine]'));
PMA_ajaxRemoveMessage($msgbox);
@ -2892,9 +2900,9 @@ AJAX.registerOnload('functions.js', function () {
if (this.checked) {
var col = /\d/.exec($(this).attr('name'));
col = col[0];
var index_val = $('select[name="field_key['+col+']"]').val();
if (index_val === 'none_'+col) {
$('select[name="field_key['+col+']"]').val('primary_'+col).change();
var $selectFieldKey = $('select[name="field_key[' + col + ']"]');
if ($selectFieldKey.val() === 'none_'+col) {
$selectFieldKey.val('primary_'+col).change();
}
}
});
@ -2994,16 +3002,17 @@ AJAX.registerOnload('functions.js', function () {
$the_form.append('<input type="hidden" name="ajax_request" value="true" />');
$.post($the_form.attr('action'), $the_form.serialize() + '&change_pw=' + this_value, function (data) {
if (typeof data !== 'undefined' && data.success === true) {
$("#page_content").prepend(data.message);
PMA_highlightSQL($('#page_content'));
$("#change_password_dialog").hide().remove();
$("#edit_user_dialog").dialog("close").remove();
PMA_ajaxRemoveMessage($msgbox);
}
else {
if (typeof data === 'undefined' || data.success !== true) {
PMA_ajaxShowMessage(data.error, false);
return;
}
var $pageContent = $("#page_content");
$pageContent.prepend(data.message);
PMA_highlightSQL($pageContent);
$("#change_password_dialog").hide().remove();
$("#edit_user_dialog").dialog("close").remove();
PMA_ajaxRemoveMessage($msgbox);
}); // end $.post()
};
@ -3011,37 +3020,38 @@ AJAX.registerOnload('functions.js', function () {
$(this).dialog('close');
};
$.get($(this).attr('href'), {'ajax_request': true}, function (data) {
if (typeof data !== 'undefined' && data.success) {
$('<div id="change_password_dialog"></div>')
if (typeof data === 'undefined' || !data.success) {
PMA_ajaxShowMessage(data.error, false);
return;
}
$('<div id="change_password_dialog"></div>')
.dialog({
title: PMA_messages.strChangePassword,
width: 600,
close: function (ev, ui) {
$(this).remove();
},
buttons : button_options,
buttons: button_options,
modal: true
})
.append(data.message);
// for this dialog, we remove the fieldset wrapping due to double headings
$("fieldset#fieldset_change_password")
// for this dialog, we remove the fieldset wrapping due to double headings
$("fieldset#fieldset_change_password")
.find("legend").remove().end()
.find("table.noclick").unwrap().addClass("some-margin")
.find("input#text_pma_pw").focus();
displayPasswordGenerateButton();
$('#fieldset_change_password_footer').hide();
PMA_ajaxRemoveMessage($msgbox);
$('#change_password_form').bind('submit', function (e) {
e.preventDefault();
$(this)
.closest('.ui-dialog')
.find('.ui-dialog-buttonpane .ui-button')
.first()
.click();
});
} else {
PMA_ajaxShowMessage(data.error, false);
}
displayPasswordGenerateButton();
$('#fieldset_change_password_footer').hide();
PMA_ajaxRemoveMessage($msgbox);
$('#change_password_form').bind('submit', function (e) {
e.preventDefault();
$(this)
.closest('.ui-dialog')
.find('.ui-dialog-buttonpane .ui-button')
.first()
.click();
});
}); // end $.get()
}); // end handler for change password anchor
}); // end $() for Change Password
@ -3133,25 +3143,28 @@ function autoPopulate(input_id, offset)
$('#' + input_id + '1').val(central_column_list[db + '_' + table][offset].col_name);
var col_type = central_column_list[db + '_' + table][offset].col_type.toUpperCase();
$('#' + input_id + '2').val(col_type);
$('#' + input_id + '3').val(central_column_list[db + '_' + table][offset].col_length);
var $input3 = $('#' + input_id + '3');
$input3.val(central_column_list[db + '_' + table][offset].col_length);
if(col_type === 'ENUM' || col_type === 'SET') {
$('#' + input_id + '3').next().show();
$input3.next().show();
} else {
$('#' + input_id + '3').next().hide();
$input3.next().hide();
}
var col_default = central_column_list[db + '_' + table][offset].col_default.toUpperCase();
var $input4 = $('#' + input_id + '4');
if (col_default !== '' && col_default !== 'NULL' && col_default !== 'CURRENT_TIMESTAMP') {
$('#' + input_id + '4').val("USER_DEFINED");
$('#' + input_id + '4').next().next().show();
$('#' + input_id + '4').next().next().val(central_column_list[db + '_' + table][offset].col_default);
$input4.val("USER_DEFINED");
$input4.next().next().show();
$input4.next().next().val(central_column_list[db + '_' + table][offset].col_default);
} else {
$('#' + input_id + '4').val(central_column_list[db + '_' + table][offset].col_default);
$('#' + input_id + '4').next().next().hide();
$input4.val(central_column_list[db + '_' + table][offset].col_default);
$input4.next().next().hide();
}
$('#' + input_id + '5').val(central_column_list[db + '_' + table][offset].col_collation);
$('#' + input_id + '6').val(central_column_list[db + '_' + table][offset].col_attribute);
var $input6 = $('#' + input_id + '6');
$input6.val(central_column_list[db + '_' + table][offset].col_attribute);
if(central_column_list[db + '_' + table][offset].col_extra === 'on update CURRENT_TIMESTAMP') {
$('#' + input_id + '6').val(central_column_list[db + '_' + table][offset].col_extra);
$input6.val(central_column_list[db + '_' + table][offset].col_extra);
}
if(central_column_list[db + '_' + table][offset].col_extra.toUpperCase() === 'AUTO_INCREMENT') {
$('#' + input_id + '9').prop("checked",true).change();
@ -3557,11 +3570,12 @@ AJAX.registerOnload('functions.js', function () {
};
while (rows_to_add--) {
var $newrow = $('#index_columns')
var $indexColumns = $('#index_columns');
var $newrow = $indexColumns
.find('tbody > tr:first')
.clone()
.appendTo(
$('#index_columns').find('tbody')
$indexColumns.find('tbody')
);
$newrow.find(':input').each(tempEmptyVal);
// focus index size input on column picked
@ -3573,8 +3587,9 @@ AJAX.registerOnload('functions.js', function () {
function indexEditorDialog(url, title, callback_success, callback_failure)
{
/*Remove the hidden dialogs if there are*/
if ($('#edit_index_dialog').length !== 0) {
$('#edit_index_dialog').remove();
var $editIndexDialog = $('#edit_index_dialog');
if ($editIndexDialog.length !== 0) {
$editIndexDialog.remove();
}
var $div = $('<div id="edit_index_dialog"></div>');
@ -3592,13 +3607,15 @@ function indexEditorDialog(url, title, callback_success, callback_failure)
PMA_prepareForAjaxRequest($form);
//User wants to submit the form
$.post($form.attr('action'), $form.serialize() + "&do_save_data=1", function (data) {
if ($(".sqlqueryresults").length !== 0) {
$(".sqlqueryresults").remove();
var $sqlqueryresults = $(".sqlqueryresults");
if ($sqlqueryresults.length !== 0) {
$sqlqueryresults.remove();
}
if (typeof data !== 'undefined' && data.success === true) {
PMA_ajaxShowMessage(data.message);
if ($('.result_query').length) {
$('.result_query').remove();
var $resultQuery = $('.result_query');
if ($resultQuery.length) {
$resultQuery.remove();
}
if (data.sql_query) {
$('<div class="result_query"></div>')
@ -3607,15 +3624,16 @@ function indexEditorDialog(url, title, callback_success, callback_failure)
PMA_highlightSQL($('#page_content'));
}
$(".result_query .notice").remove();
$(".result_query").prepend(data.message);
$resultQuery.prepend(data.message);
/*Reload the field form*/
$("#table_index").remove();
$("<div id='temp_div'><div>")
.append(data.index_table)
.find("#table_index")
.insertAfter("#index_header");
if ($("#edit_index_dialog").length > 0) {
$("#edit_index_dialog").dialog("close");
var $editIndexDialog = $("#edit_index_dialog");
if ($editIndexDialog.length > 0) {
$editIndexDialog.dialog("close");
}
$('div.no_indexes_defined').hide();
if (callback_success) {
@ -3676,12 +3694,13 @@ function showIndexEditDialog($outer)
{
checkIndexType();
checkIndexName("index_frm");
$('#index_columns td').each(function () {
var $indexColumns = $('#index_columns');
$indexColumns.find('td').each(function () {
$(this).css("width", $(this).width() + 'px');
});
$('#index_columns tbody').sortable({
$indexColumns.find('tbody').sortable({
axis: 'y',
containment: $("#index_columns tbody"),
containment: $indexColumns.find("tbody"),
tolerance: 'pointer'
});
PMA_showHints($outer);
@ -3974,9 +3993,10 @@ AJAX.registerOnload('functions.js', function () {
}
});
if ($('#update_recent_tables').length) {
var $updateRecentTables = $('#update_recent_tables');
if ($updateRecentTables.length) {
$.get(
$('#update_recent_tables').attr('href'),
$updateRecentTables.attr('href'),
{no_debug: true},
function (data) {
if (typeof data !== 'undefined' && data.success === true) {
@ -4675,13 +4695,15 @@ function PMA_ignorePhpErrors(clearPrevErrors){
// send AJAX request to error_report.php with send_error_report=0, exception_type=php & token.
// It clears the prev_errors stored in session.
if(clearPrevErrors){
$('#pma_report_errors_form input[name="send_error_report"]').val(0); // change send_error_report to '0'
$('#pma_report_errors_form').submit();
var $pmaReportErrorsForm = $('#pma_report_errors_form');
$pmaReportErrorsForm.find('input[name="send_error_report"]').val(0); // change send_error_report to '0'
$pmaReportErrorsForm.submit();
}
// remove displayed errors
$('#pma_errors').fadeOut( "slow");
$('#pma_errors').remove();
var $pmaErrors = $('#pma_errors');
$pmaErrors.fadeOut( "slow");
$pmaErrors.remove();
}
/**

View File

@ -19,11 +19,11 @@ function closeGISEditor() {
}
/**
* Prepares the HTML recieved via AJAX.
* Prepares the HTML received via AJAX.
*/
function prepareJSVersion() {
// Change the text on the submit button
$("#gis_editor input[name='gis_data[save]']")
$("#gis_editor").find("input[name='gis_data[save]']")
.val(PMA_messages.strCopy)
.insertAfter($('#gis_data_textarea'))
.before('<br/><br/>');
@ -37,7 +37,7 @@ function prepareJSVersion() {
$('div#gis_data_output p').remove();
// Remove 'add' buttons and add links
$('#gis_editor input.add').each(function (e) {
$('#gis_editor').find('input.add').each(function (e) {
var $button = $(this);
$button.addClass('addJs').removeClass('add');
var classes = $button.attr('class');

View File

@ -11,10 +11,10 @@
*/
function changePluginOpts()
{
$("#format_specific_opts div.format_specific_options").each(function () {
$("#format_specific_opts").find("div.format_specific_options").each(function () {
$(this).hide();
});
var selected_plugin_name = $("#plugins option:selected").val();
var selected_plugin_name = $("#plugins").find("option:selected").val();
$("#" + selected_plugin_name + "_options").fadeIn('slow');
if (selected_plugin_name == "csv") {
$("#import_notification").text(PMA_messages.strImportCSV);
@ -141,7 +141,7 @@ AJAX.registerOnload('import.js', function () {
* Javascript-disabled browsers
*/
$("#scroll_to_options_msg").hide();
$("#format_specific_opts div.format_specific_options")
$("#format_specific_opts").find("div.format_specific_options")
.css({
"border": 0,
"margin": 0,

View File

@ -25,7 +25,7 @@ function checkIndexType()
/**
* @var Object Table header for the size column.
*/
var $size_header = $('#index_columns thead tr th:nth-child(2)');
var $size_header = $('#index_columns').find('thead tr th:nth-child(2)');
/**
* @var Object Inputs to specify the columns for the index.
*/
@ -37,7 +37,7 @@ function checkIndexType()
/**
* @var Object Footer containg the controllers to add more columns
*/
var $add_more = $('#index_frm .add_more');
var $add_more = $('#index_frm').find('.add_more');
if ($select_index_choice.val() == 'SPATIAL') {
// Disable and hide the size column
@ -169,7 +169,7 @@ function PMA_addColumnToIndex(source_array, array_index, index_choice, col_index
var parser = $('input[name="index[Parser]"]').val();
var index_type = $('select[name="index[Index_type]"]').val();
var columns = [];
$('#index_columns tbody').find('tr').each(function () {
$('#index_columns').find('tbody').find('tr').each(function () {
// Get columns in particular order.
var col_index = $(this).find('select[name="index[columns][names][]"]').val();
var size = $(this).find('input[name="index[columns][sub_parts][]"]').val();
@ -365,12 +365,12 @@ function PMA_showAddIndexDialog(source_array, array_index, target_columns, col_i
checkIndexName("index_frm");
PMA_showHints($div);
PMA_init_slider();
$('#index_columns td').each(function () {
$('#index_columns').find('td').each(function () {
$(this).css("width", $(this).width() + 'px');
});
$('#index_columns tbody').sortable({
$('#index_columns').find('tbody').sortable({
axis: 'y',
containment: $("#index_columns tbody"),
containment: $("#index_columns").find("tbody"),
tolerance: 'pointer'
});
// We dont need the slider at this moment.

View File

@ -119,7 +119,7 @@ function collapseTreeNode($expandElem) {
*/
function traverseNavigationForPaths() {
var params = {
pos: $('#pma_navigation_tree div.dbselector select').val()
pos: $('#pma_navigation_tree').find('div.dbselector select').val()
};
if ($('#navi_db_select').length) {
return params;
@ -201,7 +201,7 @@ $(function () {
// reload icon object
var $icon = $(this).find('img');
// source of the hidden throbber icon
var icon_throbber_src = $('#pma_navigation .throbber').attr('src');
var icon_throbber_src = $('#pma_navigation').find('.throbber').attr('src');
// source of the reload icon
var icon_reload_src = $icon.attr('src');
// replace the source of the reload icon with the one for throbber
@ -227,7 +227,7 @@ $(function () {
*/
$(document).on('click', '#pma_navigation_collapse', function (event) {
event.preventDefault();
$('#pma_navigation_tree a.expander').each(function() {
$('#pma_navigation_tree').find('a.expander').each(function() {
var $icon = $(this).find('img');
if ($icon.is('.ic_b_minus')) {
$(this).click();
@ -579,7 +579,7 @@ function expandTreeNode($expandElem, callback) {
}
$children.promise().done(navTreeStateUpdate);
} else {
var $throbber = $('#pma_navigation .throbber')
var $throbber = $('#pma_navigation').find('.throbber')
.first()
.clone()
.css({visibility: 'visible', display: 'block'})
@ -649,7 +649,7 @@ function PMA_showCurrentNavigation() {
.removeClass('selected');
if (db) {
var $dbItem = findLoadedItem(
$('#pma_navigation_tree > div'), db, 'database', !table
$('#pma_navigation_tree').find('> div'), db, 'database', !table
);
if ($('#navi_db_select').length &&
$('option:selected', $('#navi_db_select')).length
@ -658,7 +658,7 @@ function PMA_showCurrentNavigation() {
return;
}
// If loaded database in navigation is not same as current one
if ( $('#pma_navigation_tree_content span.loaded_db:first').text()
if ($('#pma_navigation_tree_content').find('span.loaded_db:first').text()
!== $('#navi_db_select').val()
) {
loadChildNodes(false, $('option:selected', $('#navi_db_select')), function (data) {
@ -906,16 +906,19 @@ function PMA_reloadNavigation(callback, paths) {
}
function PMA_selectCurrentDb() {
if ($('#navi_db_select').length) {
if (PMA_commonParams.get('db')) { // db selected
$('#navi_db_select').show();
}
$('#navi_db_select').val(PMA_commonParams.get('db'));
if ($('#navi_db_select').val() !== PMA_commonParams.get('db')) {
return false;
}
return true;
var $naviDbSelect = $('#navi_db_select');
if (!$naviDbSelect.length) {
return false;
}
if (PMA_commonParams.get('db')) { // db selected
$naviDbSelect.show();
}
$naviDbSelect.val(PMA_commonParams.get('db'));
return $naviDbSelect.val() === PMA_commonParams.get('db');
}
/**

View File

@ -46,18 +46,18 @@ function goTo3NFStep1(newTables)
"tables": newTables,
"step": '3.1'
}, function(data) {
$("#page_content h3").html(PMA_messages.str3NFNormalization);
$("#mainContent legend").html(data.legendText);
$("#mainContent h4").html(data.headText);
$("#mainContent p").html(data.subText);
$("#mainContent #extra").html(data.extra);
$("#extra form").each(function() {
$("#page_content").find("h3").html(PMA_messages.str3NFNormalization);
$("#mainContent").find("legend").html(data.legendText);
$("#mainContent").find("h4").html(data.headText);
$("#mainContent").find("p").html(data.subText);
$("#mainContent").find("#extra").html(data.extra);
$("#extra").find("form").each(function() {
var form_id = $(this).attr('id');
var colname = $(this).data('colname');
$("#" + form_id + " input[value='" + colname + "']").next().remove();
$("#" + form_id + " input[value='" + colname + "']").remove();
});
$("#mainContent #newCols").html('');
$("#mainContent").find("#newCols").html('');
$('.tblFooters').html('');
if (data.subText !== "") {
$('.tblFooters').html('<input type="button" onClick="processDependencies(\'\', true);" value="' + PMA_messages.strDone + '"/>');

View File

@ -785,7 +785,7 @@ function Edit_pages()
if (! pmd_tables_enabled) {
Create_page_list(db, function (options) {
$("#page_edit_dialog #selected_page").append(options);
$("#selected_page").append(options);
});
}
$('<div id="page_edit_dialog"></div>')
@ -865,7 +865,7 @@ function Delete_pages()
if (! pmd_tables_enabled) {
Create_page_list(db, function (options) {
$("#page_delete_dialog #selected_page").append(options);
$("#selected_page").append(options);
});
}
@ -964,7 +964,7 @@ function Save_as()
if (! pmd_tables_enabled) {
Create_page_list(db, function (options) {
$("#page_save_as_dialog #selected_page").append(options);
$("#selected_page").append(options);
});
}
@ -1631,11 +1631,11 @@ function Side_menu_right(id_this)
}
//------------------------------------------------------------------------------
function Show_text () {
$('#side_menu .hidable').show();
$('#side_menu').find('.hidable').show();
}
function Hide_text () {
if (!always_show_text) {
$('#side_menu .hidable').hide();
$('#side_menu').find('.hidable').hide();
}
}
function Pin_text () {
@ -1914,7 +1914,7 @@ AJAX.registerTeardown('pmd/move.js', function () {
$("#key_HS").unbind('click');
$('.scroll_tab_struct').unbind('click');
$('.scroll_tab_checkbox').unbind('click');
$('#id_scroll_tab tr').off('click', '.pmd_Tabs2,.pmd_Tabs');
$('#id_scroll_tab').find('tr').off('click', '.pmd_Tabs2,.pmd_Tabs');
$('.pmd_tab').off('click', '.select_all_1');
$('.pmd_tab').off('click', '.small_tab,.small_tab2');
$('.pmd_tab').off('click', '.small_tab_pref_1');
@ -2036,7 +2036,7 @@ AJAX.registerOnload('pmd/move.js', function () {
$('.scroll_tab_checkbox').click(function() {
VisibleTab(this,$(this).val());
});
$('#id_scroll_tab tr').on('click', '.pmd_Tabs2,.pmd_Tabs', function() {
$('#id_scroll_tab').find('tr').on('click', '.pmd_Tabs2,.pmd_Tabs', function() {
Select_tab($(this).attr('pmd_url_table_name'));
});
$('.pmd_tab').on('click', '.select_all_1', function() {

View File

@ -103,7 +103,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
}
// Timepicker is loaded on demand so we need to initialize
// datetime fields from the 'load log' dialog
$('#logAnalyseDialog .datetimefield').each(function () {
$('#logAnalyseDialog').find('.datetimefield').each(function () {
PMA_addDatepicker($(this));
});
@ -403,15 +403,15 @@ AJAX.registerOnload('server_status_monitor.js', function () {
calculateChartSize();
// Empty cells should keep their size so you can drop onto them
$('#chartGrid tr td').css('width', chartSize.width + 'px');
$('#chartGrid .monitorChart').css({
$('#chartGrid').find('tr td').css('width', chartSize.width + 'px');
$('#chartGrid').find('.monitorChart').css({
width: chartSize.width + 'px',
height: chartSize.height + 'px'
});
/* Reorder all charts that it fills all column cells */
var numColumns;
var $tr = $('#chartGrid tr:first');
var $tr = $('#chartGrid').find('tr:first');
var row = 0;
var tempManageCols = function () {
@ -488,7 +488,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
var type = $('input[name="chartType"]:checked').val();
if (type == 'preset') {
newChart = presetCharts[$('#addChartDialog select[name="presetCharts"]').prop('value')];
newChart = presetCharts[$('#addChartDialog').find('select[name="presetCharts"]').prop('value')];
} else {
// If user builds his own chart, it's being set/updated
// each time he adds a series
@ -517,7 +517,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
$(this).dialog("close");
};
var $presetList = $('#addChartDialog select[name="presetCharts"]');
var $presetList = $('#addChartDialog').find('select[name="presetCharts"]');
if ($presetList.html().length === 0) {
$.each(presetCharts, function (key, value) {
$presetList.append('<option value="' + key + '">' + value.title + '</option>');
@ -551,7 +551,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
buttons: dlgButtons
});
$('#addChartDialog #seriesPreview').html('<i>' + PMA_messages.strNone + '</i>');
$('#seriesPreview').html('<i>' + PMA_messages.strNone + '</i>');
return false;
});
@ -984,10 +984,10 @@ AJAX.registerOnload('server_status_monitor.js', function () {
/* Calculate how much spacing there is between each chart */
$('#chartGrid').html('<tr><td></td><td></td></tr><tr><td></td><td></td></tr>');
chartSpacing = {
width: $('#chartGrid td:nth-child(2)').offset().left -
$('#chartGrid td:nth-child(1)').offset().left,
height: $('#chartGrid tr:nth-child(2) td:nth-child(2)').offset().top -
$('#chartGrid tr:nth-child(1) td:nth-child(1)').offset().top
width: $('#chartGrid').find('td:nth-child(2)').offset().left -
$('#chartGrid').find('td:nth-child(1)').offset().left,
height: $('#chartGrid').find('tr:nth-child(2) td:nth-child(2)').offset().top -
$('#chartGrid').find('tr:nth-child(1) td:nth-child(1)').offset().top
};
$('#chartGrid').html('');
@ -1002,15 +1002,15 @@ AJAX.registerOnload('server_status_monitor.js', function () {
}
/* Fill in missing cells */
var numCharts = $('#chartGrid .monitorChart').length;
var numCharts = $('#chartGrid').find('.monitorChart').length;
var numMissingCells = (monitorSettings.columns - numCharts % monitorSettings.columns) % monitorSettings.columns;
for (i = 0; i < numMissingCells; i++) {
$('#chartGrid tr:last').append('<td></td>');
$('#chartGrid').find('tr:last').append('<td></td>');
}
// Empty cells should keep their size so you can drop onto them
calculateChartSize();
$('#chartGrid tr td').css('width', chartSize.width + 'px');
$('#chartGrid').find('tr td').css('width', chartSize.width + 'px');
buildRequiredDataList();
refreshChartGrid();
@ -1130,7 +1130,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
settings.series = chartObj.series;
if ($('#' + 'gridchart' + runtime.chartAI).length === 0) {
var numCharts = $('#chartGrid .monitorChart').length;
var numCharts = $('#chartGrid').find('.monitorChart').length;
if (numCharts === 0 || (numCharts % monitorSettings.columns === 0)) {
$('#chartGrid').append('<tr></tr>');
@ -1139,7 +1139,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
if (!chartSize) {
calculateChartSize();
}
$('#chartGrid tr:last').append(
$('#chartGrid').find('tr:last').append(
'<td><div id="gridChartContainer' + runtime.chartAI + '" class="">' +
'<div class="ui-state-default monitorChart"' +
' id="gridchart' + runtime.chartAI + '"' +
@ -1294,14 +1294,15 @@ AJAX.registerOnload('server_status_monitor.js', function () {
});
// Edit, Print icon only in edit mode
$('#chartGrid div svg').find('*[zIndex=20], *[zIndex=21], *[zIndex=19]').toggle(editMode);
$('#chartGrid').find('div svg').find('*[zIndex=20], *[zIndex=21], *[zIndex=19]').toggle(editMode);
runtime.chartAI++;
}
function PMA_getLogAnalyseDialog(min, max) {
var $dateStart = $('#logAnalyseDialog input[name="dateStart"]');
var $dateEnd = $('#logAnalyseDialog input[name="dateEnd"]');
var $logAnalyseDialog = $('#logAnalyseDialog');
var $dateStart = $logAnalyseDialog.find('input[name="dateStart"]');
var $dateEnd = $logAnalyseDialog.find('input[name="dateEnd"]');
$dateStart.prop("readonly", true);
$dateEnd.prop("readonly", true);
@ -1317,7 +1318,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
$(this).dialog("close");
};
$('#logAnalyseDialog').dialog({
$logAnalyseDialog.dialog({
width: 'auto',
height: 'auto',
buttons: dlgBtns
@ -1333,13 +1334,13 @@ AJAX.registerOnload('server_status_monitor.js', function () {
showMicrosec: false,
timeFormat: 'HH:mm:ss'
});
$('#logAnalyseDialog input[name="dateStart"]').datepicker('setDate', min);
$('#logAnalyseDialog input[name="dateEnd"]').datepicker('setDate', max);
$dateStart.datepicker('setDate', min);
$dateEnd.datepicker('setDate', max);
}
function loadLog(type, min, max) {
var dateStart = Date.parse($('#logAnalyseDialog input[name="dateStart"]').datepicker('getDate')) || min;
var dateEnd = Date.parse($('#logAnalyseDialog input[name="dateEnd"]').datepicker('getDate')) || max;
var dateStart = Date.parse($('#logAnalyseDialog').find('input[name="dateStart"]').datepicker('getDate')) || min;
var dateEnd = Date.parse($('#logAnalyseDialog').find('input[name="dateEnd"]').datepicker('getDate')) || max;
loadLogStatistics({
src: type,
@ -1350,7 +1351,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
});
}
/* Called in regular intervalls, this function updates the values of each chart in the grid */
/* Called in regular intervals, this function updates the values of each chart in the grid */
function refreshChartGrid() {
/* Send to server */
runtime.refreshRequest = $.post('server_status_monitor.php' + PMA_commonParams.get('common_query'), {
@ -1610,57 +1611,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
return serverResponseError();
}
if (logData.rows.length !== 0) {
runtime.logDataCols = buildLogTable(logData, opts.removeVariables);
/* Show some stats in the dialog */
$('#emptyDialog').dialog({title: PMA_messages.strLoadingLogs});
$('#emptyDialog').html('<p>' + PMA_messages.strLogDataLoaded + '</p>');
$.each(logData.sum, function (key, value) {
key = key.charAt(0).toUpperCase() + key.slice(1).toLowerCase();
if (key == 'Total') {
key = '<b>' + key + '</b>';
}
$('#emptyDialog').append(key + ': ' + value + '<br/>');
});
/* Add filter options if more than a bunch of rows there to filter */
if (logData.numRows > 12) {
$('#logTable').prepend(
'<fieldset id="logDataFilter">' +
' <legend>' + PMA_messages.strFiltersForLogTable + '</legend>' +
' <div class="formelement">' +
' <label for="filterQueryText">' + PMA_messages.strFilterByWordRegexp + '</label>' +
' <input name="filterQueryText" type="text" id="filterQueryText" style="vertical-align: baseline;" />' +
' </div>' +
((logData.numRows > 250) ? ' <div class="formelement"><button name="startFilterQueryText" id="startFilterQueryText">' + PMA_messages.strFilter + '</button></div>' : '') +
' <div class="formelement">' +
' <input type="checkbox" id="noWHEREData" name="noWHEREData" value="1" /> ' +
' <label for="noWHEREData"> ' + PMA_messages.strIgnoreWhereAndGroup + '</label>' +
' </div' +
'</fieldset>'
);
$('#logTable #noWHEREData').change(function () {
filterQueries(true);
});
if (logData.numRows > 250) {
$('#logTable #startFilterQueryText').click(filterQueries);
} else {
$('#logTable #filterQueryText').keyup(filterQueries);
}
}
dlgBtns[PMA_messages.strJumpToTable] = function () {
$(this).dialog("close");
$(document).scrollTop($('#logTable').offset().top);
};
$('#emptyDialog').dialog("option", "buttons", dlgBtns);
} else {
if (logData.rows.length === 0) {
$('#emptyDialog').dialog({title: PMA_messages.strNoDataFoundTitle});
$('#emptyDialog').html('<p>' + PMA_messages.strNoDataFound + '</p>');
@ -1669,7 +1620,57 @@ AJAX.registerOnload('server_status_monitor.js', function () {
};
$('#emptyDialog').dialog("option", "buttons", dlgBtns);
return;
}
runtime.logDataCols = buildLogTable(logData, opts.removeVariables);
/* Show some stats in the dialog */
$('#emptyDialog').dialog({title: PMA_messages.strLoadingLogs});
$('#emptyDialog').html('<p>' + PMA_messages.strLogDataLoaded + '</p>');
$.each(logData.sum, function (key, value) {
key = key.charAt(0).toUpperCase() + key.slice(1).toLowerCase();
if (key == 'Total') {
key = '<b>' + key + '</b>';
}
$('#emptyDialog').append(key + ': ' + value + '<br/>');
});
/* Add filter options if more than a bunch of rows there to filter */
if (logData.numRows > 12) {
$('#logTable').prepend(
'<fieldset id="logDataFilter">' +
' <legend>' + PMA_messages.strFiltersForLogTable + '</legend>' +
' <div class="formelement">' +
' <label for="filterQueryText">' + PMA_messages.strFilterByWordRegexp + '</label>' +
' <input name="filterQueryText" type="text" id="filterQueryText" style="vertical-align: baseline;" />' +
' </div>' +
((logData.numRows > 250) ? ' <div class="formelement"><button name="startFilterQueryText" id="startFilterQueryText">' + PMA_messages.strFilter + '</button></div>' : '') +
' <div class="formelement">' +
' <input type="checkbox" id="noWHEREData" name="noWHEREData" value="1" /> ' +
' <label for="noWHEREData"> ' + PMA_messages.strIgnoreWhereAndGroup + '</label>' +
' </div' +
'</fieldset>'
);
$('#noWHEREData').change(function () {
filterQueries(true);
});
if (logData.numRows > 250) {
$('#startFilterQueryText').click(filterQueries);
} else {
$('#filterQueryText').keyup(filterQueries);
}
}
dlgBtns[PMA_messages.strJumpToTable] = function () {
$(this).dialog("close");
$(document).scrollTop($('#logTable').offset().top);
};
$('#emptyDialog').dialog("option", "buttons", dlgBtns);
}
);
@ -1682,7 +1683,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
*/
function filterQueries(varFilterChange) {
var odd_row = false, cell, textFilter;
var val = $('#logTable #filterQueryText').val();
var val = $('#filterQueryText').val();
if (val.length === 0) {
textFilter = null;
@ -1691,7 +1692,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
}
var rowSum = 0, totalSum = 0, i = 0, q;
var noVars = $('#logTable #noWHEREData').prop('checked');
var noVars = $('#noWHEREData').prop('checked');
var equalsFilter = /([^=]+)=(\d+|((\'|"|).*?[^\\])\4((\s+)|$))/gi;
var functionFilter = /([a-z0-9_]+)\(.+?\)/gi;
var filteredQueries = {}, filteredQueriesLines = {};
@ -1717,7 +1718,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
};
// We just assume the sql text is always in the second last column, and that the total count is right of it
$('#logTable table tbody tr td:nth-child(' + (runtime.logDataCols.length - 1) + ')').each(function () {
$('#logTable').find('table tbody tr td:nth-child(' + (runtime.logDataCols.length - 1) + ')').each(function () {
var $t = $(this);
// If query is a SELECT and user enabled or disabled to group
// queries ignoring data in where statements, we
@ -1793,7 +1794,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
// We finished summarizing counts => Update count values of all grouped entries
if (varFilterChange) {
if (noVars) {
var numCol, row, $table = $('#logTable table tbody');
var numCol, row, $table = $('#logTable').find('table tbody');
$.each(filteredQueriesLines, function (key, value) {
if (filteredQueries[key] <= 1) {
return;
@ -1812,14 +1813,14 @@ AJAX.registerOnload('server_status_monitor.js', function () {
});
}
$('#logTable table').trigger("update");
$('#logTable').find('table').trigger("update");
setTimeout(function () {
$('#logTable table').trigger('sorton', [[[runtime.logDataCols.length - 1, 1]]]);
$('#logTable').find('table').trigger('sorton', [[[runtime.logDataCols.length - 1, 1]]]);
}, 0);
}
// Display some stats at the bottom of the table
$('#logTable table tfoot tr')
$('#logTable').find('table tfoot tr')
.html('<th colspan="' + (runtime.logDataCols.length - 1) + '">' +
PMA_messages.strSumRows + ' ' + rowSum + '<span class="floatright">' +
PMA_messages.strTotal + '</span></th><th class="right">' + totalSum + '</th>');
@ -1904,8 +1905,8 @@ AJAX.registerOnload('server_status_monitor.js', function () {
'</span></th><th class="right">' + data.sum.TOTAL + '</th></tr></tfoot>');
// Append a tooltip to the count column, if there exist one
if ($('#logTable tr:first th:last').text().indexOf("#") > -1) {
$('#logTable tr:first th:last').append('&nbsp;' + PMA_getImage('b_help.png', '', {'class': 'qroupedQueryInfoIcon'}));
if ($('#logTable').find('tr:first th:last').text().indexOf("#") > -1) {
$('#logTable').find('tr:first th:last').append('&nbsp;' + PMA_getImage('b_help.png', '', {'class': 'qroupedQueryInfoIcon'}));
var tooltipContent = PMA_messages.strCountColumnExplanation;
if (groupInserts) {
@ -1919,12 +1920,12 @@ AJAX.registerOnload('server_status_monitor.js', function () {
);
}
$('#logTable table').tablesorter({
$('#logTable').find('table').tablesorter({
sortList: [[cols.length - 1, 1]],
widgets: ['fast-zebra']
});
$('#logTable table thead th')
$('#logTable').find('table thead th')
.append('<div class="sorticon"></div>');
return cols;
@ -1968,7 +1969,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
if (profilingChart !== null) {
profilingChart.destroy();
}
$('#queryAnalyzerDialog div.placeHolder').html('');
$('#queryAnalyzerDialog').find('div.placeHolder').html('');
if (codemirror_editor) {
codemirror_editor.setValue('');
} else {
@ -1982,7 +1983,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
function loadQueryAnalysis(rowData) {
var db = rowData.db || '';
$('#queryAnalyzerDialog div.placeHolder').html(
$('#queryAnalyzerDialog').find('div.placeHolder').html(
PMA_messages.strAnalyzing + ' <img class="ajaxIcon" src="' +
pmaThemeImage + 'ajax_clock_small.gif" alt="">');
@ -2000,12 +2001,12 @@ AJAX.registerOnload('server_status_monitor.js', function () {
if (data.error.indexOf('1146') != -1 || data.error.indexOf('1046') != -1) {
data.error = PMA_messages.strServerLogError;
}
$('#queryAnalyzerDialog div.placeHolder').html('<div class="error">' + data.error + '</div>');
$('#queryAnalyzerDialog').find('div.placeHolder').html('<div class="error">' + data.error + '</div>');
return;
}
var totalTime = 0;
// Float sux, I'll use table :(
$('#queryAnalyzerDialog div.placeHolder')
$('#queryAnalyzerDialog').find('div.placeHolder')
.html('<table width="100%" border="0"><tr><td class="explain"></td><td class="chart"></td></tr></table>');
var explain = '<b>' + PMA_messages.strExplainOutput + '</b> ' + $('#explain_docu').html();
@ -2041,9 +2042,9 @@ AJAX.registerOnload('server_status_monitor.js', function () {
explain += '<p><b>' + PMA_messages.strAffectedRows + '</b> ' + data.affectedRows;
$('#queryAnalyzerDialog div.placeHolder td.explain').append(explain);
$('#queryAnalyzerDialog').find('div.placeHolder td.explain').append(explain);
$('#queryAnalyzerDialog div.placeHolder a[href*="#showExplain"]').click(function () {
$('#queryAnalyzerDialog').find('div.placeHolder a[href*="#showExplain"]').click(function () {
var id = $(this).attr('href').split('-')[1];
$(this).parent().find('div[class*="explain"]').hide();
$(this).parent().find('div[class*="explain-' + id + '"]').show();
@ -2081,26 +2082,26 @@ AJAX.registerOnload('server_status_monitor.js', function () {
numberTable += '<tr><td><b>' + PMA_messages.strTotalTime + '</b></td><td>' + PMA_prettyProfilingNum(totalTime, 2) + '</td></tr>';
numberTable += '</tbody></table>';
$('#queryAnalyzerDialog div.placeHolder td.chart').append(
$('#queryAnalyzerDialog').find('div.placeHolder td.chart').append(
'<b>' + PMA_messages.strProfilingResults + ' ' + $('#profiling_docu').html() + '</b> ' +
'(<a href="#showNums">' + PMA_messages.strTable + '</a>, <a href="#showChart">' + PMA_messages.strChart + '</a>)<br/>' +
numberTable + ' <div id="queryProfiling"></div>');
$('#queryAnalyzerDialog div.placeHolder a[href="#showNums"]').click(function () {
$('#queryAnalyzerDialog #queryProfiling').hide();
$('#queryAnalyzerDialog table.queryNums').show();
$('#queryAnalyzerDialog').find('div.placeHolder a[href="#showNums"]').click(function () {
$('#queryAnalyzerDialog').find('#queryProfiling').hide();
$('#queryAnalyzerDialog').find('table.queryNums').show();
return false;
});
$('#queryAnalyzerDialog div.placeHolder a[href="#showChart"]').click(function () {
$('#queryAnalyzerDialog #queryProfiling').show();
$('#queryAnalyzerDialog table.queryNums').hide();
$('#queryAnalyzerDialog').find('div.placeHolder a[href="#showChart"]').click(function () {
$('#queryAnalyzerDialog').find('#queryProfiling').show();
$('#queryAnalyzerDialog').find('table.queryNums').hide();
return false;
});
profilingChart = PMA_createProfilingChartJqplot(
'queryProfiling',
chartData
'queryProfiling',
chartData
);
//$('#queryProfiling').resizable();

View File

@ -57,10 +57,9 @@ var processList = {
$tr.remove();
// As we just removed a row, reapply odd-even classes
// to keep table stripes consistent
$('#tableprocesslist > tbody > tr').filter(':even')
.removeClass('odd').addClass('even');
$('#tableprocesslist > tbody > tr').filter(':odd')
.removeClass('even').addClass('odd');
var $tableProcessListTr = $('#tableprocesslist').find('> tbody > tr');
$tableProcessListTr.filter(':even').removeClass('odd').addClass('even');
$tableProcessListTr.filter(':odd').removeClass('even').addClass('odd');
// Show process killed message
PMA_ajaxShowMessage(data.message, false);
} else {

View File

@ -38,8 +38,8 @@ AJAX.registerOnload('server_status_variables.js', function () {
$('#dontFormat').change(function () {
// Hiding the table while changing values speeds up the process a lot
$('#serverstatusvariables').hide();
$('#serverstatusvariables td.value span.original').toggle(this.checked);
$('#serverstatusvariables td.value span.formatted').toggle(! this.checked);
$('#serverstatusvariables').find('td.value span.original').toggle(this.checked);
$('#serverstatusvariables').find('td.value span.formatted').toggle(! this.checked);
$('#serverstatusvariables').show();
}).trigger('change');
@ -64,7 +64,7 @@ AJAX.registerOnload('server_status_variables.js', function () {
}
if (section.length > 1) {
$('#linkSuggestions span').each(function () {
$('#linkSuggestions').find('span').each(function () {
if ($(this).attr('class').indexOf('status_' + section) != -1) {
useful_links++;
$(this).css('display', '');
@ -81,7 +81,7 @@ AJAX.registerOnload('server_status_variables.js', function () {
}
odd_row = false;
$('#serverstatusvariables th.name').each(function () {
$('#serverstatusvariables').find('th.name').each(function () {
if ((textFilter === null || textFilter.exec($(this).text())) &&
(! alertFilter || $(this).next().find('span.attention').length > 0) &&
(categoryFilter.length === 0 || $(this).parent().hasClass('s_' + categoryFilter))

View File

@ -43,7 +43,7 @@ AJAX.registerOnload('server_variables.js', function () {
/* Filters the rows by the user given regexp */
function filterVariables(textFilter) {
var mark_next = false, $row, odd_row = false;
$('#serverVariables .var-row').not('.var-header').each(function () {
$('#serverVariables').find('.var-row').not('.var-header').each(function () {
$row = $(this);
if (mark_next || textFilter === null ||
textFilter.exec($row.find('.var-name').text())

View File

@ -107,7 +107,7 @@ function loadSVG() {
*/
function addZoomPanControllers() {
var $placeholder = $('#placeholder');
if ($("#placeholder svg").length > 0) {
if ($("#placeholder").find("svg").length > 0) {
var pmaThemeImage = $('#pmaThemeImage').val();
// add panning arrows
$('<img class="button" id="left_arrow" src="' + pmaThemeImage + 'west-mini.png">').appendTo($placeholder);
@ -275,8 +275,9 @@ AJAX.registerOnload('tbl_gis_visualization.js', function () {
//zoom in
scale *= zoomFactor;
width = $('#placeholder svg').attr('width');
height = $('#placeholder svg').attr('height');
var $placeholder = $('#placeholder').find('svg');
width = $placeholder.attr('width');
height = $placeholder.attr('height');
// zooming in keeping the center unmoved.
x = width / 2 - (width / 2 - x) * zoomFactor;
y = height / 2 - (height / 2 - y) * zoomFactor;
@ -296,8 +297,9 @@ AJAX.registerOnload('tbl_gis_visualization.js', function () {
//zoom out
scale /= zoomFactor;
width = $('#placeholder svg').attr('width');
height = $('#placeholder svg').attr('height');
var $placeholder = $('#placeholder').find('svg');
width = $placeholder.attr('width');
height = $placeholder.attr('height');
// zooming out keeping the center unmoved.
x = width / 2 - (width / 2 - x) / zoomFactor;
y = height / 2 - (height / 2 - y) / zoomFactor;

View File

@ -58,11 +58,11 @@ function reloadFieldForm() {
var $temp_div = $("<div id='temp_div'><div>").append(form_data.message);
$("#fieldsForm").replaceWith($temp_div.find("#fieldsForm"));
$("#addColumns").replaceWith($temp_div.find("#addColumns"));
$('#move_columns_dialog ul').replaceWith($temp_div.find("#move_columns_dialog ul"));
$('#move_columns_dialog').find('ul').replaceWith($temp_div.find("#move_columns_dialog ul"));
$("#moveColumns").removeClass("move-active");
/* reinitialise the more options in table */
if ($('#fieldsForm').hasClass('HideStructureActions')) {
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
$('#fieldsForm').find('ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
}
});
$('#page_content').show();
@ -336,7 +336,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
}); // end dialog options
} else {
if ($('#fieldsForm').hasClass('HideStructureActions')) {
$('#fieldsForm ul.table-structure-actions').menuResizer('destroy');
$('#fieldsForm').find('ul.table-structure-actions').menuResizer('destroy');
}
// sort the fields table
var $fields_table = $("table#tablestructure tbody");
@ -364,7 +364,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
PMA_ajaxShowMessage(data.message);
$this.dialog('close');
if ($('#fieldsForm').hasClass('HideStructureActions')) {
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
$('#fieldsForm').find('ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
}
}
});
@ -380,7 +380,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
var columns = [];
$("#tablestructure tbody tr").each(function () {
$("#tablestructure").find("tbody tr").each(function () {
var col_name = $(this).find("input:checkbox").eq(0).val();
var hidden_input = $("<input/>")
.prop({
@ -394,17 +394,17 @@ AJAX.registerOnload('tbl_structure.js', function () {
.append(hidden_input);
});
var col_list = $("#move_columns_dialog ul")
var col_list = $("#move_columns_dialog").find("ul")
.find("li").remove().end();
for (var i in columns) {
col_list.append(columns[i]);
}
col_list.sortable({
axis: 'y',
containment: $("#move_columns_dialog div"),
containment: $("#move_columns_dialog").find("div"),
tolerance: 'pointer'
}).disableSelection();
var $form = $("#move_columns_dialog form");
var $form = $("#move_columns_dialog").find("form");
$form.data("serialized-unmoved", $form.serialize());
$("#move_columns_dialog").dialog({
@ -467,7 +467,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
/** Handler for "More" dropdown in structure table rows */
AJAX.registerOnload('tbl_structure.js', function () {
if ($('#fieldsForm').hasClass('HideStructureActions')) {
$('#fieldsForm ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
$('#fieldsForm').find('ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
} else {
$('.table-structure-actions').width(function () {
var width = 5;
@ -480,13 +480,13 @@ AJAX.registerOnload('tbl_structure.js', function () {
});
AJAX.registerTeardown('tbl_structure.js', function () {
if ($('#fieldsForm').hasClass('HideStructureActions')) {
$('#fieldsForm ul.table-structure-actions').menuResizer('destroy');
$('#fieldsForm').find('ul.table-structure-actions').menuResizer('destroy');
}
});
$(function () {
$(window).resize($.throttle(function () {
if ($('#fieldsForm').length && $('#fieldsForm').hasClass('HideStructureActions')) {
$('#fieldsForm ul.table-structure-actions').menuResizer('resize');
$('#fieldsForm').find('ul.table-structure-actions').menuResizer('resize');
}
}));
});

View File

@ -174,10 +174,10 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
'it' : 0,
'token' : PMA_commonParams.get('token')
}, function (data) {
$('#tableFieldsId tr:eq(1) td:eq(0)').html(data.field_type);
$('#tableFieldsId tr:eq(1) td:eq(1)').html(data.field_collation);
$('#tableFieldsId tr:eq(1) td:eq(2)').html(data.field_operators);
$('#tableFieldsId tr:eq(1) td:eq(3)').html(data.field_value);
$('#tableFieldsId').find('tr:eq(1) td:eq(0)').html(data.field_type);
$('#tableFieldsId').find('tr:eq(1) td:eq(1)').html(data.field_collation);
$('#tableFieldsId').find('tr:eq(1) td:eq(2)').html(data.field_operators);
$('#tableFieldsId').find('tr:eq(1) td:eq(3)').html(data.field_value);
xLabel = $('#tableid_0').val();
$('#types_0').val(data.field_type);
xType = data.field_type;
@ -199,10 +199,10 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
'it' : 1,
'token' : PMA_commonParams.get('token')
}, function (data) {
$('#tableFieldsId tr:eq(3) td:eq(0)').html(data.field_type);
$('#tableFieldsId tr:eq(3) td:eq(1)').html(data.field_collation);
$('#tableFieldsId tr:eq(3) td:eq(2)').html(data.field_operators);
$('#tableFieldsId tr:eq(3) td:eq(3)').html(data.field_value);
$('#tableFieldsId').find('tr:eq(3) td:eq(0)').html(data.field_type);
$('#tableFieldsId').find('tr:eq(3) td:eq(1)').html(data.field_collation);
$('#tableFieldsId').find('tr:eq(3) td:eq(2)').html(data.field_operators);
$('#tableFieldsId').find('tr:eq(3) td:eq(3)').html(data.field_value);
yLabel = $('#tableid_1').val();
$('#types_1').val(data.field_type);
yType = data.field_type;
@ -223,10 +223,10 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
'it' : 2,
'token' : PMA_commonParams.get('token')
}, function (data) {
$('#tableFieldsId tr:eq(6) td:eq(0)').html(data.field_type);
$('#tableFieldsId tr:eq(6) td:eq(1)').html(data.field_collation);
$('#tableFieldsId tr:eq(6) td:eq(2)').html(data.field_operators);
$('#tableFieldsId tr:eq(6) td:eq(3)').html(data.field_value);
$('#tableFieldsId').find('tr:eq(6) td:eq(0)').html(data.field_type);
$('#tableFieldsId').find('tr:eq(6) td:eq(1)').html(data.field_collation);
$('#tableFieldsId').find('tr:eq(6) td:eq(2)').html(data.field_operators);
$('#tableFieldsId').find('tr:eq(6) td:eq(3)').html(data.field_value);
$('#types_2').val(data.field_type);
$('#collations_2').val(data.field_collations);
addDateTimePicker();
@ -245,10 +245,10 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
'it' : 3,
'token' : PMA_commonParams.get('token')
}, function (data) {
$('#tableFieldsId tr:eq(8) td:eq(0)').html(data.field_type);
$('#tableFieldsId tr:eq(8) td:eq(1)').html(data.field_collation);
$('#tableFieldsId tr:eq(8) td:eq(2)').html(data.field_operators);
$('#tableFieldsId tr:eq(8) td:eq(3)').html(data.field_value);
$('#tableFieldsId').find('tr:eq(8) td:eq(0)').html(data.field_type);
$('#tableFieldsId').find('tr:eq(8) td:eq(1)').html(data.field_collation);
$('#tableFieldsId').find('tr:eq(8) td:eq(2)').html(data.field_operators);
$('#tableFieldsId').find('tr:eq(8) td:eq(3)').html(data.field_value);
$('#types_3').val(data.field_type);
$('#collations_3').val(data.field_collations);
addDateTimePicker();