Initial commit
This commit is contained in:
245
pma/js/dist/database/central_columns.js
vendored
Normal file
245
pma/js/dist/database/central_columns.js
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @fileoverview events handling from central columns page
|
||||
* @name Central columns
|
||||
*
|
||||
* @requires jQuery
|
||||
*/
|
||||
|
||||
/**
|
||||
* AJAX scripts for /database/central-columns
|
||||
*
|
||||
* Actions ajaxified here:
|
||||
* Inline Edit and save of a result row
|
||||
* Delete a row
|
||||
* Multiple edit and delete option
|
||||
*
|
||||
*/
|
||||
AJAX.registerTeardown('database/central_columns.js', function () {
|
||||
$('.edit').off('click');
|
||||
$('.edit_save_form').off('click');
|
||||
$('.edit_cancel_form').off('click');
|
||||
$('.del_row').off('click');
|
||||
$(document).off('keyup', '.filter_rows');
|
||||
$('.edit_cancel_form').off('click');
|
||||
$('#table-select').off('change');
|
||||
$('#column-select').off('change');
|
||||
$('#add_col_div').find('>a').off('click');
|
||||
$('#add_new').off('submit');
|
||||
$('#multi_edit_central_columns').off('submit');
|
||||
$('select.default_type').off('change');
|
||||
$('button[name=\'delete_central_columns\']').off('click');
|
||||
$('button[name=\'edit_central_columns\']').off('click');
|
||||
});
|
||||
AJAX.registerOnload('database/central_columns.js', function () {
|
||||
$('#tableslistcontainer input,#tableslistcontainer select,#tableslistcontainer .default_value,#tableslistcontainer .open_enum_editor').hide();
|
||||
$('#tableslistcontainer').find('.checkall').show();
|
||||
$('#tableslistcontainer').find('.checkall_box').show();
|
||||
|
||||
if ($('#table_columns').find('tbody tr').length > 0) {
|
||||
$('#table_columns').tablesorter({
|
||||
headers: {
|
||||
0: {
|
||||
sorter: false
|
||||
},
|
||||
1: {
|
||||
sorter: false
|
||||
},
|
||||
// hidden column
|
||||
4: {
|
||||
sorter: 'integer'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#tableslistcontainer').find('button[name="delete_central_columns"]').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var multiDeleteColumns = $('.checkall:checkbox:checked').serialize();
|
||||
|
||||
if (multiDeleteColumns === '') {
|
||||
Functions.ajaxShowMessage(Messages.strRadioUnchecked);
|
||||
return false;
|
||||
}
|
||||
|
||||
Functions.ajaxShowMessage();
|
||||
$('#del_col_name').val(multiDeleteColumns);
|
||||
$('#del_form').trigger('submit');
|
||||
});
|
||||
$('#tableslistcontainer').find('button[name="edit_central_columns"]').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var editColumnList = $('.checkall:checkbox:checked').serialize();
|
||||
|
||||
if (editColumnList === '') {
|
||||
Functions.ajaxShowMessage(Messages.strRadioUnchecked);
|
||||
return false;
|
||||
}
|
||||
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var editColumnData = editColumnList + '' + argsep + 'edit_central_columns_page=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db'));
|
||||
Functions.ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.post('index.php?route=/database/central-columns', editColumnData, AJAX.responseHandler);
|
||||
});
|
||||
$('#multi_edit_central_columns').on('submit', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var multiColumnEditData = $('#multi_edit_central_columns').serialize() + argsep + 'multi_edit_central_column_save=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db'));
|
||||
Functions.ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.post('index.php?route=/database/central-columns', multiColumnEditData, AJAX.responseHandler);
|
||||
});
|
||||
$('#add_new').find('td').each(function () {
|
||||
if ($(this).attr('name') !== 'undefined') {
|
||||
$(this).find('input,select').first().attr('name', $(this).attr('name'));
|
||||
}
|
||||
});
|
||||
$('#field_0_0').attr('required', 'required');
|
||||
$('#add_new input[type="text"], #add_new input[type="number"], #add_new select').css({
|
||||
'width': '10em',
|
||||
'-moz-box-sizing': 'border-box'
|
||||
});
|
||||
window.scrollTo(0, 0);
|
||||
$(document).on('keyup', '.filter_rows', function () {
|
||||
// get the column names
|
||||
var cols = $('th.column_heading').map(function () {
|
||||
return $(this).text().trim();
|
||||
}).get();
|
||||
$.uiTableFilter($('#table_columns'), $(this).val(), cols, null, 'td span');
|
||||
});
|
||||
$('.edit').on('click', function () {
|
||||
var rownum = $(this).parent().data('rownum');
|
||||
$('#save_' + rownum).show();
|
||||
$(this).hide();
|
||||
$('#f_' + rownum + ' td span').hide();
|
||||
$('#f_' + rownum + ' input, #f_' + rownum + ' select, #f_' + rownum + ' .open_enum_editor').show();
|
||||
var attributeVal = $('#f_' + rownum + ' td[name=col_attribute] span').html();
|
||||
$('#f_' + rownum + ' select[name=field_attribute\\[' + rownum + '\\] ] option[value="' + attributeVal + '"]').attr('selected', 'selected');
|
||||
|
||||
if ($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') {
|
||||
$('#f_' + rownum + ' .default_type').siblings('.default_value').show();
|
||||
} else {
|
||||
$('#f_' + rownum + ' .default_type').siblings('.default_value').hide();
|
||||
}
|
||||
});
|
||||
$('.del_row').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var $td = $(this);
|
||||
var question = Messages.strDeleteCentralColumnWarning;
|
||||
$td.confirm(question, null, function () {
|
||||
var rownum = $td.data('rownum');
|
||||
$('#del_col_name').val('selected_fld%5B%5D=' + $('#checkbox_row_' + rownum).val());
|
||||
$('#del_form').trigger('submit');
|
||||
});
|
||||
});
|
||||
$('.edit_cancel_form').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var rownum = $(this).data('rownum');
|
||||
$('#save_' + rownum).hide();
|
||||
$('#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').find('.checkall').show();
|
||||
});
|
||||
$('.edit_save_form').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var rownum = $(this).data('rownum');
|
||||
$('#f_' + rownum + ' td').each(function () {
|
||||
if ($(this).attr('name') !== 'undefined') {
|
||||
$(this).find(':input[type!="hidden"],select').first().attr('name', $(this).attr('name'));
|
||||
}
|
||||
});
|
||||
|
||||
if ($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') {
|
||||
$('#f_' + rownum + ' .default_type').attr('name', 'col_default_sel');
|
||||
} else {
|
||||
$('#f_' + rownum + ' .default_value').attr('name', 'col_default_val');
|
||||
}
|
||||
|
||||
var datastring = $('#f_' + rownum + ' :input').serialize();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'index.php?route=/database/central-columns',
|
||||
data: datastring + CommonParams.get('arg_separator') + 'ajax_request=true',
|
||||
dataType: 'json',
|
||||
success: function success(data) {
|
||||
if (data.message !== '1') {
|
||||
Functions.ajaxShowMessage('<div class="alert alert-danger" role="alert">' + data.message + '</div>', false);
|
||||
} else {
|
||||
$('#f_' + rownum + ' td input[id=checkbox_row_' + rownum + ']').val($('#f_' + rownum + ' input[name=col_name]').val()).html();
|
||||
$('#f_' + rownum + ' td[name=col_name] span').text($('#f_' + rownum + ' input[name=col_name]').val()).html();
|
||||
$('#f_' + rownum + ' td[name=col_type] span').text($('#f_' + rownum + ' select[name=col_type]').val()).html();
|
||||
$('#f_' + rownum + ' td[name=col_length] span').text($('#f_' + rownum + ' input[name=col_length]').val()).html();
|
||||
$('#f_' + rownum + ' td[name=collation] span').text($('#f_' + rownum + ' select[name=collation]').val()).html();
|
||||
$('#f_' + rownum + ' td[name=col_attribute] span').text($('#f_' + rownum + ' select[name=col_attribute]').val()).html();
|
||||
$('#f_' + rownum + ' td[name=col_isNull] span').text($('#f_' + rownum + ' input[name=col_isNull]').is(':checked') ? 'Yes' : 'No').html();
|
||||
$('#f_' + rownum + ' td[name=col_extra] span').text($('#f_' + rownum + ' input[name=col_extra]').is(':checked') ? 'auto_increment' : '').html();
|
||||
$('#f_' + rownum + ' td[name=col_default] span').text($('#f_' + rownum + ' :input[name=col_default]').val()).html();
|
||||
}
|
||||
|
||||
$('#save_' + rownum).hide();
|
||||
$('#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').find('.checkall').show();
|
||||
},
|
||||
error: function error() {
|
||||
Functions.ajaxShowMessage('<div class="alert alert-danger" role="alert">' + Messages.strErrorProcessingRequest + '</div>', false);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#table-select').on('change', function () {
|
||||
var selectValue = $(this).val();
|
||||
var defaultColumnSelect = $('#column-select').find('option').first();
|
||||
var href = 'index.php?route=/database/central-columns/populate';
|
||||
var params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': CommonParams.get('db'),
|
||||
'selectedTable': selectValue
|
||||
};
|
||||
$('#column-select').html('<option value="">' + Messages.strLoading + '</option>');
|
||||
|
||||
if (selectValue !== '') {
|
||||
$.post(href, params, function (data) {
|
||||
$('#column-select').empty().append(defaultColumnSelect);
|
||||
$('#column-select').append(data.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
$('#add_column').on('submit', function (e) {
|
||||
var selectvalue = $('#column-select').val();
|
||||
|
||||
if (selectvalue === '') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
$('#add_col_div').find('>a').on('click', function () {
|
||||
$('#add_new').slideToggle('slow');
|
||||
var $addColDivLinkSpan = $('#add_col_div').find('>a span');
|
||||
|
||||
if ($addColDivLinkSpan.html() === '+') {
|
||||
$addColDivLinkSpan.html('-');
|
||||
} else {
|
||||
$addColDivLinkSpan.html('+');
|
||||
}
|
||||
});
|
||||
$('#add_new').on('submit', function () {
|
||||
$('#add_new').toggle();
|
||||
});
|
||||
$('#tableslistcontainer').find('select.default_type').on('change', function () {
|
||||
if ($(this).val() === 'USER_DEFINED') {
|
||||
$(this).siblings('.default_value').attr('name', 'col_default');
|
||||
$(this).attr('name', 'col_default_sel');
|
||||
} else {
|
||||
$(this).attr('name', 'col_default');
|
||||
$(this).siblings('.default_value').attr('name', 'col_default_val');
|
||||
}
|
||||
});
|
||||
});
|
230
pma/js/dist/database/multi_table_query.js
vendored
Normal file
230
pma/js/dist/database/multi_table_query.js
vendored
Normal file
@ -0,0 +1,230 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @fileoverview function used in QBE for DB
|
||||
* @name Database Operations
|
||||
*
|
||||
* @requires jQuery
|
||||
* @requires jQueryUI
|
||||
* @requires js/functions.js
|
||||
* @requires js/database/query_generator.js
|
||||
*
|
||||
*/
|
||||
|
||||
/* global generateFromBlock, generateWhereBlock */
|
||||
// js/database/query_generator.js
|
||||
|
||||
/* global md5 */
|
||||
// js/vendor/jquery/jquery.md5.js
|
||||
|
||||
/**
|
||||
* js file for handling AJAX and other events in /database/multi-table-query
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('database/multi_table_query.js', function () {
|
||||
$('.tableNameSelect').each(function () {
|
||||
$(this).off('change');
|
||||
});
|
||||
$('#update_query_button').off('click');
|
||||
$('#add_column_button').off('click');
|
||||
});
|
||||
AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
var editor = Functions.getSqlEditor($('#MultiSqlquery'), {}, 'both');
|
||||
$('.CodeMirror-line').css('text-align', 'left');
|
||||
editor.setSize(-1, 50);
|
||||
var columnCount = 3;
|
||||
Functions.initSlider();
|
||||
addNewColumnCallbacks();
|
||||
$('#update_query_button').on('click', function () {
|
||||
var columns = [];
|
||||
var tableAliases = {};
|
||||
$('.tableNameSelect').each(function () {
|
||||
var $show = $(this).siblings('.show_col').first();
|
||||
|
||||
if ($(this).val() !== '' && $show.prop('checked')) {
|
||||
var tableAlias = $(this).siblings('.table_alias').first().val();
|
||||
var columnAlias = $(this).siblings('.col_alias').first().val();
|
||||
|
||||
if (tableAlias !== '') {
|
||||
columns.push([tableAlias, $(this).siblings('.columnNameSelect').first().val()]);
|
||||
} else {
|
||||
columns.push([$(this).val(), $(this).siblings('.columnNameSelect').first().val()]);
|
||||
}
|
||||
|
||||
columns[columns.length - 1].push(columnAlias);
|
||||
|
||||
if ($(this).val() in tableAliases) {
|
||||
if (!tableAliases[$(this).val()].includes(tableAlias)) {
|
||||
tableAliases[$(this).val()].push(tableAlias);
|
||||
}
|
||||
} else {
|
||||
tableAliases[$(this).val()] = [tableAlias];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (Object.keys(tableAliases).length === 0) {
|
||||
Functions.ajaxShowMessage('Nothing selected', false, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
var foreignKeys;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
async: false,
|
||||
url: 'index.php?route=/database/multi-table-query/tables',
|
||||
data: {
|
||||
'server': sessionStorage.server,
|
||||
'db': $('#db_name').val(),
|
||||
'tables': Object.keys(tableAliases),
|
||||
'ajax_request': '1',
|
||||
'token': CommonParams.get('token')
|
||||
},
|
||||
success: function success(response) {
|
||||
foreignKeys = response.foreignKeyConstrains;
|
||||
}
|
||||
});
|
||||
var query = 'SELECT ' + '`' + Functions.escapeBacktick(columns[0][0]) + '`.';
|
||||
|
||||
if (columns[0][1] === '*') {
|
||||
query += '*';
|
||||
} else {
|
||||
query += '`' + Functions.escapeBacktick(columns[0][1]) + '`';
|
||||
}
|
||||
|
||||
if (columns[0][2] !== '') {
|
||||
query += ' AS `' + Functions.escapeBacktick(columns[0][2]) + '`';
|
||||
}
|
||||
|
||||
for (var i = 1; i < columns.length; i++) {
|
||||
query += ', `' + Functions.escapeBacktick(columns[i][0]) + '`.';
|
||||
|
||||
if (columns[i][1] === '*') {
|
||||
query += '*';
|
||||
} else {
|
||||
query += '`' + Functions.escapeBacktick(columns[i][1]) + '`';
|
||||
}
|
||||
|
||||
if (columns[i][2] !== '') {
|
||||
query += ' AS `' + Functions.escapeBacktick(columns[i][2]) + '`';
|
||||
}
|
||||
}
|
||||
|
||||
query += '\nFROM ';
|
||||
query += generateFromBlock(tableAliases, foreignKeys);
|
||||
var $criteriaColCount = $('.criteria_col:checked').length;
|
||||
|
||||
if ($criteriaColCount > 0) {
|
||||
query += '\nWHERE ';
|
||||
query += generateWhereBlock();
|
||||
}
|
||||
|
||||
query += ';';
|
||||
editor.getDoc().setValue(query);
|
||||
});
|
||||
$('#submit_query').on('click', function () {
|
||||
var query = editor.getDoc().getValue(); // Verifying that the query is not empty
|
||||
|
||||
if (query === '') {
|
||||
Functions.ajaxShowMessage(Messages.strEmptyQuery, false, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {
|
||||
'db': $('#db_name').val(),
|
||||
'sql_query': query,
|
||||
'ajax_request': '1',
|
||||
'token': CommonParams.get('token')
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'index.php?route=/database/multi-table-query/query',
|
||||
data: data,
|
||||
success: function success(data) {
|
||||
var $resultsDom = $(data.message);
|
||||
$resultsDom.find('.ajax:not(.pageselector)').each(function () {
|
||||
$(this).on('click', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
$resultsDom.find('.autosubmit, .pageselector, .showAllRows, .filter_rows').each(function () {
|
||||
$(this).on('change click select focus', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
$('#sql_results').html($resultsDom);
|
||||
$('#page_content').find('a').first().trigger('click');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#add_column_button').on('click', function () {
|
||||
columnCount++;
|
||||
var $newColumnDom = $($('#new_column_layout').html()).clone();
|
||||
$newColumnDom.find('div').first().find('div').first().attr('id', columnCount.toString());
|
||||
$newColumnDom.find('a').first().remove();
|
||||
$newColumnDom.find('.pma_auto_slider').first().unwrap();
|
||||
$newColumnDom.find('.pma_auto_slider').first().attr('title', 'criteria');
|
||||
$('#add_column_button').parent().before($newColumnDom);
|
||||
Functions.initSlider();
|
||||
addNewColumnCallbacks();
|
||||
});
|
||||
|
||||
function addNewColumnCallbacks() {
|
||||
$('.tableNameSelect').each(function () {
|
||||
$(this).on('change', function () {
|
||||
var $sibs = $(this).siblings('.columnNameSelect');
|
||||
|
||||
if ($sibs.length === 0) {
|
||||
$sibs = $(this).parent().parent().find('.columnNameSelect');
|
||||
}
|
||||
|
||||
$sibs.first().html($('#' + md5($(this).val())).html());
|
||||
});
|
||||
});
|
||||
$('.removeColumn').each(function () {
|
||||
$(this).on('click', function () {
|
||||
$(this).parent().remove();
|
||||
});
|
||||
});
|
||||
$('a.ajax').each(function () {
|
||||
$(this).on('click', function (event, from) {
|
||||
if (from === null) {
|
||||
var $checkbox = $(this).siblings('.criteria_col').first();
|
||||
$checkbox.prop('checked', !$checkbox.prop('checked'));
|
||||
}
|
||||
|
||||
var $criteriaColCount = $('.criteria_col:checked').length;
|
||||
|
||||
if ($criteriaColCount > 1) {
|
||||
$(this).siblings('.slide-wrapper').first().find('.logical_operator').first().css('display', 'table-row');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('.criteria_col').each(function () {
|
||||
$(this).on('change', function () {
|
||||
var $anchor = $(this).siblings('a.ajax').first();
|
||||
$anchor.trigger('click', ['Trigger']);
|
||||
});
|
||||
});
|
||||
$('.criteria_rhs').each(function () {
|
||||
$(this).on('change', function () {
|
||||
var $rhsCol = $(this).parent().parent().siblings('.rhs_table').first();
|
||||
var $rhsText = $(this).parent().parent().siblings('.rhs_text').first();
|
||||
|
||||
if ($(this).val() === 'text') {
|
||||
$rhsCol.css('display', 'none');
|
||||
$rhsText.css('display', 'table-row');
|
||||
} else if ($(this).val() === 'anotherColumn') {
|
||||
$rhsText.css('display', 'none');
|
||||
$rhsCol.css('display', 'table-row');
|
||||
} else {
|
||||
$rhsText.css('display', 'none');
|
||||
$rhsCol.css('display', 'none');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
172
pma/js/dist/database/operations.js
vendored
Normal file
172
pma/js/dist/database/operations.js
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @fileoverview function used in server privilege pages
|
||||
* @name Database Operations
|
||||
*
|
||||
* @requires jQuery
|
||||
* @requires jQueryUI
|
||||
* @requires js/functions.js
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ajax event handlers here for /database/operations
|
||||
*
|
||||
* Actions Ajaxified here:
|
||||
* Rename Database
|
||||
* Copy Database
|
||||
* Change Charset
|
||||
* Drop Database
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('database/operations.js', function () {
|
||||
$(document).off('submit', '#rename_db_form.ajax');
|
||||
$(document).off('submit', '#copy_db_form.ajax');
|
||||
$(document).off('submit', '#change_db_charset_form.ajax');
|
||||
$(document).off('click', '#drop_db_anchor.ajax');
|
||||
});
|
||||
AJAX.registerOnload('database/operations.js', function () {
|
||||
/**
|
||||
* Ajax event handlers for 'Rename Database'
|
||||
*/
|
||||
$(document).on('submit', '#rename_db_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (Functions.emptyCheckTheField(this, 'newname')) {
|
||||
Functions.ajaxShowMessage(Messages.strFormEmpty, false, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
var oldDbName = CommonParams.get('db');
|
||||
var newDbName = $('#new_db_name').val();
|
||||
|
||||
if (newDbName === oldDbName) {
|
||||
Functions.ajaxShowMessage(Messages.strDatabaseRenameToSameName, false, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
var $form = $(this);
|
||||
var question = Functions.escapeHtml('CREATE DATABASE ' + newDbName + ' / DROP DATABASE ' + oldDbName);
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
$form.confirm(question, $form.attr('action'), function (url) {
|
||||
Functions.ajaxShowMessage(Messages.strRenamingDatabases, false);
|
||||
$.post(url, $('#rename_db_form').serialize() + CommonParams.get('arg_separator') + 'is_js_confirmed=1', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
CommonParams.set('db', data.newname);
|
||||
Navigation.reload(function () {
|
||||
$('#pma_navigation_tree').find('a:not(\'.expander\')').each(function () {
|
||||
var $thisAnchor = $(this);
|
||||
|
||||
if ($thisAnchor.text() === data.newname) {
|
||||
// simulate a click on the new db name
|
||||
// in navigation
|
||||
$thisAnchor.trigger('click');
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
}); // end Rename Database
|
||||
|
||||
/**
|
||||
* Ajax Event Handler for 'Copy Database'
|
||||
*/
|
||||
|
||||
$(document).on('submit', '#copy_db_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (Functions.emptyCheckTheField(this, 'newname')) {
|
||||
Functions.ajaxShowMessage(Messages.strFormEmpty, false, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
Functions.ajaxShowMessage(Messages.strCopyingDatabase, false);
|
||||
var $form = $(this);
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
// use messages that stay on screen
|
||||
$('.alert-success, .alert-danger').fadeOut();
|
||||
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
if ($('#checkbox_switch').is(':checked')) {
|
||||
CommonParams.set('db', data.newname);
|
||||
CommonActions.refreshMain(false, function () {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
});
|
||||
} else {
|
||||
CommonParams.set('db', data.db);
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
}
|
||||
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}); // end copy database
|
||||
|
||||
/**
|
||||
* Change tables columns visible only if change tables is checked
|
||||
*/
|
||||
|
||||
$('#span_change_all_tables_columns_collations').hide();
|
||||
$('#checkbox_change_all_tables_collations').on('click', function () {
|
||||
$('#span_change_all_tables_columns_collations').toggle();
|
||||
});
|
||||
/**
|
||||
* Ajax Event handler for 'Change Charset' of the database
|
||||
*/
|
||||
|
||||
$(document).on('submit', '#change_db_charset_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
Functions.ajaxShowMessage(Messages.strChangingCharset);
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}); // end change charset
|
||||
|
||||
/**
|
||||
* Ajax event handlers for Drop Database
|
||||
*/
|
||||
|
||||
$(document).on('click', '#drop_db_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $link = $(this);
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
|
||||
var question = Messages.strDropDatabaseStrongWarning + ' ';
|
||||
question += Functions.sprintf(Messages.strDoYouReally, 'DROP DATABASE `' + Functions.escapeHtml(CommonParams.get('db') + '`'));
|
||||
var params = Functions.getJsConfirmCommonParam(this, $link.getPostData());
|
||||
$(this).confirm(question, $(this).attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage(Messages.strProcessingRequest);
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
// Database deleted successfully, refresh both the frames
|
||||
Navigation.reload();
|
||||
CommonParams.set('db', '');
|
||||
CommonActions.refreshMain('index.php?route=/server/databases', function () {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
86
pma/js/dist/database/qbe.js
vendored
Normal file
86
pma/js/dist/database/qbe.js
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @fileoverview function used in QBE for DB
|
||||
* @name Database Operations
|
||||
*
|
||||
* @requires jQuery
|
||||
* @requires jQueryUI
|
||||
* @requires js/functions.js
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ajax event handlers here for /database/qbe
|
||||
*
|
||||
* Actions Ajaxified here:
|
||||
* Select saved search
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('database/qbe.js', function () {
|
||||
$(document).off('change', 'select[name^=criteriaColumn]');
|
||||
$(document).off('change', '#searchId');
|
||||
$(document).off('click', '#saveSearch');
|
||||
$(document).off('click', '#updateSearch');
|
||||
$(document).off('click', '#deleteSearch');
|
||||
});
|
||||
AJAX.registerOnload('database/qbe.js', function () {
|
||||
Functions.getSqlEditor($('#textSqlquery'), {}, 'none');
|
||||
$('#tblQbe').width($('#tblQbe').parent().width());
|
||||
$('#tblQbeFooters').width($('#tblQbeFooters').parent().width());
|
||||
$('#tblQbe').on('resize', function () {
|
||||
var newWidthTblQbe = $('#textSqlquery').next().width();
|
||||
$('#tblQbe').width(newWidthTblQbe);
|
||||
$('#tblQbeFooters').width(newWidthTblQbe);
|
||||
});
|
||||
/**
|
||||
* Ajax handler to check the corresponding 'show' checkbox when column is selected
|
||||
*/
|
||||
|
||||
$(document).on('change', 'select[name^=criteriaColumn]', function () {
|
||||
if ($(this).val()) {
|
||||
var index = /\d+/.exec($(this).attr('name'));
|
||||
$('input[name=criteriaShow\\[' + index + '\\]]').prop('checked', true);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Ajax event handlers for 'Select saved search'
|
||||
*/
|
||||
|
||||
$(document).on('change', '#searchId', function () {
|
||||
$('#action').val('load');
|
||||
$('#formQBE').trigger('submit');
|
||||
});
|
||||
/**
|
||||
* Ajax event handlers for 'Create bookmark'
|
||||
*/
|
||||
|
||||
$(document).on('click', '#saveSearch', function () {
|
||||
$('#action').val('create');
|
||||
});
|
||||
/**
|
||||
* Ajax event handlers for 'Update bookmark'
|
||||
*/
|
||||
|
||||
$(document).on('click', '#updateSearch', function () {
|
||||
$('#action').val('update');
|
||||
});
|
||||
/**
|
||||
* Ajax event handlers for 'Delete bookmark'
|
||||
*/
|
||||
|
||||
$(document).on('click', '#deleteSearch', function () {
|
||||
var question = Functions.sprintf(Messages.strConfirmDeleteQBESearch, $('#searchId').find('option:selected').text());
|
||||
|
||||
if (!confirm(question)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#action').val('delete');
|
||||
});
|
||||
var windowwidth = $(window).width();
|
||||
$('.jsresponsive').css('max-width', windowwidth - 35 + 'px');
|
||||
});
|
148
pma/js/dist/database/query_generator.js
vendored
Normal file
148
pma/js/dist/database/query_generator.js
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @fileoverview function used in QBE for DB
|
||||
* @name Database Operations
|
||||
*
|
||||
* @requires jQuery
|
||||
* @requires jQueryUI
|
||||
* @requires js/functions.js
|
||||
*
|
||||
*/
|
||||
|
||||
/* global sprintf */
|
||||
// js/vendor/sprintf.js
|
||||
function getFormatsText() {
|
||||
return {
|
||||
'=': ' = \'%s\'',
|
||||
'>': ' > \'%s\'',
|
||||
'>=': ' >= \'%s\'',
|
||||
'<': ' < \'%s\'',
|
||||
'<=': ' <= \'%s\'',
|
||||
'!=': ' != \'%s\'',
|
||||
'LIKE': ' LIKE \'%s\'',
|
||||
'LIKE %...%': ' LIKE \'%%%s%%\'',
|
||||
'NOT LIKE': ' NOT LIKE \'%s\'',
|
||||
'BETWEEN': ' BETWEEN \'%s\'',
|
||||
'NOT BETWEEN': ' NOT BETWEEN \'%s\'',
|
||||
'IS NULL': ' \'%s\' IS NULL',
|
||||
'IS NOT NULL': ' \'%s\' IS NOT NULL',
|
||||
'REGEXP': ' REGEXP \'%s\'',
|
||||
'REGEXP ^...$': ' REGEXP \'^%s$\'',
|
||||
'NOT REGEXP': ' NOT REGEXP \'%s\''
|
||||
};
|
||||
}
|
||||
|
||||
function generateCondition(criteriaDiv, table) {
|
||||
var query = '`' + Functions.escapeBacktick(table.val()) + '`.';
|
||||
query += '`' + Functions.escapeBacktick(table.siblings('.columnNameSelect').first().val()) + '`';
|
||||
|
||||
if (criteriaDiv.find('.criteria_rhs').first().val() === 'text') {
|
||||
var formatsText = getFormatsText();
|
||||
query += sprintf(formatsText[criteriaDiv.find('.criteria_op').first().val()], Functions.escapeSingleQuote(criteriaDiv.find('.rhs_text_val').first().val()));
|
||||
} else {
|
||||
query += ' ' + criteriaDiv.find('.criteria_op').first().val();
|
||||
query += ' `' + Functions.escapeBacktick(criteriaDiv.find('.tableNameSelect').first().val()) + '`.';
|
||||
query += '`' + Functions.escapeBacktick(criteriaDiv.find('.columnNameSelect').first().val()) + '`';
|
||||
}
|
||||
|
||||
return query;
|
||||
} // eslint-disable-next-line no-unused-vars
|
||||
|
||||
|
||||
function generateWhereBlock() {
|
||||
var count = 0;
|
||||
var query = '';
|
||||
$('.tableNameSelect').each(function () {
|
||||
var criteriaDiv = $(this).siblings('.slide-wrapper').first();
|
||||
var useCriteria = $(this).siblings('.criteria_col').first();
|
||||
|
||||
if ($(this).val() !== '' && useCriteria.prop('checked')) {
|
||||
if (count > 0) {
|
||||
criteriaDiv.find('input.logical_op').each(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
query += ' ' + $(this).val() + ' ';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
query += generateCondition(criteriaDiv, $(this));
|
||||
count++;
|
||||
}
|
||||
});
|
||||
return query;
|
||||
}
|
||||
|
||||
function generateJoin(newTable, tableAliases, fk) {
|
||||
var query = '';
|
||||
query += ' \n\tLEFT JOIN ' + '`' + Functions.escapeBacktick(newTable) + '`';
|
||||
|
||||
if (tableAliases[fk.TABLE_NAME][0] !== '') {
|
||||
query += ' AS `' + Functions.escapeBacktick(tableAliases[newTable][0]) + '`';
|
||||
query += ' ON `' + Functions.escapeBacktick(tableAliases[fk.TABLE_NAME][0]) + '`';
|
||||
} else {
|
||||
query += ' ON `' + Functions.escapeBacktick(fk.TABLE_NAME) + '`';
|
||||
}
|
||||
|
||||
query += '.`' + fk.COLUMN_NAME + '`';
|
||||
|
||||
if (tableAliases[fk.REFERENCED_TABLE_NAME][0] !== '') {
|
||||
query += ' = `' + Functions.escapeBacktick(tableAliases[fk.REFERENCED_TABLE_NAME][0]) + '`';
|
||||
} else {
|
||||
query += ' = `' + Functions.escapeBacktick(fk.REFERENCED_TABLE_NAME) + '`';
|
||||
}
|
||||
|
||||
query += '.`' + fk.REFERENCED_COLUMN_NAME + '`';
|
||||
return query;
|
||||
}
|
||||
|
||||
function existReference(table, fk, usedTables) {
|
||||
var isReferredBy = fk.TABLE_NAME === table && usedTables.includes(fk.REFERENCED_TABLE_NAME);
|
||||
var isReferencedBy = fk.REFERENCED_TABLE_NAME === table && usedTables.includes(fk.TABLE_NAME);
|
||||
return isReferredBy || isReferencedBy;
|
||||
}
|
||||
|
||||
function tryJoinTable(table, tableAliases, usedTables, foreignKeys) {
|
||||
for (var i = 0; i < foreignKeys.length; i++) {
|
||||
var fk = foreignKeys[i];
|
||||
|
||||
if (existReference(table, fk, usedTables)) {
|
||||
return generateJoin(table, tableAliases, fk);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function appendTable(table, tableAliases, usedTables, foreignKeys) {
|
||||
var query = tryJoinTable(table, tableAliases, usedTables, foreignKeys);
|
||||
|
||||
if (query === '') {
|
||||
if (usedTables.length > 0) {
|
||||
query += '\n\t, ';
|
||||
}
|
||||
|
||||
query += '`' + Functions.escapeBacktick(table) + '`';
|
||||
|
||||
if (tableAliases[table][0] !== '') {
|
||||
query += ' AS `' + Functions.escapeBacktick(tableAliases[table][0]) + '`';
|
||||
}
|
||||
}
|
||||
|
||||
usedTables.push(table);
|
||||
return query;
|
||||
} // eslint-disable-next-line no-unused-vars
|
||||
|
||||
|
||||
function generateFromBlock(tableAliases, foreignKeys) {
|
||||
var usedTables = [];
|
||||
var query = '';
|
||||
|
||||
for (var table in tableAliases) {
|
||||
if (tableAliases.hasOwnProperty(table)) {
|
||||
query += appendTable(table, tableAliases, usedTables, foreignKeys);
|
||||
}
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
246
pma/js/dist/database/search.js
vendored
Normal file
246
pma/js/dist/database/search.js
vendored
Normal file
@ -0,0 +1,246 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* JavaScript functions used on Database Search page
|
||||
*
|
||||
* @requires jQuery
|
||||
* @requires js/functions.js
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
/* global makeGrid */
|
||||
// js/makegrid.js
|
||||
|
||||
/**
|
||||
* AJAX script for the Database Search page.
|
||||
*
|
||||
* Actions ajaxified here:
|
||||
* Retrieve result of SQL query
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('database/search.js', function () {
|
||||
$('a.browse_results').off('click');
|
||||
$('a.delete_results').off('click');
|
||||
$('#buttonGo').off('click');
|
||||
$('#togglesearchresultlink').off('click');
|
||||
$('#togglequerybox').off('click');
|
||||
$('#togglesearchformlink').off('click');
|
||||
$(document).off('submit', '#db_search_form.ajax');
|
||||
});
|
||||
AJAX.registerOnload('database/search.js', function () {
|
||||
/** Hide the table link in the initial search result */
|
||||
var icon = Functions.getImage('s_tbl', '', {
|
||||
'id': 'table-image'
|
||||
}).toString();
|
||||
$('#table-info').prepend(icon).hide();
|
||||
/** Hide the browse and deleted results in the new search criteria */
|
||||
|
||||
$('#buttonGo').on('click', function () {
|
||||
$('#table-info').hide();
|
||||
$('#browse-results').hide();
|
||||
$('#sqlqueryform').hide();
|
||||
$('#togglequerybox').hide();
|
||||
});
|
||||
/**
|
||||
* Prepare a div containing a link for toggle the search results
|
||||
*/
|
||||
|
||||
$('#togglesearchresultsdiv')
|
||||
/** don't show it until we have results on-screen */
|
||||
.hide();
|
||||
/**
|
||||
* Changing the displayed text according to
|
||||
* the hide/show criteria in search result forms
|
||||
*/
|
||||
|
||||
$('#togglesearchresultlink').html(Messages.strHideSearchResults).on('click', function () {
|
||||
var $link = $(this);
|
||||
$('#searchresults').slideToggle();
|
||||
|
||||
if ($link.text() === Messages.strHideSearchResults) {
|
||||
$link.text(Messages.strShowSearchResults);
|
||||
} else {
|
||||
$link.text(Messages.strHideSearchResults);
|
||||
}
|
||||
/** avoid default click action */
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
/**
|
||||
* Prepare a div containing a link for toggle the search form,
|
||||
* otherwise it's incorrectly displayed after a couple of clicks
|
||||
*/
|
||||
|
||||
$('#togglesearchformdiv').hide(); // don't show it until we have results on-screen
|
||||
|
||||
/**
|
||||
* Changing the displayed text according to
|
||||
* the hide/show criteria in search form
|
||||
*/
|
||||
|
||||
$('#togglequerybox').hide().on('click', function () {
|
||||
var $link = $(this);
|
||||
$('#sqlqueryform').slideToggle('medium');
|
||||
|
||||
if ($link.text() === Messages.strHideQueryBox) {
|
||||
$link.text(Messages.strShowQueryBox);
|
||||
} else {
|
||||
$link.text(Messages.strHideQueryBox);
|
||||
}
|
||||
/** avoid default click action */
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
/** don't show it until we have results on-screen */
|
||||
|
||||
/**
|
||||
* Changing the displayed text according to
|
||||
* the hide/show criteria in search criteria form
|
||||
*/
|
||||
|
||||
$('#togglesearchformlink').html(Messages.strShowSearchCriteria).on('click', function () {
|
||||
var $link = $(this);
|
||||
$('#db_search_form').slideToggle();
|
||||
|
||||
if ($link.text() === Messages.strHideSearchCriteria) {
|
||||
$link.text(Messages.strShowSearchCriteria);
|
||||
} else {
|
||||
$link.text(Messages.strHideSearchCriteria);
|
||||
}
|
||||
/** avoid default click action */
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
/*
|
||||
* Ajax Event handler for retrieving the results from a table
|
||||
*/
|
||||
|
||||
$(document).on('click', 'a.browse_results', function (e) {
|
||||
e.preventDefault();
|
||||
/** Hides the results shown by the delete criteria */
|
||||
|
||||
var $msg = Functions.ajaxShowMessage(Messages.strBrowsing, false);
|
||||
$('#sqlqueryform').hide();
|
||||
$('#togglequerybox').hide();
|
||||
/** Load the browse results to the page */
|
||||
|
||||
$('#table-info').show();
|
||||
var tableName = $(this).data('table-name');
|
||||
$('#table-link').attr({
|
||||
'href': $(this).attr('href')
|
||||
}).text(tableName);
|
||||
var url = $(this).attr('href') + '#searchresults';
|
||||
var browseSql = $(this).data('browse-sql');
|
||||
var params = {
|
||||
'ajax_request': true,
|
||||
'is_js_confirmed': true,
|
||||
'sql_query': browseSql
|
||||
};
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
$('#browse-results').html(data.message);
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
$('.table_results').each(function () {
|
||||
makeGrid(this, true, true, true, true);
|
||||
});
|
||||
$('#browse-results').show();
|
||||
Functions.highlightSql($('#browse-results'));
|
||||
$('html, body').animate({
|
||||
scrollTop: $('#browse-results').offset().top
|
||||
}, 1000);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
/*
|
||||
* Ajax Event handler for deleting the results from a table
|
||||
*/
|
||||
|
||||
$(document).on('click', 'a.delete_results', function (e) {
|
||||
e.preventDefault();
|
||||
/** Hides the results shown by the browse criteria */
|
||||
|
||||
$('#table-info').hide();
|
||||
$('#sqlqueryform').hide();
|
||||
$('#togglequerybox').hide();
|
||||
/** Conformation message for deletion */
|
||||
|
||||
var msg = Functions.sprintf(Messages.strConfirmDeleteResults, $(this).data('table-name'));
|
||||
|
||||
if (confirm(msg)) {
|
||||
var $msg = Functions.ajaxShowMessage(Messages.strDeleting, false);
|
||||
/** Load the deleted option to the page*/
|
||||
|
||||
$('#sqlqueryform').html('');
|
||||
var params = {
|
||||
'ajax_request': true,
|
||||
'is_js_confirmed': true,
|
||||
'sql_query': $(this).data('delete-sql')
|
||||
};
|
||||
var url = $(this).attr('href');
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data === 'undefined' || !data.success) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#sqlqueryform').html(data.sql_query);
|
||||
/** Refresh the search results after the deletion */
|
||||
|
||||
$('#buttonGo').trigger('click');
|
||||
$('#togglequerybox').html(Messages.strHideQueryBox);
|
||||
/** Show the results of the deletion option */
|
||||
|
||||
$('#browse-results').hide();
|
||||
$('#sqlqueryform').show();
|
||||
$('#togglequerybox').show();
|
||||
$('html, body').animate({
|
||||
scrollTop: $('#browse-results').offset().top
|
||||
}, 1000);
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Ajax Event handler for retrieving the result of an SQL Query
|
||||
*/
|
||||
|
||||
$(document).on('submit', '#db_search_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $msgbox = Functions.ajaxShowMessage(Messages.strSearching, false); // jQuery object to reuse
|
||||
|
||||
var $form = $(this);
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
var url = $form.serialize() + CommonParams.get('arg_separator') + 'submit_search=' + $('#buttonGo').val();
|
||||
$.post($form.attr('action'), url, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
// found results
|
||||
$('#searchresults').html(data.message);
|
||||
$('#togglesearchresultlink') // always start with the Show message
|
||||
.text(Messages.strHideSearchResults);
|
||||
$('#togglesearchresultsdiv') // now it's time to show the div containing the link
|
||||
.show();
|
||||
$('#searchresults').show();
|
||||
$('#db_search_form') // workaround for Chrome problem (bug #3168569)
|
||||
.slideToggle().hide();
|
||||
$('#togglesearchformlink') // always start with the Show message
|
||||
.text(Messages.strShowSearchCriteria);
|
||||
$('#togglesearchformdiv') // now it's time to show the div containing the link
|
||||
.show();
|
||||
} else {
|
||||
// error message (zero rows)
|
||||
$('#searchresults').html(data.error).show();
|
||||
}
|
||||
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
});
|
||||
});
|
||||
}); // end $()
|
469
pma/js/dist/database/structure.js
vendored
Normal file
469
pma/js/dist/database/structure.js
vendored
Normal file
@ -0,0 +1,469 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @fileoverview functions used on the database structure page
|
||||
* @name Database Structure
|
||||
*
|
||||
* @requires jQuery
|
||||
* @requires jQueryUI
|
||||
* @required js/functions.js
|
||||
*/
|
||||
var DatabaseStructure = {};
|
||||
/**
|
||||
* AJAX scripts for /database/structure
|
||||
*
|
||||
* Actions ajaxified here:
|
||||
* Drop Database
|
||||
* Truncate Table
|
||||
* Drop Table
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
|
||||
AJAX.registerTeardown('database/structure.js', function () {
|
||||
$(document).off('click', 'a.truncate_table_anchor.ajax');
|
||||
$(document).off('click', 'a.drop_table_anchor.ajax');
|
||||
$(document).off('click', '#real_end_input');
|
||||
$(document).off('click', 'a.favorite_table_anchor.ajax');
|
||||
$(document).off('click', '#printView');
|
||||
$('a.real_row_count').off('click');
|
||||
$('a.row_count_sum').off('click');
|
||||
$('select[name=submit_mult]').off('change');
|
||||
});
|
||||
/**
|
||||
* Adjust number of rows and total size in the summary
|
||||
* when truncating, creating, dropping or inserting into a table
|
||||
*/
|
||||
|
||||
DatabaseStructure.adjustTotals = function () {
|
||||
var byteUnits = [Messages.strB, Messages.strKiB, Messages.strMiB, Messages.strGiB, Messages.strTiB, Messages.strPiB, Messages.strEiB];
|
||||
/**
|
||||
* @var $allTr jQuery object that references all the rows in the list of tables
|
||||
*/
|
||||
|
||||
var $allTr = $('#tablesForm').find('table.data tbody').first().find('tr'); // New summary values for the table
|
||||
|
||||
var tableSum = $allTr.length;
|
||||
var rowsSum = 0;
|
||||
var sizeSum = 0;
|
||||
var overheadSum = 0;
|
||||
var rowSumApproximated = false;
|
||||
$allTr.each(function () {
|
||||
var $this = $(this);
|
||||
var i;
|
||||
var tmpVal; // Get the number of rows for this SQL table
|
||||
|
||||
var strRows = $this.find('.tbl_rows').text(); // If the value is approximated
|
||||
|
||||
if (strRows.indexOf('~') === 0) {
|
||||
rowSumApproximated = true; // The approximated value contains a preceding ~ (Eg 100 --> ~100)
|
||||
|
||||
strRows = strRows.substring(1, strRows.length);
|
||||
}
|
||||
|
||||
strRows = strRows.replace(/[,.\s]/g, '');
|
||||
var intRow = parseInt(strRows, 10);
|
||||
|
||||
if (!isNaN(intRow)) {
|
||||
rowsSum += intRow;
|
||||
} // Extract the size and overhead
|
||||
|
||||
|
||||
var valSize = 0;
|
||||
var valOverhead = 0;
|
||||
var strSize = $this.find('.tbl_size span:not(.unit)').text().trim();
|
||||
var strSizeUnit = $this.find('.tbl_size span.unit').text().trim();
|
||||
var strOverhead = $this.find('.tbl_overhead span:not(.unit)').text().trim();
|
||||
var strOverheadUnit = $this.find('.tbl_overhead span.unit').text().trim(); // Given a value and a unit, such as 100 and KiB, for the table size
|
||||
// and overhead calculate their numeric values in bytes, such as 102400
|
||||
|
||||
for (i = 0; i < byteUnits.length; i++) {
|
||||
if (strSizeUnit === byteUnits[i]) {
|
||||
tmpVal = parseFloat(strSize);
|
||||
valSize = tmpVal * Math.pow(1024, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < byteUnits.length; i++) {
|
||||
if (strOverheadUnit === byteUnits[i]) {
|
||||
tmpVal = parseFloat(strOverhead);
|
||||
valOverhead = tmpVal * Math.pow(1024, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sizeSum += valSize;
|
||||
overheadSum += valOverhead;
|
||||
}); // Add some commas for readability:
|
||||
// 1000000 becomes 1,000,000
|
||||
|
||||
var strRowSum = rowsSum + '';
|
||||
var regex = /(\d+)(\d{3})/;
|
||||
|
||||
while (regex.test(strRowSum)) {
|
||||
strRowSum = strRowSum.replace(regex, '$1' + ',' + '$2');
|
||||
} // If approximated total value add ~ in front
|
||||
|
||||
|
||||
if (rowSumApproximated) {
|
||||
strRowSum = '~' + strRowSum;
|
||||
} // Calculate the magnitude for the size and overhead values
|
||||
|
||||
|
||||
var sizeMagnitude = 0;
|
||||
var overheadMagnitude = 0;
|
||||
|
||||
while (sizeSum >= 1024) {
|
||||
sizeSum /= 1024;
|
||||
sizeMagnitude++;
|
||||
}
|
||||
|
||||
while (overheadSum >= 1024) {
|
||||
overheadSum /= 1024;
|
||||
overheadMagnitude++;
|
||||
}
|
||||
|
||||
sizeSum = Math.round(sizeSum * 10) / 10;
|
||||
overheadSum = Math.round(overheadSum * 10) / 10; // Update summary with new data
|
||||
|
||||
var $summary = $('#tbl_summary_row');
|
||||
$summary.find('.tbl_num').text(Functions.sprintf(Messages.strNTables, tableSum));
|
||||
|
||||
if (rowSumApproximated) {
|
||||
$summary.find('.row_count_sum').text(strRowSum);
|
||||
} else {
|
||||
$summary.find('.tbl_rows').text(strRowSum);
|
||||
}
|
||||
|
||||
$summary.find('.tbl_size').text(sizeSum + ' ' + byteUnits[sizeMagnitude]);
|
||||
$summary.find('.tbl_overhead').text(overheadSum + ' ' + byteUnits[overheadMagnitude]);
|
||||
};
|
||||
/**
|
||||
* Gets the real row count for a table or DB.
|
||||
* @param object $target Target for appending the real count value.
|
||||
*/
|
||||
|
||||
|
||||
DatabaseStructure.fetchRealRowCount = function ($target) {
|
||||
var $throbber = $('#pma_navigation').find('.throbber').first().clone().css({
|
||||
visibility: 'visible',
|
||||
display: 'inline-block'
|
||||
}).on('click', false);
|
||||
$target.html($throbber);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: $target.attr('href'),
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function success(response) {
|
||||
if (response.success) {
|
||||
// If to update all row counts for a DB.
|
||||
if (response.real_row_count_all) {
|
||||
$.each(JSON.parse(response.real_row_count_all), function (index, table) {
|
||||
// Update each table row count.
|
||||
$('table.data td[data-table*="' + table.table + '"]').text(table.row_count);
|
||||
});
|
||||
} // If to update a particular table's row count.
|
||||
|
||||
|
||||
if (response.real_row_count) {
|
||||
// Append the parent cell with real row count.
|
||||
$target.parent().text(response.real_row_count);
|
||||
} // Adjust the 'Sum' displayed at the bottom.
|
||||
|
||||
|
||||
DatabaseStructure.adjustTotals();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(Messages.strErrorRealRowCount);
|
||||
}
|
||||
},
|
||||
error: function error() {
|
||||
Functions.ajaxShowMessage(Messages.strErrorRealRowCount);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
AJAX.registerOnload('database/structure.js', function () {
|
||||
/**
|
||||
* function to open the confirmation dialog for making table consistent with central list
|
||||
*
|
||||
* @param string msg message text to be displayed to user
|
||||
* @param function success function to be called on success
|
||||
*
|
||||
*/
|
||||
var jqConfirm = function jqConfirm(msg, success) {
|
||||
var dialogObj = $('<div class=\'hide\'>' + msg + '</div>');
|
||||
$('body').append(dialogObj);
|
||||
var buttonOptions = {};
|
||||
|
||||
buttonOptions[Messages.strContinue] = function () {
|
||||
success();
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
buttonOptions[Messages.strCancel] = function () {
|
||||
$(this).dialog('close');
|
||||
$('#tablesForm')[0].reset();
|
||||
};
|
||||
|
||||
$(dialogObj).dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
title: Messages.confirmTitle,
|
||||
buttons: buttonOptions
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Event handler on select of "Make consistent with central list"
|
||||
*/
|
||||
|
||||
|
||||
$('select[name=submit_mult]').on('change', function (event) {
|
||||
var url = 'index.php?route=/database/structure';
|
||||
var action = $(this).val();
|
||||
|
||||
if (action === 'make_consistent_with_central_list') {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
jqConfirm(Messages.makeConsistentMessage, function () {
|
||||
var $form = $('#tablesForm');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var data = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
Functions.ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post('index.php?route=/database/structure/central-columns-make-consistent', data, AJAX.responseHandler);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (action === 'copy_tbl' || action === 'add_prefix_tbl' || action === 'replace_prefix_tbl' || action === 'copy_tbl_change_prefix') {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
if ($('input[name="selected_tbl[]"]:checked').length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var formData = $('#tablesForm').serialize();
|
||||
var modalTitle = '';
|
||||
|
||||
if (action === 'copy_tbl') {
|
||||
url = 'index.php?route=/database/structure/copy-form';
|
||||
modalTitle = Messages.strCopyTablesTo;
|
||||
} else if (action === 'add_prefix_tbl') {
|
||||
url = 'index.php?route=/database/structure/add-prefix';
|
||||
modalTitle = Messages.strAddPrefix;
|
||||
} else if (action === 'replace_prefix_tbl') {
|
||||
url = 'index.php?route=/database/structure/change-prefix-form';
|
||||
modalTitle = Messages.strReplacePrefix;
|
||||
} else if (action === 'copy_tbl_change_prefix') {
|
||||
url = 'index.php?route=/database/structure/change-prefix-form';
|
||||
modalTitle = Messages.strCopyPrefix;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
dataType: 'html',
|
||||
data: formData
|
||||
}).done(function (data) {
|
||||
var dialogObj = $('<div class=\'hide\'>' + data + '</div>');
|
||||
$('body').append(dialogObj);
|
||||
var buttonOptions = {};
|
||||
|
||||
buttonOptions[Messages.strContinue] = function () {
|
||||
$('#ajax_form').trigger('submit');
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
buttonOptions[Messages.strCancel] = function () {
|
||||
$(this).dialog('close');
|
||||
$('#tablesForm')[0].reset();
|
||||
};
|
||||
|
||||
$(dialogObj).dialog({
|
||||
minWidth: 500,
|
||||
resizable: false,
|
||||
modal: true,
|
||||
title: modalTitle,
|
||||
buttons: buttonOptions
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (action === 'analyze_tbl') {
|
||||
url = 'index.php?route=/table/maintenance/analyze';
|
||||
} else if (action === 'sync_unique_columns_central_list') {
|
||||
url = 'index.php?route=/database/structure/central-columns-add';
|
||||
} else if (action === 'delete_unique_columns_central_list') {
|
||||
url = 'index.php?route=/database/structure/central-columns-remove';
|
||||
} else if (action === 'check_tbl') {
|
||||
url = 'index.php?route=/table/maintenance/check';
|
||||
} else if (action === 'checksum_tbl') {
|
||||
url = 'index.php?route=/table/maintenance/checksum';
|
||||
} else if (action === 'drop_tbl') {
|
||||
url = 'index.php?route=/database/structure/drop-form';
|
||||
} else if (action === 'empty_tbl') {
|
||||
url = 'index.php?route=/database/structure/empty-form';
|
||||
} else if (action === 'export') {
|
||||
url = 'index.php?route=/export/tables';
|
||||
} else if (action === 'optimize_tbl') {
|
||||
url = 'index.php?route=/table/maintenance/optimize';
|
||||
} else if (action === 'repair_tbl') {
|
||||
url = 'index.php?route=/table/maintenance/repair';
|
||||
} else if (action === 'show_create') {
|
||||
url = 'index.php?route=/database/structure/show-create';
|
||||
} else {
|
||||
$('#tablesForm').trigger('submit');
|
||||
return;
|
||||
}
|
||||
|
||||
var $form = $(this).parents('form');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var data = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
Functions.ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post(url, data, AJAX.responseHandler);
|
||||
});
|
||||
/**
|
||||
* Ajax Event handler for 'Truncate Table'
|
||||
*/
|
||||
|
||||
$(document).on('click', 'a.truncate_table_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var $this_anchor Object referring to the anchor clicked
|
||||
*/
|
||||
|
||||
var $thisAnchor = $(this); // extract current table name and build the question string
|
||||
|
||||
/**
|
||||
* @var curr_table_name String containing the name of the table to be truncated
|
||||
*/
|
||||
|
||||
var currTableName = $thisAnchor.parents('tr').children('th').children('a').text();
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
|
||||
var question = Messages.strTruncateTableStrongWarning + ' ' + Functions.sprintf(Messages.strDoYouReally, 'TRUNCATE `' + Functions.escapeHtml(currTableName) + '`') + Functions.getForeignKeyCheckboxLoader();
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage(Messages.strProcessingRequest);
|
||||
var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message); // Adjust table statistics
|
||||
|
||||
var $tr = $thisAnchor.closest('tr');
|
||||
$tr.find('.tbl_rows').text('0');
|
||||
$tr.find('.tbl_size, .tbl_overhead').text('-');
|
||||
DatabaseStructure.adjustTotals();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}, Functions.loadForeignKeyCheckbox);
|
||||
}); // end of Truncate Table Ajax action
|
||||
|
||||
/**
|
||||
* Ajax Event handler for 'Drop Table' or 'Drop View'
|
||||
*/
|
||||
|
||||
$(document).on('click', 'a.drop_table_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $thisAnchor = $(this); // extract current table name and build the question string
|
||||
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
|
||||
var $currRow = $thisAnchor.parents('tr');
|
||||
/**
|
||||
* @var curr_table_name String containing the name of the table to be truncated
|
||||
*/
|
||||
|
||||
var currTableName = $currRow.children('th').children('a').text();
|
||||
/**
|
||||
* @var is_view Boolean telling if we have a view
|
||||
*/
|
||||
|
||||
var isView = $currRow.hasClass('is_view') || $thisAnchor.hasClass('view');
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
|
||||
var question;
|
||||
|
||||
if (!isView) {
|
||||
question = Messages.strDropTableStrongWarning + ' ' + Functions.sprintf(Messages.strDoYouReally, 'DROP TABLE `' + Functions.escapeHtml(currTableName) + '`');
|
||||
} else {
|
||||
question = Functions.sprintf(Messages.strDoYouReally, 'DROP VIEW `' + Functions.escapeHtml(currTableName) + '`');
|
||||
}
|
||||
|
||||
question += Functions.getForeignKeyCheckboxLoader();
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest);
|
||||
var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
$currRow.hide('medium').remove();
|
||||
DatabaseStructure.adjustTotals();
|
||||
Navigation.reload();
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}, Functions.loadForeignKeyCheckbox);
|
||||
}); // end of Drop Table Ajax action
|
||||
|
||||
/**
|
||||
* Attach Event Handler for 'Print' link
|
||||
*/
|
||||
|
||||
$(document).on('click', '#printView', function (event) {
|
||||
event.preventDefault(); // Take to preview mode
|
||||
|
||||
Functions.printPreview();
|
||||
}); // end of Print View action
|
||||
// Calculate Real End for InnoDB
|
||||
|
||||
/**
|
||||
* Ajax Event handler for calculating the real end for a InnoDB table
|
||||
*
|
||||
*/
|
||||
|
||||
$(document).on('click', '#real_end_input', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
|
||||
var question = Messages.strOperationTakesLongTime;
|
||||
$(this).confirm(question, '', function () {
|
||||
return true;
|
||||
});
|
||||
return false;
|
||||
}); // end Calculate Real End for InnoDB
|
||||
// Add tooltip to favorite icons.
|
||||
|
||||
$('.favorite_table_anchor').each(function () {
|
||||
Functions.tooltip($(this), 'a', $(this).attr('title'));
|
||||
}); // Get real row count via Ajax.
|
||||
|
||||
$('a.real_row_count').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
DatabaseStructure.fetchRealRowCount($(this));
|
||||
}); // Get all real row count.
|
||||
|
||||
$('a.row_count_sum').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
DatabaseStructure.fetchRealRowCount($(this));
|
||||
});
|
||||
});
|
107
pma/js/dist/database/tracking.js
vendored
Normal file
107
pma/js/dist/database/tracking.js
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down the page
|
||||
*/
|
||||
AJAX.registerTeardown('database/tracking.js', function () {
|
||||
$('body').off('click', '#trackedForm.ajax button[name="submit_mult"], #trackedForm.ajax input[name="submit_mult"]');
|
||||
$('body').off('click', '#untrackedForm.ajax button[name="submit_mult"], #untrackedForm.ajax input[name="submit_mult"]');
|
||||
$('body').off('click', 'a.delete_tracking_anchor.ajax');
|
||||
});
|
||||
/**
|
||||
* Bind event handlers
|
||||
*/
|
||||
|
||||
AJAX.registerOnload('database/tracking.js', function () {
|
||||
var $versions = $('#versions');
|
||||
$versions.find('tr').first().find('th').append($('<div class="sorticon"></div>'));
|
||||
$versions.tablesorter({
|
||||
sortList: [[1, 0]],
|
||||
headers: {
|
||||
0: {
|
||||
sorter: false
|
||||
},
|
||||
2: {
|
||||
sorter: 'integer'
|
||||
},
|
||||
5: {
|
||||
sorter: false
|
||||
},
|
||||
6: {
|
||||
sorter: false
|
||||
},
|
||||
7: {
|
||||
sorter: false
|
||||
}
|
||||
}
|
||||
});
|
||||
var $noVersions = $('#noversions');
|
||||
$noVersions.find('tr').first().find('th').append($('<div class="sorticon"></div>'));
|
||||
$noVersions.tablesorter({
|
||||
sortList: [[1, 0]],
|
||||
headers: {
|
||||
0: {
|
||||
sorter: false
|
||||
},
|
||||
2: {
|
||||
sorter: false
|
||||
}
|
||||
}
|
||||
});
|
||||
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) {
|
||||
e.preventDefault();
|
||||
var $button = $(this);
|
||||
var $form = $button.parent('form');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val();
|
||||
|
||||
if ($button.val() === 'delete_tracking') {
|
||||
var question = Messages.strDeleteTrackingDataMultiple;
|
||||
$button.confirm(question, $form.attr('action'), function (url) {
|
||||
Functions.ajaxShowMessage(Messages.strDeletingTrackingData);
|
||||
AJAX.source = $form;
|
||||
$.post(url, submitData, AJAX.responseHandler);
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Handles multi submit for untracked tables
|
||||
*/
|
||||
|
||||
$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');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val();
|
||||
Functions.ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
});
|
||||
/**
|
||||
* Ajax Event handler for 'Delete tracking'
|
||||
*/
|
||||
|
||||
$body.on('click', 'a.delete_tracking_anchor.ajax', function (e) {
|
||||
e.preventDefault();
|
||||
var $anchor = $(this);
|
||||
var question = Messages.strDeleteTrackingData;
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage(Messages.strDeletingTrackingData);
|
||||
AJAX.source = $anchor;
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
params += argSep + 'ajax_page_request=1';
|
||||
$.post(url, params, AJAX.responseHandler);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user