Automatic fixes by ESLint
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
83df3be329
commit
00e1ca9b66
128
js/ajax.js
128
js/ajax.js
@ -44,7 +44,7 @@ var AJAX = {
|
||||
*/
|
||||
hash: function (key) {
|
||||
/* http://burtleburtle.net/bob/hash/doobs.html#one */
|
||||
key += "";
|
||||
key += '';
|
||||
var len = key.length, hash = 0, i = 0;
|
||||
for (; i < len; ++i) {
|
||||
hash += key.charCodeAt(i);
|
||||
@ -70,7 +70,7 @@ var AJAX = {
|
||||
if (this._debug) {
|
||||
console.log(
|
||||
// no need to translate
|
||||
"Registered event " + eventName + " for file " + file
|
||||
'Registered event ' + eventName + ' for file ' + file
|
||||
);
|
||||
}
|
||||
return this;
|
||||
@ -91,7 +91,7 @@ var AJAX = {
|
||||
if (this._debug) {
|
||||
console.log(
|
||||
// no need to translate
|
||||
"Registered event " + eventName + " for file " + file
|
||||
'Registered event ' + eventName + ' for file ' + file
|
||||
);
|
||||
}
|
||||
return this;
|
||||
@ -110,7 +110,7 @@ var AJAX = {
|
||||
if (this._debug) {
|
||||
console.log(
|
||||
// no need to translate
|
||||
"Fired event " + eventName + " for file " + file
|
||||
'Fired event ' + eventName + ' for file ' + file
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -128,7 +128,7 @@ var AJAX = {
|
||||
if (this._debug) {
|
||||
console.log(
|
||||
// no need to translate
|
||||
"Fired event " + eventName + " for file " + file
|
||||
'Fired event ' + eventName + ' for file ' + file
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -139,8 +139,8 @@ var AJAX = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
lockPageHandler: function(event) {
|
||||
//Don't lock on enter.
|
||||
lockPageHandler: function (event) {
|
||||
// Don't lock on enter.
|
||||
if (0 === event.charCode) {
|
||||
return;
|
||||
}
|
||||
@ -157,7 +157,7 @@ var AJAX = {
|
||||
if (event.data.value == 1) {
|
||||
newHash = AJAX.hash($(this).val());
|
||||
} else {
|
||||
newHash = AJAX.hash($(this).is(":checked"));
|
||||
newHash = AJAX.hash($(this).is(':checked'));
|
||||
}
|
||||
var oldHash = $(this).data('val-hash');
|
||||
// Set lock if old value != new value
|
||||
@ -180,7 +180,7 @@ var AJAX = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
resetLock: function() {
|
||||
resetLock: function () {
|
||||
AJAX.lockedTargets = {};
|
||||
$('#lock_page_icon').html('');
|
||||
},
|
||||
@ -205,12 +205,12 @@ var AJAX = {
|
||||
// leave the browser deal with it natively (e.g: file download)
|
||||
// or leave an existing ajax event handler present elsewhere deal with it
|
||||
var href = $(this).attr('href');
|
||||
if (typeof event != 'undefined' && (event.shiftKey || event.ctrlKey)) {
|
||||
if (typeof event !== 'undefined' && (event.shiftKey || event.ctrlKey)) {
|
||||
return true;
|
||||
} else if ($(this).attr('target')) {
|
||||
return true;
|
||||
} else if ($(this).hasClass('ajax') || $(this).hasClass('disableAjax')) {
|
||||
//reset the lockedTargets object, as specified AJAX operation has finished
|
||||
// reset the lockedTargets object, as specified AJAX operation has finished
|
||||
AJAX.resetLock();
|
||||
return true;
|
||||
} else if (href && href.match(/^#/)) {
|
||||
@ -223,15 +223,15 @@ var AJAX = {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof event != 'undefined') {
|
||||
if (typeof event !== 'undefined') {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
//triggers a confirm dialog if:
|
||||
//the user has performed some operations on loaded page
|
||||
//the user clicks on some link, (won't trigger for buttons)
|
||||
//the click event is not triggered by script
|
||||
// triggers a confirm dialog if:
|
||||
// the user has performed some operations on loaded page
|
||||
// the user clicks on some link, (won't trigger for buttons)
|
||||
// the click event is not triggered by script
|
||||
if (typeof event !== 'undefined' && event.type === 'click' &&
|
||||
event.isTrigger !== true &&
|
||||
!jQuery.isEmptyObject(AJAX.lockedTargets) &&
|
||||
@ -248,27 +248,27 @@ var AJAX = {
|
||||
// something else. Otherwise silently bail out, as there is already
|
||||
// a request well in progress.
|
||||
if (AJAX.xhr) {
|
||||
//In case of a link request, attempt aborting
|
||||
// In case of a link request, attempt aborting
|
||||
AJAX.xhr.abort();
|
||||
if(AJAX.xhr.status === 0 && AJAX.xhr.statusText === 'abort') {
|
||||
//If aborted
|
||||
if (AJAX.xhr.status === 0 && AJAX.xhr.statusText === 'abort') {
|
||||
// If aborted
|
||||
AJAX.$msgbox = PMA_ajaxShowMessage(PMA_messages.strAbortedRequest);
|
||||
AJAX.active = false;
|
||||
AJAX.xhr = null;
|
||||
previousLinkAborted = true;
|
||||
} else {
|
||||
//If can't abort
|
||||
// If can't abort
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
//In case submitting a form, don't attempt aborting
|
||||
// In case submitting a form, don't attempt aborting
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
AJAX.source = $(this);
|
||||
|
||||
$('html, body').animate({scrollTop: 0}, 'fast');
|
||||
$('html, body').animate({ scrollTop: 0 }, 'fast');
|
||||
|
||||
var url = isLink ? href : $(this).attr('action');
|
||||
var params = 'ajax_request=true&ajax_page_request=true';
|
||||
@ -281,21 +281,21 @@ var AJAX = {
|
||||
}
|
||||
|
||||
if (AJAX._debug) {
|
||||
console.log("Loading: " + url); // no need to translate
|
||||
console.log('Loading: ' + url); // no need to translate
|
||||
}
|
||||
|
||||
if (isLink) {
|
||||
AJAX.active = true;
|
||||
AJAX.$msgbox = PMA_ajaxShowMessage();
|
||||
//Save reference for the new link request
|
||||
// Save reference for the new link request
|
||||
AJAX.xhr = $.get(url, params, AJAX.responseHandler);
|
||||
if (history && history.pushState) {
|
||||
var state = {
|
||||
url : href
|
||||
};
|
||||
if (previousLinkAborted) {
|
||||
//hack: there is already an aborted entry on stack
|
||||
//so just modify the aborted one
|
||||
// hack: there is already an aborted entry on stack
|
||||
// so just modify the aborted one
|
||||
history.replaceState(state, null, href);
|
||||
} else {
|
||||
history.pushState(state, null, href);
|
||||
@ -339,8 +339,8 @@ var AJAX = {
|
||||
if (typeof data === 'undefined' || data === null) {
|
||||
return;
|
||||
}
|
||||
if (typeof data.success != 'undefined' && data.success) {
|
||||
$('html, body').animate({scrollTop: 0}, 'fast');
|
||||
if (typeof data.success !== 'undefined' && data.success) {
|
||||
$('html, body').animate({ scrollTop: 0 }, 'fast');
|
||||
PMA_ajaxRemoveMessage(AJAX.$msgbox);
|
||||
|
||||
if (data._redirect) {
|
||||
@ -376,8 +376,7 @@ var AJAX = {
|
||||
}
|
||||
if (data._disableNaviSettings) {
|
||||
PMA_disableNaviSettings();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PMA_ensureNaviSettings(data._selflink);
|
||||
}
|
||||
|
||||
@ -398,7 +397,7 @@ var AJAX = {
|
||||
// Replace #page_content with new content
|
||||
if (data.message && data.message.length > 0) {
|
||||
$('#page_content').replaceWith(
|
||||
"<div id='page_content'>" + data.message + "</div>"
|
||||
'<div id=\'page_content\'>' + data.message + '</div>'
|
||||
);
|
||||
PMA_highlightSQL($('#page_content'));
|
||||
checkNumberOfFields();
|
||||
@ -406,11 +405,11 @@ var AJAX = {
|
||||
|
||||
if (data._selflink) {
|
||||
var source = data._selflink.split('?')[0];
|
||||
//Check for faulty links
|
||||
// Check for faulty links
|
||||
$selflink_replace = {
|
||||
"import.php": "tbl_sql.php",
|
||||
"tbl_chart.php": "sql.php",
|
||||
"tbl_gis_visualization.php": "sql.php"
|
||||
'import.php': 'tbl_sql.php',
|
||||
'tbl_chart.php': 'sql.php',
|
||||
'tbl_gis_visualization.php': 'sql.php'
|
||||
};
|
||||
if ($selflink_replace[source]) {
|
||||
var replacement = $selflink_replace[source];
|
||||
@ -443,19 +442,19 @@ var AJAX = {
|
||||
$('#pma_errors').remove();
|
||||
|
||||
var msg = '';
|
||||
if(data._errSubmitMsg){
|
||||
if (data._errSubmitMsg) {
|
||||
msg = data._errSubmitMsg;
|
||||
}
|
||||
if (data._errors) {
|
||||
$('<div/>', {id : 'pma_errors', class : 'clearfloat'})
|
||||
$('<div/>', { id : 'pma_errors', class : 'clearfloat' })
|
||||
.insertAfter('#selflink')
|
||||
.append(data._errors);
|
||||
// bind for php error reporting forms (bottom)
|
||||
$("#pma_ignore_errors_bottom").on("click", function(e) {
|
||||
$('#pma_ignore_errors_bottom').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
PMA_ignorePhpErrors();
|
||||
});
|
||||
$("#pma_ignore_all_errors_bottom").on("click", function(e) {
|
||||
$('#pma_ignore_all_errors_bottom').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
PMA_ignorePhpErrors(false);
|
||||
});
|
||||
@ -464,22 +463,22 @@ var AJAX = {
|
||||
if (data._sendErrorAlways == '1' &&
|
||||
data._stopErrorReportLoop != '1'
|
||||
) {
|
||||
$("#pma_report_errors_form").submit();
|
||||
$('#pma_report_errors_form').submit();
|
||||
PMA_ajaxShowMessage(PMA_messages.phpErrorsBeingSubmitted, false);
|
||||
$('html, body').animate({scrollTop:$(document).height()}, 'slow');
|
||||
$('html, body').animate({ scrollTop:$(document).height() }, 'slow');
|
||||
} else if (data._promptPhpErrors) {
|
||||
// otherwise just prompt user if it is set so.
|
||||
msg = msg + PMA_messages.phpErrorsFound;
|
||||
// scroll to bottom where all the errors are displayed.
|
||||
$('html, body').animate({scrollTop:$(document).height()}, 'slow');
|
||||
$('html, body').animate({ scrollTop:$(document).height() }, 'slow');
|
||||
}
|
||||
}
|
||||
PMA_ajaxShowMessage(msg, false);
|
||||
// bind for php error reporting forms (popup)
|
||||
$("#pma_ignore_errors_popup").on("click", function() {
|
||||
$('#pma_ignore_errors_popup').on('click', function () {
|
||||
PMA_ignorePhpErrors();
|
||||
});
|
||||
$("#pma_ignore_all_errors_popup").on("click", function() {
|
||||
$('#pma_ignore_all_errors_popup').on('click', function () {
|
||||
PMA_ignorePhpErrors(false);
|
||||
});
|
||||
|
||||
@ -488,15 +487,14 @@ var AJAX = {
|
||||
}
|
||||
AJAX._callback = function () {};
|
||||
});
|
||||
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
AJAX.active = false;
|
||||
AJAX.xhr = null;
|
||||
PMA_handleRedirectAndReload(data);
|
||||
if (data.fieldWithError) {
|
||||
$(':input.error').removeClass("error");
|
||||
$('#'+data.fieldWithError).addClass("error");
|
||||
$(':input.error').removeClass('error');
|
||||
$('#' + data.fieldWithError).addClass('error');
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -577,7 +575,7 @@ var AJAX = {
|
||||
if ($.inArray(script, self._scripts) == -1) {
|
||||
needRequest = true;
|
||||
this.add(script);
|
||||
request.push("scripts%5B%5D=" + script);
|
||||
request.push('scripts%5B%5D=' + script);
|
||||
if (request.length >= 10) {
|
||||
// Download scripts in chunks
|
||||
this.appendScript(request);
|
||||
@ -586,8 +584,8 @@ var AJAX = {
|
||||
}
|
||||
}
|
||||
}
|
||||
request.push("call_done=1");
|
||||
request.push("v=" + encodeURIComponent(PMA_commonParams.get('PMA_VERSION')));
|
||||
request.push('call_done=1');
|
||||
request.push('v=' + encodeURIComponent(PMA_commonParams.get('PMA_VERSION')));
|
||||
// Download the composite js file, if necessary
|
||||
if (needRequest) {
|
||||
this.appendScript(request);
|
||||
@ -601,7 +599,7 @@ var AJAX = {
|
||||
* @return void
|
||||
*/
|
||||
done: function (callback) {
|
||||
if($.isFunction(callback)) {
|
||||
if ($.isFunction(callback)) {
|
||||
callback();
|
||||
}
|
||||
if (typeof ErrorReport !== 'undefined') {
|
||||
@ -621,10 +619,10 @@ var AJAX = {
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
var script = document.createElement('script');
|
||||
|
||||
request.push("call_done=1");
|
||||
request.push("v=" + encodeURIComponent(PMA_commonParams.get('PMA_VERSION')));
|
||||
request.push('call_done=1');
|
||||
request.push('v=' + encodeURIComponent(PMA_commonParams.get('PMA_VERSION')));
|
||||
script.type = 'text/javascript';
|
||||
script.src = "js/get_scripts.js.php?" + request.join("&");
|
||||
script.src = 'js/get_scripts.js.php?' + request.join('&');
|
||||
script.async = false;
|
||||
head.appendChild(script);
|
||||
},
|
||||
@ -677,7 +675,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
* Workaround for passing submit button name,value on ajax form submit
|
||||
* by appending hidden element with submit button name and value.
|
||||
*/
|
||||
$page_content.on('click', 'form input[type=submit]', function() {
|
||||
$page_content.on('click', 'form input[type=submit]', function () {
|
||||
var buttonName = $(this).attr('name');
|
||||
if (typeof buttonName === 'undefined') {
|
||||
return;
|
||||
@ -699,14 +697,14 @@ AJAX.registerOnload('functions.js', function () {
|
||||
'form.lock-page input[type="text"], ' +
|
||||
'form.lock-page input[type="number"], ' +
|
||||
'form.lock-page select',
|
||||
{value:1},
|
||||
{ value:1 },
|
||||
AJAX.lockPageHandler
|
||||
);
|
||||
$page_content.on(
|
||||
'change',
|
||||
'form.lock-page input[type="checkbox"], ' +
|
||||
'form.lock-page input[type="radio"]',
|
||||
{value:2},
|
||||
{ value:2 },
|
||||
AJAX.lockPageHandler
|
||||
);
|
||||
/**
|
||||
@ -714,7 +712,7 @@ AJAX.registerOnload('functions.js', function () {
|
||||
* Note: reset does not bubble in all browser so attach to
|
||||
* form directly.
|
||||
*/
|
||||
$('form.lock-page').on('reset', function(event){
|
||||
$('form.lock-page').on('reset', function (event) {
|
||||
AJAX.resetLock();
|
||||
});
|
||||
});
|
||||
@ -728,7 +726,7 @@ $(function () {
|
||||
.append($('#topmenucontainer').clone())
|
||||
.html();
|
||||
if (history && history.pushState) {
|
||||
//set initial state reload
|
||||
// set initial state reload
|
||||
var initState = ('state' in window.history && window.history.state !== null);
|
||||
var initURL = $('#selflink').find('> a').attr('href') || location.href;
|
||||
var state = {
|
||||
@ -737,10 +735,10 @@ $(function () {
|
||||
};
|
||||
history.replaceState(state, null);
|
||||
|
||||
$(window).on('popstate', function(event) {
|
||||
$(window).on('popstate', function (event) {
|
||||
var initPop = (! initState && location.href == initURL);
|
||||
initState = true;
|
||||
//check if popstate fired on first page itself
|
||||
// check if popstate fired on first page itself
|
||||
if (initPop) {
|
||||
return;
|
||||
}
|
||||
@ -750,17 +748,17 @@ $(function () {
|
||||
var params = 'ajax_request=true&ajax_page_request=true';
|
||||
var url = state.url || location.href;
|
||||
$.get(url, params, AJAX.responseHandler);
|
||||
//TODO: Check if sometimes menu is not retrieved from server,
|
||||
// TODO: Check if sometimes menu is not retrieved from server,
|
||||
// Not sure but it seems menu was missing only for printview which
|
||||
// been removed lately, so if it's right some dead menu checks/fallbacks
|
||||
// may need to be removed from this file and Header.php
|
||||
//AJAX.handleMenu.replace(event.originalEvent.state.menu);
|
||||
// AJAX.handleMenu.replace(event.originalEvent.state.menu);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Fallback to microhistory mechanism
|
||||
AJAX.scriptHandler
|
||||
.load([{'name' : 'microhistory.js', 'fire' : 1}], function () {
|
||||
.load([{ 'name' : 'microhistory.js', 'fire' : 1 }], function () {
|
||||
// The cache primer is set by the footer class
|
||||
if (PMA_MicroHistory.primer.url) {
|
||||
PMA_MicroHistory.menus.add(
|
||||
@ -800,7 +798,7 @@ $(document).ajaxError(function (event, request, settings) {
|
||||
}
|
||||
// Don't handle aborted requests
|
||||
if (request.status !== 0 || request.statusText !== 'abort') {
|
||||
var details = ''
|
||||
var details = '';
|
||||
var state = request.state();
|
||||
|
||||
if (request.status !== 0) {
|
||||
|
||||
48
js/chart.js
48
js/chart.js
@ -29,7 +29,7 @@ var ChartFactory = function () {
|
||||
};
|
||||
ChartFactory.prototype = {
|
||||
createChart : function (type, options) {
|
||||
throw new Error("createChart must be implemented by a subclass");
|
||||
throw new Error('createChart must be implemented by a subclass');
|
||||
}
|
||||
};
|
||||
|
||||
@ -44,16 +44,16 @@ var Chart = function (elementId) {
|
||||
};
|
||||
Chart.prototype = {
|
||||
draw : function (data, options) {
|
||||
throw new Error("draw must be implemented by a subclass");
|
||||
throw new Error('draw must be implemented by a subclass');
|
||||
},
|
||||
redraw : function (options) {
|
||||
throw new Error("redraw must be implemented by a subclass");
|
||||
throw new Error('redraw must be implemented by a subclass');
|
||||
},
|
||||
destroy : function () {
|
||||
throw new Error("destroy must be implemented by a subclass");
|
||||
throw new Error('destroy must be implemented by a subclass');
|
||||
},
|
||||
toImageString : function() {
|
||||
throw new Error("toImageString must be implemented by a subclass");
|
||||
toImageString : function () {
|
||||
throw new Error('toImageString must be implemented by a subclass');
|
||||
}
|
||||
};
|
||||
|
||||
@ -77,11 +77,11 @@ BaseChart.prototype.constructor = BaseChart;
|
||||
BaseChart.prototype.validateColumns = function (dataTable) {
|
||||
var columns = dataTable.getColumns();
|
||||
if (columns.length < 2) {
|
||||
throw new Error("Minimum of two columns are required for this chart");
|
||||
throw new Error('Minimum of two columns are required for this chart');
|
||||
}
|
||||
for (var i = 1; i < columns.length; i++) {
|
||||
if (columns[i].type != ColumnType.NUMBER) {
|
||||
throw new Error("Column " + (i + 1) + " should be of type 'Number'");
|
||||
throw new Error('Column ' + (i + 1) + ' should be of type \'Number\'');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -101,7 +101,7 @@ PieChart.prototype.constructor = PieChart;
|
||||
PieChart.prototype.validateColumns = function (dataTable) {
|
||||
var columns = dataTable.getColumns();
|
||||
if (columns.length > 2) {
|
||||
throw new Error("Pie charts can draw only one series");
|
||||
throw new Error('Pie charts can draw only one series');
|
||||
}
|
||||
return BaseChart.prototype.validateColumns.call(this, dataTable);
|
||||
};
|
||||
@ -122,7 +122,7 @@ TimelineChart.prototype.validateColumns = function (dataTable) {
|
||||
if (result) {
|
||||
var columns = dataTable.getColumns();
|
||||
if (columns[0].type != ColumnType.DATE) {
|
||||
throw new Error("First column of timeline chart need to be a date column");
|
||||
throw new Error('First column of timeline chart need to be a date column');
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -134,7 +134,7 @@ TimelineChart.prototype.validateColumns = function (dataTable) {
|
||||
* @param elementId
|
||||
* id of the div element the chart is drawn in
|
||||
*/
|
||||
var ScatterChart = function(elementId) {
|
||||
var ScatterChart = function (elementId) {
|
||||
BaseChart.call(this, elementId);
|
||||
};
|
||||
ScatterChart.prototype = new BaseChart();
|
||||
@ -144,7 +144,7 @@ ScatterChart.prototype.validateColumns = function (dataTable) {
|
||||
if (result) {
|
||||
var columns = dataTable.getColumns();
|
||||
if (columns[0].type != ColumnType.NUMBER) {
|
||||
throw new Error("First column of scatter chart need to be a numeric column");
|
||||
throw new Error('First column of scatter chart need to be a numeric column');
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -179,7 +179,7 @@ var DataTable = function () {
|
||||
|
||||
var fillMissingValues = function () {
|
||||
if (columns.length === 0) {
|
||||
throw new Error("Set columns first");
|
||||
throw new Error('Set columns first');
|
||||
}
|
||||
var row;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
@ -195,7 +195,7 @@ var DataTable = function () {
|
||||
};
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
/** *****************************************************************************
|
||||
* JQPlot specific code
|
||||
******************************************************************************/
|
||||
|
||||
@ -215,7 +215,7 @@ JQPlotChart.prototype.constructor = JQPlotChart;
|
||||
JQPlotChart.prototype.draw = function (data, options) {
|
||||
if (this.validator.validateColumns(data)) {
|
||||
this.plot = $.jqplot(this.elementId, this.prepareData(data), this
|
||||
.populateOptions(data, options));
|
||||
.populateOptions(data, options));
|
||||
}
|
||||
};
|
||||
JQPlotChart.prototype.destroy = function () {
|
||||
@ -234,10 +234,10 @@ JQPlotChart.prototype.toImageString = function (options) {
|
||||
}
|
||||
};
|
||||
JQPlotChart.prototype.populateOptions = function (dataTable, options) {
|
||||
throw new Error("populateOptions must be implemented by a subclass");
|
||||
throw new Error('populateOptions must be implemented by a subclass');
|
||||
};
|
||||
JQPlotChart.prototype.prepareData = function (dataTable) {
|
||||
throw new Error("prepareData must be implemented by a subclass");
|
||||
throw new Error('prepareData must be implemented by a subclass');
|
||||
};
|
||||
|
||||
/**
|
||||
@ -324,7 +324,7 @@ JQPlotSplineChart.prototype.constructor = JQPlotSplineChart;
|
||||
JQPlotSplineChart.prototype.populateOptions = function (dataTable, options) {
|
||||
var optional = {};
|
||||
var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable,
|
||||
options);
|
||||
options);
|
||||
var compulsory = {
|
||||
seriesDefaults : {
|
||||
rendererOptions : {
|
||||
@ -379,7 +379,7 @@ JQPlotScatterChart.prototype.populateOptions = function (dataTable, options) {
|
||||
showLine: false,
|
||||
markerOptions: {
|
||||
size: 7,
|
||||
style: "x"
|
||||
style: 'x'
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -481,7 +481,7 @@ JQPlotAreaChart.prototype.populateOptions = function (dataTable, options) {
|
||||
}
|
||||
};
|
||||
var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable,
|
||||
options);
|
||||
options);
|
||||
var compulsory = {
|
||||
seriesDefaults : {
|
||||
fill : true
|
||||
@ -510,7 +510,7 @@ JQPlotColumnChart.prototype.populateOptions = function (dataTable, options) {
|
||||
}
|
||||
};
|
||||
var opt = JQPlotLineChart.prototype.populateOptions.call(this, dataTable,
|
||||
options);
|
||||
options);
|
||||
var compulsory = {
|
||||
seriesDefaults : {
|
||||
renderer : $.jqplot.BarRenderer
|
||||
@ -612,7 +612,7 @@ JQPlotPieChart.prototype.populateOptions = function (dataTable, options) {
|
||||
seriesDefaults : {
|
||||
shadow: false,
|
||||
renderer : $.jqplot.PieRenderer,
|
||||
rendererOptions: {sliceMargin: 1, showDataLabels: true }
|
||||
rendererOptions: { sliceMargin: 1, showDataLabels: true }
|
||||
}
|
||||
};
|
||||
$.extend(true, optional, options, compulsory);
|
||||
@ -624,9 +624,9 @@ JQPlotPieChart.prototype.prepareData = function (dataTable) {
|
||||
var retData = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
row = data[i];
|
||||
retData.push([ row[0], row[1] ]);
|
||||
retData.push([row[0], row[1]]);
|
||||
}
|
||||
return [ retData ];
|
||||
return [retData];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
13
js/codemirror/addon/lint/sql-lint.js
vendored
13
js/codemirror/addon/lint/sql-lint.js
vendored
@ -1,12 +1,11 @@
|
||||
CodeMirror.sqlLint = function(text, updateLinting, options, cm) {
|
||||
|
||||
CodeMirror.sqlLint = function (text, updateLinting, options, cm) {
|
||||
// Skipping check if text box is empty.
|
||||
if(text.trim() == "") {
|
||||
if (text.trim() == '') {
|
||||
updateLinting(cm, []);
|
||||
return;
|
||||
}
|
||||
|
||||
function handleResponse(response) {
|
||||
function handleResponse (response) {
|
||||
var found = [];
|
||||
for (var idx in response) {
|
||||
found.push({
|
||||
@ -25,8 +24,8 @@ CodeMirror.sqlLint = function(text, updateLinting, options, cm) {
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "lint.php",
|
||||
method: 'POST',
|
||||
url: 'lint.php',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
sql_query: text,
|
||||
@ -36,4 +35,4 @@ CodeMirror.sqlLint = function(text, updateLinting, options, cm) {
|
||||
},
|
||||
success: handleResponse
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
127
js/common.js
127
js/common.js
@ -99,7 +99,7 @@ var PMA_commonParams = (function () {
|
||||
);
|
||||
}
|
||||
};
|
||||
})();
|
||||
}());
|
||||
|
||||
/**
|
||||
* Holds common parameters such as server, db, table, etc
|
||||
@ -118,7 +118,7 @@ var PMA_commonActions = {
|
||||
*/
|
||||
setDb: function (new_db) {
|
||||
if (new_db != PMA_commonParams.get('db')) {
|
||||
PMA_commonParams.setAll({'db': new_db, 'table': ''});
|
||||
PMA_commonParams.setAll({ 'db': new_db, 'table': '' });
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -150,7 +150,7 @@ var PMA_commonActions = {
|
||||
url = url.substring(0, url.indexOf('?'));
|
||||
}
|
||||
url += PMA_commonParams.getUrlQuery();
|
||||
$('<a />', {href: url})
|
||||
$('<a />', { href: url })
|
||||
.appendTo('body')
|
||||
.click()
|
||||
.remove();
|
||||
@ -190,17 +190,17 @@ PMA_DROP_IMPORT = {
|
||||
*
|
||||
* @return string, extension for valid extension, '' otherwise
|
||||
*/
|
||||
_getExtension: function(file) {
|
||||
_getExtension: function (file) {
|
||||
var arr = file.split('.');
|
||||
ext = arr[arr.length - 1];
|
||||
|
||||
//check if compressed
|
||||
// check if compressed
|
||||
if (jQuery.inArray(ext.toLowerCase(),
|
||||
PMA_DROP_IMPORT.allowedCompressedExtensions) !== -1) {
|
||||
ext = arr[arr.length - 2];
|
||||
}
|
||||
|
||||
//Now check for extension
|
||||
// Now check for extension
|
||||
if (jQuery.inArray(ext.toLowerCase(),
|
||||
PMA_DROP_IMPORT.allowedExtensions) !== -1) {
|
||||
return ext;
|
||||
@ -215,8 +215,8 @@ PMA_DROP_IMPORT = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
_setProgress: function(hash, percent) {
|
||||
$('.pma_sql_import_status div li[data-hash="' +hash +'"]')
|
||||
_setProgress: function (hash, percent) {
|
||||
$('.pma_sql_import_status div li[data-hash="' + hash + '"]')
|
||||
.children('progress').val(percent);
|
||||
},
|
||||
/**
|
||||
@ -227,33 +227,33 @@ PMA_DROP_IMPORT = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
_sendFileToServer: function(formData, hash) {
|
||||
var uploadURL ="./import.php"; //Upload URL
|
||||
var extraData ={};
|
||||
_sendFileToServer: function (formData, hash) {
|
||||
var uploadURL = './import.php'; // Upload URL
|
||||
var extraData = {};
|
||||
var jqXHR = $.ajax({
|
||||
xhr: function() {
|
||||
xhr: function () {
|
||||
var xhrobj = $.ajaxSettings.xhr();
|
||||
if (xhrobj.upload) {
|
||||
xhrobj.upload.addEventListener('progress', function(event) {
|
||||
xhrobj.upload.addEventListener('progress', function (event) {
|
||||
var percent = 0;
|
||||
var position = event.loaded || event.position;
|
||||
var total = event.total;
|
||||
if (event.lengthComputable) {
|
||||
percent = Math.ceil(position / total * 100);
|
||||
}
|
||||
//Set progress
|
||||
// Set progress
|
||||
PMA_DROP_IMPORT._setProgress(hash, percent);
|
||||
}, false);
|
||||
}
|
||||
return xhrobj;
|
||||
},
|
||||
url: uploadURL,
|
||||
type: "POST",
|
||||
type: 'POST',
|
||||
contentType:false,
|
||||
processData: false,
|
||||
cache: false,
|
||||
data: formData,
|
||||
success: function(data){
|
||||
success: function (data) {
|
||||
PMA_DROP_IMPORT._importFinished(hash, false, data.success);
|
||||
if (!data.success) {
|
||||
PMA_DROP_IMPORT.importStatus[PMA_DROP_IMPORT.importStatus.length] = {
|
||||
@ -273,26 +273,26 @@ PMA_DROP_IMPORT = {
|
||||
// -- add event listener to this link to abort upload operation
|
||||
$('.pma_sql_import_status div li[data-hash="' + hash +
|
||||
'"] span.filesize span.pma_drop_file_status')
|
||||
.on('click', function() {
|
||||
.on('click', function () {
|
||||
if ($(this).attr('task') === 'cancel') {
|
||||
jqXHR.abort();
|
||||
$(this).html('<span>' +PMA_messages.dropImportMessageAborted +'</span>');
|
||||
$(this).html('<span>' + PMA_messages.dropImportMessageAborted + '</span>');
|
||||
PMA_DROP_IMPORT._importFinished(hash, true, false);
|
||||
} else if ($(this).children("span").html() ===
|
||||
} else if ($(this).children('span').html() ===
|
||||
PMA_messages.dropImportMessageFailed) {
|
||||
// -- view information
|
||||
var $this = $(this);
|
||||
$.each( PMA_DROP_IMPORT.importStatus,
|
||||
function( key, value ) {
|
||||
if (value.hash === hash) {
|
||||
$(".pma_drop_result:visible").remove();
|
||||
var filename = $this.parent('span').attr('data-filename');
|
||||
$("body").append('<div class="pma_drop_result"><h2>' +
|
||||
$.each(PMA_DROP_IMPORT.importStatus,
|
||||
function (key, value) {
|
||||
if (value.hash === hash) {
|
||||
$('.pma_drop_result:visible').remove();
|
||||
var filename = $this.parent('span').attr('data-filename');
|
||||
$('body').append('<div class="pma_drop_result"><h2>' +
|
||||
PMA_messages.dropImportImportResultHeader + ' - ' +
|
||||
filename +'<span class="close">x</span></h2>' +value.message +'</div>');
|
||||
$(".pma_drop_result").draggable(); //to make this dialog draggable
|
||||
}
|
||||
});
|
||||
filename + '<span class="close">x</span></h2>' + value.message + '</div>');
|
||||
$('.pma_drop_result').draggable(); // to make this dialog draggable
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -304,10 +304,9 @@ PMA_DROP_IMPORT = {
|
||||
* @return void
|
||||
*/
|
||||
_dragenter : function (event) {
|
||||
|
||||
// We don't want to prevent users from using
|
||||
// browser's default drag-drop feature on some page(s)
|
||||
if ($(".noDragDrop").length !== 0) {
|
||||
if ($('.noDragDrop').length !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -317,11 +316,11 @@ PMA_DROP_IMPORT = {
|
||||
return;
|
||||
}
|
||||
if (PMA_commonParams.get('db') === '') {
|
||||
$(".pma_drop_handler").html(PMA_messages.dropImportSelectDB);
|
||||
$('.pma_drop_handler').html(PMA_messages.dropImportSelectDB);
|
||||
} else {
|
||||
$(".pma_drop_handler").html(PMA_messages.dropImportDropFiles);
|
||||
$('.pma_drop_handler').html(PMA_messages.dropImportDropFiles);
|
||||
}
|
||||
$(".pma_drop_handler").fadeIn();
|
||||
$('.pma_drop_handler').fadeIn();
|
||||
},
|
||||
/**
|
||||
* Check if dragged element contains Files
|
||||
@ -348,7 +347,7 @@ PMA_DROP_IMPORT = {
|
||||
_dragover: function (event) {
|
||||
// We don't want to prevent users from using
|
||||
// browser's default drag-drop feature on some page(s)
|
||||
if ($(".noDragDrop").length !== 0) {
|
||||
if ($('.noDragDrop').length !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -357,7 +356,7 @@ PMA_DROP_IMPORT = {
|
||||
if (!PMA_DROP_IMPORT._hasFiles(event)) {
|
||||
return;
|
||||
}
|
||||
$(".pma_drop_handler").fadeIn();
|
||||
$('.pma_drop_handler').fadeIn();
|
||||
},
|
||||
/**
|
||||
* Triggered when dragged objects are left
|
||||
@ -369,12 +368,12 @@ PMA_DROP_IMPORT = {
|
||||
_dragleave: function (event) {
|
||||
// We don't want to prevent users from using
|
||||
// browser's default drag-drop feature on some page(s)
|
||||
if ($(".noDragDrop").length !== 0) {
|
||||
if ($('.noDragDrop').length !== 0) {
|
||||
return;
|
||||
}
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
var $pma_drop_handler = $(".pma_drop_handler");
|
||||
var $pma_drop_handler = $('.pma_drop_handler');
|
||||
$pma_drop_handler.clearQueue().stop();
|
||||
$pma_drop_handler.fadeOut();
|
||||
$pma_drop_handler.html(PMA_messages.dropImportDropFiles);
|
||||
@ -388,20 +387,20 @@ PMA_DROP_IMPORT = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
_importFinished: function(hash, aborted, status) {
|
||||
$('.pma_sql_import_status div li[data-hash="' +hash +'"]')
|
||||
.children("progress").hide();
|
||||
_importFinished: function (hash, aborted, status) {
|
||||
$('.pma_sql_import_status div li[data-hash="' + hash + '"]')
|
||||
.children('progress').hide();
|
||||
var icon = 'icon ic_s_success';
|
||||
// -- provide link to view upload status
|
||||
if (!aborted) {
|
||||
if (status) {
|
||||
$('.pma_sql_import_status div li[data-hash="' + hash +
|
||||
'"] span.filesize span.pma_drop_file_status')
|
||||
.html('<span>' +PMA_messages.dropImportMessageSuccess +'</a>');
|
||||
.html('<span>' + PMA_messages.dropImportMessageSuccess + '</a>');
|
||||
} else {
|
||||
$('.pma_sql_import_status div li[data-hash="' + hash +
|
||||
'"] span.filesize span.pma_drop_file_status')
|
||||
.html('<span class="underline">' + PMA_messages.dropImportMessageFailed +
|
||||
.html('<span class="underline">' + PMA_messages.dropImportMessageFailed +
|
||||
'</a>');
|
||||
icon = 'icon ic_s_error';
|
||||
}
|
||||
@ -413,9 +412,9 @@ PMA_DROP_IMPORT = {
|
||||
.attr('task', 'info');
|
||||
|
||||
// Set icon
|
||||
$('.pma_sql_import_status div li[data-hash="' +hash +'"]')
|
||||
$('.pma_sql_import_status div li[data-hash="' + hash + '"]')
|
||||
.prepend('<img src="./themes/dot.gif" title="finished" class="' +
|
||||
icon +'"> ');
|
||||
icon + '"> ');
|
||||
|
||||
// Decrease liveUploadCount by one
|
||||
$('.pma_import_count').html(--PMA_DROP_IMPORT.liveUploadCount);
|
||||
@ -434,49 +433,49 @@ PMA_DROP_IMPORT = {
|
||||
_drop: function (event) {
|
||||
// We don't want to prevent users from using
|
||||
// browser's default drag-drop feature on some page(s)
|
||||
if ($(".noDragDrop").length !== 0) {
|
||||
if ($('.noDragDrop').length !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var dbname = PMA_commonParams.get('db');
|
||||
var server = PMA_commonParams.get('server');
|
||||
|
||||
//if no database is selected -- no
|
||||
// if no database is selected -- no
|
||||
if (dbname !== '') {
|
||||
var files = event.originalEvent.dataTransfer.files;
|
||||
if (!files || files.length === 0) {
|
||||
// No files actually transferred
|
||||
$(".pma_drop_handler").fadeOut();
|
||||
$('.pma_drop_handler').fadeOut();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
$(".pma_sql_import_status").slideDown();
|
||||
$('.pma_sql_import_status').slideDown();
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var ext = (PMA_DROP_IMPORT._getExtension(files[i].name));
|
||||
var hash = AJAX.hash(++PMA_DROP_IMPORT.uploadCount);
|
||||
|
||||
var $pma_sql_import_status_div = $(".pma_sql_import_status div");
|
||||
$pma_sql_import_status_div.append('<li data-hash="' +hash +'">' +
|
||||
var $pma_sql_import_status_div = $('.pma_sql_import_status div');
|
||||
$pma_sql_import_status_div.append('<li data-hash="' + hash + '">' +
|
||||
((ext !== '') ? '' : '<img src="./themes/dot.gif" title="invalid format" class="icon ic_s_notice"> ') +
|
||||
escapeHtml(files[i].name) + '<span class="filesize" data-filename="' +
|
||||
escapeHtml(files[i].name) +'">' +(files[i].size/1024).toFixed(2) +
|
||||
escapeHtml(files[i].name) + '">' + (files[i].size / 1024).toFixed(2) +
|
||||
' kb</span></li>');
|
||||
|
||||
//scroll the UI to bottom
|
||||
// scroll the UI to bottom
|
||||
$pma_sql_import_status_div.scrollTop(
|
||||
$pma_sql_import_status_div.scrollTop() + 50
|
||||
); //50 hardcoded for now
|
||||
); // 50 hardcoded for now
|
||||
|
||||
if (ext !== '') {
|
||||
// Increment liveUploadCount by one
|
||||
$('.pma_import_count').html(++PMA_DROP_IMPORT.liveUploadCount);
|
||||
$('.pma_sql_import_status h2 .close').fadeOut();
|
||||
|
||||
$('.pma_sql_import_status div li[data-hash="' +hash +'"]')
|
||||
$('.pma_sql_import_status div li[data-hash="' + hash + '"]')
|
||||
.append('<br><progress max="100" value="2"></progress>');
|
||||
|
||||
//uploading
|
||||
// uploading
|
||||
var fd = new FormData();
|
||||
fd.append('import_file', files[i]);
|
||||
fd.append('noplugin', Math.random().toString(36).substring(2, 12));
|
||||
@ -504,7 +503,7 @@ PMA_DROP_IMPORT = {
|
||||
}
|
||||
}
|
||||
}
|
||||
$(".pma_drop_handler").fadeOut();
|
||||
$('.pma_drop_handler').fadeOut();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
@ -520,31 +519,31 @@ $(document).on('dragenter', PMA_DROP_IMPORT._dragenter);
|
||||
$(document).on('dragover', PMA_DROP_IMPORT._dragover);
|
||||
$(document).on('dragleave', '.pma_drop_handler', PMA_DROP_IMPORT._dragleave);
|
||||
|
||||
//when file is dropped to PMA UI
|
||||
// when file is dropped to PMA UI
|
||||
$(document).on('drop', 'body', PMA_DROP_IMPORT._drop);
|
||||
|
||||
// minimizing-maximising the sql ajax upload status
|
||||
$(document).on('click', '.pma_sql_import_status h2 .minimize', function() {
|
||||
$(document).on('click', '.pma_sql_import_status h2 .minimize', function () {
|
||||
if ($(this).attr('toggle') === 'off') {
|
||||
$('.pma_sql_import_status div').css('height','270px');
|
||||
$(this).attr('toggle','on');
|
||||
$(this).html('-'); // to minimize
|
||||
} else {
|
||||
$('.pma_sql_import_status div').css("height","0px");
|
||||
$('.pma_sql_import_status div').css('height','0px');
|
||||
$(this).attr('toggle','off');
|
||||
$(this).html('+'); // to maximise
|
||||
}
|
||||
});
|
||||
|
||||
// closing sql ajax upload status
|
||||
$(document).on('click', '.pma_sql_import_status h2 .close', function() {
|
||||
$('.pma_sql_import_status').fadeOut(function() {
|
||||
$(document).on('click', '.pma_sql_import_status h2 .close', function () {
|
||||
$('.pma_sql_import_status').fadeOut(function () {
|
||||
$('.pma_sql_import_status div').html('');
|
||||
PMA_DROP_IMPORT.importStatus = []; //clear the message array
|
||||
PMA_DROP_IMPORT.importStatus = []; // clear the message array
|
||||
});
|
||||
});
|
||||
|
||||
// Closing the import result box
|
||||
$(document).on('click', '.pma_drop_result h2 .close', function(){
|
||||
$(document).on('click', '.pma_drop_result h2 .close', function () {
|
||||
$(this).parent('h2').parent('div').remove();
|
||||
});
|
||||
|
||||
125
js/config.js
125
js/config.js
@ -10,8 +10,7 @@
|
||||
*
|
||||
* @returns bool
|
||||
*/
|
||||
function isStorageSupported(type, warn)
|
||||
{
|
||||
function isStorageSupported (type, warn) {
|
||||
try {
|
||||
window[type].setItem('PMATest', 'test');
|
||||
// Check whether key-value pair was set successfully
|
||||
@ -20,7 +19,7 @@ function isStorageSupported(type, warn)
|
||||
window[type].removeItem('PMATest');
|
||||
return true;
|
||||
}
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
// Not supported
|
||||
if (warn) {
|
||||
PMA_ajaxShowMessage(PMA_messages.strNoLocalStorage, false);
|
||||
@ -56,8 +55,7 @@ var defaultValues = {};
|
||||
*
|
||||
* @param {Element} field
|
||||
*/
|
||||
function getFieldType(field)
|
||||
{
|
||||
function getFieldType (field) {
|
||||
var $field = $(field);
|
||||
var tagName = $field.prop('tagName');
|
||||
if (tagName == 'INPUT') {
|
||||
@ -76,8 +74,7 @@ function getFieldType(field)
|
||||
* @param {Element} field
|
||||
* @param {boolean} display
|
||||
*/
|
||||
function setRestoreDefaultBtn(field, display)
|
||||
{
|
||||
function setRestoreDefaultBtn (field, display) {
|
||||
var $el = $(field).closest('td').find('.restore-default img');
|
||||
$el[display ? 'show' : 'hide']();
|
||||
}
|
||||
@ -87,8 +84,7 @@ function setRestoreDefaultBtn(field, display)
|
||||
*
|
||||
* @param {Element} field
|
||||
*/
|
||||
function markField(field)
|
||||
{
|
||||
function markField (field) {
|
||||
var $field = $(field);
|
||||
var type = getFieldType($field);
|
||||
var isDefault = checkFieldDefault($field, type);
|
||||
@ -112,8 +108,7 @@ function markField(field)
|
||||
* @param {String} field_type see {@link #getFieldType}
|
||||
* @param {String|Boolean} [value]
|
||||
*/
|
||||
function setFieldValue(field, field_type, value)
|
||||
{
|
||||
function setFieldValue (field, field_type, value) {
|
||||
var $field = $(field);
|
||||
switch (field_type) {
|
||||
case 'text':
|
||||
@ -152,8 +147,7 @@ function setFieldValue(field, field_type, value)
|
||||
* @param {String} field_type returned by {@link #getFieldType}
|
||||
* @type Boolean|String|String[]
|
||||
*/
|
||||
function getFieldValue(field, field_type)
|
||||
{
|
||||
function getFieldValue (field, field_type) {
|
||||
var $field = $(field);
|
||||
switch (field_type) {
|
||||
case 'text':
|
||||
@ -177,15 +171,14 @@ function getFieldValue(field, field_type)
|
||||
/**
|
||||
* Returns values for all fields in fieldsets
|
||||
*/
|
||||
function getAllValues()
|
||||
{
|
||||
function getAllValues () {
|
||||
var $elements = $('fieldset input, fieldset select, fieldset textarea');
|
||||
var values = {};
|
||||
var type, value;
|
||||
for (var i = 0; i < $elements.length; i++) {
|
||||
type = getFieldType($elements[i]);
|
||||
value = getFieldValue($elements[i], type);
|
||||
if (typeof value != 'undefined') {
|
||||
if (typeof value !== 'undefined') {
|
||||
// we only have single selects, fatten array
|
||||
if (type == 'select') {
|
||||
value = value[0];
|
||||
@ -203,11 +196,10 @@ function getAllValues()
|
||||
* @param {String} type
|
||||
* @return boolean
|
||||
*/
|
||||
function checkFieldDefault(field, type)
|
||||
{
|
||||
function checkFieldDefault (field, type) {
|
||||
var $field = $(field);
|
||||
var field_id = $field.attr('id');
|
||||
if (typeof defaultValues[field_id] == 'undefined') {
|
||||
if (typeof defaultValues[field_id] === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
var isDefault = true;
|
||||
@ -218,8 +210,7 @@ function checkFieldDefault(field, type)
|
||||
// compare arrays, will work for our representation of select values
|
||||
if (currentValue.length != defaultValues[field_id].length) {
|
||||
isDefault = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (var i = 0; i < currentValue.length; i++) {
|
||||
if (currentValue[i] != defaultValues[field_id][i]) {
|
||||
isDefault = false;
|
||||
@ -235,8 +226,7 @@ function checkFieldDefault(field, type)
|
||||
* Returns element's id prefix
|
||||
* @param {Element} element
|
||||
*/
|
||||
function getIdPrefix(element)
|
||||
{
|
||||
function getIdPrefix (element) {
|
||||
return $(element).attr('id').replace(/[^-]+$/, '');
|
||||
}
|
||||
|
||||
@ -333,12 +323,11 @@ var validators = {
|
||||
* @param {boolean} onKeyUp whether fire on key up
|
||||
* @param {Array} params validation function parameters
|
||||
*/
|
||||
function validateField(id, type, onKeyUp, params)
|
||||
{
|
||||
if (typeof validators[type] == 'undefined') {
|
||||
function validateField (id, type, onKeyUp, params) {
|
||||
if (typeof validators[type] === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (typeof validate[id] == 'undefined') {
|
||||
if (typeof validate[id] === 'undefined') {
|
||||
validate[id] = [];
|
||||
}
|
||||
validate[id].push([type, params, onKeyUp]);
|
||||
@ -352,17 +341,16 @@ function validateField(id, type, onKeyUp, params)
|
||||
* @type Array
|
||||
* @return array of [function, parameters to be passed to function]
|
||||
*/
|
||||
function getFieldValidators(field_id, onKeyUpOnly)
|
||||
{
|
||||
function getFieldValidators (field_id, onKeyUpOnly) {
|
||||
// look for field bound validator
|
||||
var name = field_id && field_id.match(/[^-]+$/)[0];
|
||||
if (typeof validators._field[name] != 'undefined') {
|
||||
if (typeof validators._field[name] !== 'undefined') {
|
||||
return [[validators._field[name], null]];
|
||||
}
|
||||
|
||||
// look for registered validators
|
||||
var functions = [];
|
||||
if (typeof validate[field_id] != 'undefined') {
|
||||
if (typeof validate[field_id] !== 'undefined') {
|
||||
// validate[field_id]: array of [type, params, onKeyUp]
|
||||
for (var i = 0, imax = validate[field_id].length; i < imax; i++) {
|
||||
if (onKeyUpOnly && !validate[field_id][i][2]) {
|
||||
@ -383,8 +371,7 @@ function getFieldValidators(field_id, onKeyUpOnly)
|
||||
*
|
||||
* @param {Object} error_list list of errors in the form {field id: error array}
|
||||
*/
|
||||
function displayErrors(error_list)
|
||||
{
|
||||
function displayErrors (error_list) {
|
||||
var tempIsEmpty = function (item) {
|
||||
return item !== '';
|
||||
};
|
||||
@ -441,16 +428,15 @@ function displayErrors(error_list)
|
||||
* @param {boolean} isKeyUp
|
||||
* @param {Object} errors
|
||||
*/
|
||||
function validate_fieldset(fieldset, isKeyUp, errors)
|
||||
{
|
||||
function validate_fieldset (fieldset, isKeyUp, errors) {
|
||||
var $fieldset = $(fieldset);
|
||||
if ($fieldset.length && typeof validators._fieldset[$fieldset.attr('id')] != 'undefined') {
|
||||
if ($fieldset.length && typeof validators._fieldset[$fieldset.attr('id')] !== 'undefined') {
|
||||
var fieldset_errors = validators._fieldset[$fieldset.attr('id')].apply($fieldset[0], [isKeyUp]);
|
||||
for (var field_id in fieldset_errors) {
|
||||
if (typeof errors[field_id] == 'undefined') {
|
||||
if (typeof errors[field_id] === 'undefined') {
|
||||
errors[field_id] = [];
|
||||
}
|
||||
if (typeof fieldset_errors[field_id] == 'string') {
|
||||
if (typeof fieldset_errors[field_id] === 'string') {
|
||||
fieldset_errors[field_id] = [fieldset_errors[field_id]];
|
||||
}
|
||||
$.merge(errors[field_id], fieldset_errors[field_id]);
|
||||
@ -465,8 +451,7 @@ function validate_fieldset(fieldset, isKeyUp, errors)
|
||||
* @param {boolean} isKeyUp
|
||||
* @param {Object} errors
|
||||
*/
|
||||
function validate_field(field, isKeyUp, errors)
|
||||
{
|
||||
function validate_field (field, isKeyUp, errors) {
|
||||
var args, result;
|
||||
var $field = $(field);
|
||||
var field_id = $field.attr('id');
|
||||
@ -481,7 +466,7 @@ function validate_field(field, isKeyUp, errors)
|
||||
args.unshift(isKeyUp);
|
||||
result = functions[i][0].apply($field[0], args);
|
||||
if (result !== true) {
|
||||
if (typeof result == 'string') {
|
||||
if (typeof result === 'string') {
|
||||
result = [result];
|
||||
}
|
||||
$.merge(errors[field_id], result);
|
||||
@ -495,8 +480,7 @@ function validate_field(field, isKeyUp, errors)
|
||||
* @param {Element} field
|
||||
* @param {boolean} isKeyUp
|
||||
*/
|
||||
function validate_field_and_fieldset(field, isKeyUp)
|
||||
{
|
||||
function validate_field_and_fieldset (field, isKeyUp) {
|
||||
var $field = $(field);
|
||||
var errors = {};
|
||||
validate_field($field, isKeyUp, errors);
|
||||
@ -504,7 +488,7 @@ function validate_field_and_fieldset(field, isKeyUp)
|
||||
displayErrors(errors);
|
||||
}
|
||||
|
||||
function loadInlineConfig() {
|
||||
function loadInlineConfig () {
|
||||
if (!Array.isArray(configInlineParams)) {
|
||||
return;
|
||||
}
|
||||
@ -515,10 +499,10 @@ function loadInlineConfig() {
|
||||
}
|
||||
}
|
||||
|
||||
function setupValidation() {
|
||||
function setupValidation () {
|
||||
validate = {};
|
||||
configScriptLoaded = true;
|
||||
if (configScriptLoaded && typeof configInlineParams !== "undefined") {
|
||||
if (configScriptLoaded && typeof configInlineParams !== 'undefined') {
|
||||
loadInlineConfig();
|
||||
}
|
||||
// register validators and mark custom values
|
||||
@ -581,9 +565,8 @@ AJAX.registerOnload('config.js', function () {
|
||||
*
|
||||
* @param {String} tab_id
|
||||
*/
|
||||
function setTab(tab_id)
|
||||
{
|
||||
$('ul.tabs').each(function() {
|
||||
function setTab (tab_id) {
|
||||
$('ul.tabs').each(function () {
|
||||
var $this = $(this);
|
||||
if (!$this.find('li a[href="#' + tab_id + '"]').length) {
|
||||
return;
|
||||
@ -596,9 +579,9 @@ function setTab(tab_id)
|
||||
});
|
||||
}
|
||||
|
||||
function setupConfigTabs() {
|
||||
function setupConfigTabs () {
|
||||
var forms = $('form.config-form');
|
||||
forms.each(function() {
|
||||
forms.each(function () {
|
||||
var $this = $(this);
|
||||
var $tabs = $this.find('ul.tabs');
|
||||
if (!$tabs.length) {
|
||||
@ -618,14 +601,14 @@ function setupConfigTabs() {
|
||||
});
|
||||
}
|
||||
|
||||
function adjustPrefsNotification() {
|
||||
var $prefsAutoLoad = $('#prefs_autoload');
|
||||
var $tableNameControl = $('#table_name_col_no');
|
||||
var $prefsAutoShowing = ($prefsAutoLoad.css('display') !== 'none');
|
||||
function adjustPrefsNotification () {
|
||||
var $prefsAutoLoad = $('#prefs_autoload');
|
||||
var $tableNameControl = $('#table_name_col_no');
|
||||
var $prefsAutoShowing = ($prefsAutoLoad.css('display') !== 'none');
|
||||
|
||||
if ($prefsAutoShowing && $tableNameControl.length) {
|
||||
if ($prefsAutoShowing && $tableNameControl.length) {
|
||||
$tableNameControl.css('top', '120px');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AJAX.registerOnload('config.js', function () {
|
||||
@ -681,8 +664,7 @@ AJAX.registerOnload('config.js', function () {
|
||||
*
|
||||
* @param {String} field_id
|
||||
*/
|
||||
function restoreField(field_id)
|
||||
{
|
||||
function restoreField (field_id) {
|
||||
var $field = $('#' + field_id);
|
||||
if ($field.length === 0 || defaultValues[field_id] === undefined) {
|
||||
return;
|
||||
@ -690,7 +672,7 @@ function restoreField(field_id)
|
||||
setFieldValue($field, getFieldType($field), defaultValues[field_id]);
|
||||
}
|
||||
|
||||
function setupRestoreField() {
|
||||
function setupRestoreField () {
|
||||
$('div.tabs_contents')
|
||||
.on('mouseenter', '.restore-default, .set-value', function () {
|
||||
$(this).css('opacity', 1);
|
||||
@ -714,7 +696,7 @@ function setupRestoreField() {
|
||||
})
|
||||
.find('.restore-default, .set-value')
|
||||
// inline-block for IE so opacity inheritance works
|
||||
.css({display: 'inline-block', opacity: 0.25});
|
||||
.css({ display: 'inline-block', opacity: 0.25 });
|
||||
}
|
||||
|
||||
AJAX.registerOnload('config.js', function () {
|
||||
@ -767,7 +749,7 @@ AJAX.registerOnload('config.js', function () {
|
||||
disabled = $form.find('input[type=radio][value$=local_storage]').prop('checked');
|
||||
} else if (!ls_exists && $form.attr('name') == 'prefs_import' &&
|
||||
$('#import_local_storage')[0].checked
|
||||
) {
|
||||
) {
|
||||
disabled = true;
|
||||
}
|
||||
$form.find('input[type=submit]').prop('disabled', disabled);
|
||||
@ -785,11 +767,11 @@ AJAX.registerOnload('config.js', function () {
|
||||
|
||||
$(document).on('click', 'div.click-hide-message', function () {
|
||||
$(this)
|
||||
.hide()
|
||||
.parent('.group')
|
||||
.css('height', '')
|
||||
.next('form')
|
||||
.show();
|
||||
.hide()
|
||||
.parent('.group')
|
||||
.css('height', '')
|
||||
.next('form')
|
||||
.show();
|
||||
});
|
||||
});
|
||||
|
||||
@ -798,8 +780,7 @@ AJAX.registerOnload('config.js', function () {
|
||||
*
|
||||
* @param {Element} form
|
||||
*/
|
||||
function savePrefsToLocalStorage(form)
|
||||
{
|
||||
function savePrefsToLocalStorage (form) {
|
||||
$form = $(form);
|
||||
var submit = $form.find('input[type=submit]');
|
||||
submit.prop('disabled', true);
|
||||
@ -837,8 +818,7 @@ function savePrefsToLocalStorage(form)
|
||||
/**
|
||||
* Updates preferences timestamp in Import form
|
||||
*/
|
||||
function updatePrefsDate()
|
||||
{
|
||||
function updatePrefsDate () {
|
||||
var d = new Date(window.localStorage.config_mtime_local);
|
||||
var msg = PMA_messages.strSavedOn.replace(
|
||||
'@DATE@',
|
||||
@ -850,8 +830,7 @@ function updatePrefsDate()
|
||||
/**
|
||||
* Prepares message which informs that localStorage preferences are available and can be imported or deleted
|
||||
*/
|
||||
function offerPrefsAutoimport()
|
||||
{
|
||||
function offerPrefsAutoimport () {
|
||||
var has_config = (isStorageSupported('localStorage')) && (window.localStorage.config || false);
|
||||
var $cnt = $('#prefs_autoload');
|
||||
if (!$cnt.length || !has_config) {
|
||||
|
||||
505
js/console.js
505
js/console.js
File diff suppressed because it is too large
Load Diff
@ -3,10 +3,10 @@
|
||||
* Conditionally included if framing is not allowed
|
||||
*/
|
||||
if (self == top) {
|
||||
var style_element = document.getElementById("cfs-style");
|
||||
var style_element = document.getElementById('cfs-style');
|
||||
// check if style_element has already been removed
|
||||
// to avoid frequently reported js error
|
||||
if (typeof(style_element) != 'undefined' && style_element != null) {
|
||||
if (typeof(style_element) !== 'undefined' && style_element != null) {
|
||||
style_element.parentNode.removeChild(style_element);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -17,20 +17,20 @@
|
||||
*/
|
||||
|
||||
AJAX.registerTeardown('db_central_columns.js', function () {
|
||||
$(".edit").off('click');
|
||||
$(".edit_save_form").off('click');
|
||||
$('.edit').off('click');
|
||||
$('.edit_save_form').off('click');
|
||||
$('.edit_cancel_form').off('click');
|
||||
$(".del_row").off('click');
|
||||
$(document).off("keyup", ".filter_rows");
|
||||
$('.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_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');
|
||||
$('select.default_type').off('change');
|
||||
$('button[name=\'delete_central_columns\']').off('click');
|
||||
$('button[name=\'edit_central_columns\']').off('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('db_central_columns.js', function () {
|
||||
@ -38,111 +38,111 @@ AJAX.registerOnload('db_central_columns.js', function () {
|
||||
$('#tableslistcontainer').find('.checkall').show();
|
||||
$('#tableslistcontainer').find('.checkall_box').show();
|
||||
if ($('#table_columns').find('tbody tr').length > 0) {
|
||||
$("#table_columns").tablesorter({
|
||||
$('#table_columns').tablesorter({
|
||||
headers: {
|
||||
0: {sorter: false},
|
||||
1: {sorter: false}, // hidden column
|
||||
4: {sorter: "integer"}
|
||||
0: { sorter: false },
|
||||
1: { sorter: false }, // hidden column
|
||||
4: { sorter: 'integer' }
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#tableslistcontainer').find('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 === ''){
|
||||
if (multi_delete_columns === '') {
|
||||
PMA_ajaxShowMessage(PMA_messages.strRadioUnchecked);
|
||||
return false;
|
||||
}
|
||||
PMA_ajaxShowMessage();
|
||||
$("#del_col_name").val(multi_delete_columns);
|
||||
$("#del_form").submit();
|
||||
$('#del_col_name').val(multi_delete_columns);
|
||||
$('#del_form').submit();
|
||||
});
|
||||
$('#tableslistcontainer').find('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 === ''){
|
||||
if (editColumnList === '') {
|
||||
PMA_ajaxShowMessage(PMA_messages.strRadioUnchecked);
|
||||
return false;
|
||||
}
|
||||
var editColumnData = editColumnList+ '&edit_central_columns_page=true&ajax_request=true&ajax_page_request=true&db='+PMA_commonParams.get('db');
|
||||
var editColumnData = editColumnList + '&edit_central_columns_page=true&ajax_request=true&ajax_page_request=true&db=' + PMA_commonParams.get('db');
|
||||
PMA_ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.get('db_central_columns.php', editColumnData, AJAX.responseHandler);
|
||||
});
|
||||
$('#multi_edit_central_columns').submit(function(event){
|
||||
$('#multi_edit_central_columns').submit(function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var multi_column_edit_data = $("#multi_edit_central_columns").serialize()+'&multi_edit_central_column_save=true&ajax_request=true&ajax_page_request=true&db='+encodeURIComponent(PMA_commonParams.get('db'));
|
||||
var multi_column_edit_data = $('#multi_edit_central_columns').serialize() + '&multi_edit_central_column_save=true&ajax_request=true&ajax_page_request=true&db=' + encodeURIComponent(PMA_commonParams.get('db'));
|
||||
PMA_ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.post('db_central_columns.php', multi_column_edit_data, AJAX.responseHandler);
|
||||
});
|
||||
$('#add_new').find('td').each(function(){
|
||||
$('#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');
|
||||
$('#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 () {
|
||||
$(document).on('keyup', '.filter_rows', function () {
|
||||
// get the column names
|
||||
var cols = $('th.column_heading').map(function () {
|
||||
return $.trim($(this).text());
|
||||
}).get();
|
||||
$.uiTableFilter($("#table_columns"), $(this).val(), cols, null, "td span");
|
||||
$.uiTableFilter($('#table_columns'), $(this).val(), cols, null, 'td span');
|
||||
});
|
||||
$('.edit').click(function() {
|
||||
$('.edit').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 attribute_val = $('#f_' + rownum + ' td[name=col_attribute] span').html();
|
||||
$('#f_' + rownum + ' select[name=field_attribute\\['+ rownum +'\\] ] option[value="' + attribute_val + '"]').attr("selected","selected");
|
||||
if($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') {
|
||||
$('#f_' + rownum + ' select[name=field_attribute\\[' + rownum + '\\] ] option[value="' + attribute_val + '"]').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").click(function (event) {
|
||||
$('.del_row').click(function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var $td = $(this);
|
||||
var question = PMA_messages.strDeleteCentralColumnWarning;
|
||||
$td.PMA_confirm(question, null, function (url) {
|
||||
var rownum = $td.data('rownum');
|
||||
$("#del_col_name").val("selected_fld%5B%5D="+$('#checkbox_row_' + rownum ).val());
|
||||
$("#del_form").submit();
|
||||
$('#del_col_name').val('selected_fld%5B%5D=' + $('#checkbox_row_' + rownum).val());
|
||||
$('#del_form').submit();
|
||||
});
|
||||
});
|
||||
$('.edit_cancel_form').click(function(event) {
|
||||
$('.edit_cancel_form').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();
|
||||
$('#f_' + rownum + ' input, #f_' + rownum + ' select,#f_' + rownum + ' .default_value, #f_' + rownum + ' .open_enum_editor').hide();
|
||||
$('#tableslistcontainer').find('.checkall').show();
|
||||
});
|
||||
$('.edit_save_form').click(function(event) {
|
||||
$('.edit_save_form').click(function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var rownum = $(this).data('rownum');
|
||||
$('#f_' + rownum + ' td').each(function() {
|
||||
$('#f_' + rownum + ' td').each(function () {
|
||||
if ($(this).attr('name') !== 'undefined') {
|
||||
$(this).find(':input[type!="hidden"],select:first')
|
||||
.attr('name', $(this).attr('name'));
|
||||
.attr('name', $(this).attr('name'));
|
||||
}
|
||||
});
|
||||
|
||||
if($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') {
|
||||
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');
|
||||
@ -150,11 +150,11 @@ AJAX.registerOnload('db_central_columns.js', function () {
|
||||
|
||||
var datastring = $('#f_' + rownum + ' :input').serialize();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "db_central_columns.php",
|
||||
data: datastring+'&ajax_request=true',
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
type: 'POST',
|
||||
url: 'db_central_columns.php',
|
||||
data: datastring + '&ajax_request=true',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if (data.message !== '1') {
|
||||
PMA_ajaxShowMessage(
|
||||
'<div class="error">' +
|
||||
@ -168,8 +168,8 @@ AJAX.registerOnload('db_central_columns.js', function () {
|
||||
$('#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_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();
|
||||
@ -178,20 +178,20 @@ AJAX.registerOnload('db_central_columns.js', function () {
|
||||
$('#f_' + rownum + ' input, #f_' + rownum + ' select,#f_' + rownum + ' .default_value, #f_' + rownum + ' .open_enum_editor').hide();
|
||||
$('#tableslistcontainer').find('.checkall').show();
|
||||
},
|
||||
error: function() {
|
||||
PMA_ajaxShowMessage(
|
||||
'<div class="error">' +
|
||||
error: function () {
|
||||
PMA_ajaxShowMessage(
|
||||
'<div class="error">' +
|
||||
PMA_messages.strErrorProcessingRequest +
|
||||
'</div>',
|
||||
false
|
||||
);
|
||||
}
|
||||
false
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#table-select').change(function(e) {
|
||||
$('#table-select').change(function (e) {
|
||||
var selectvalue = $(this).val();
|
||||
var default_column_select = $('#column-select').find('option:first');
|
||||
var href = "db_central_columns.php";
|
||||
var href = 'db_central_columns.php';
|
||||
var params = {
|
||||
'ajax_request' : true,
|
||||
'server' : PMA_commonParams.get('server'),
|
||||
@ -200,32 +200,32 @@ AJAX.registerOnload('db_central_columns.js', function () {
|
||||
'populateColumns' : true
|
||||
};
|
||||
$('#column-select').html('<option value="">' + PMA_messages.strLoading + '</option>');
|
||||
if (selectvalue !== "") {
|
||||
if (selectvalue !== '') {
|
||||
$.post(href, params, function (data) {
|
||||
$('#column-select').empty().append(default_column_select);
|
||||
$('#column-select').append(data.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
$('#column-select').change(function(e) {
|
||||
$('#column-select').change(function (e) {
|
||||
var selectvalue = $(this).val();
|
||||
if (selectvalue !== "") {
|
||||
$("#add_column").submit();
|
||||
if (selectvalue !== '') {
|
||||
$('#add_column').submit();
|
||||
}
|
||||
});
|
||||
$("#add_col_div").find(">a").click(function(event){
|
||||
$('#add_new').slideToggle("slow");
|
||||
var $addColDivLinkSpan = $("#add_col_div").find(">a span");
|
||||
if($addColDivLinkSpan.html() === '+') {
|
||||
$('#add_col_div').find('>a').click(function (event) {
|
||||
$('#add_new').slideToggle('slow');
|
||||
var $addColDivLinkSpan = $('#add_col_div').find('>a span');
|
||||
if ($addColDivLinkSpan.html() === '+') {
|
||||
$addColDivLinkSpan.html('-');
|
||||
} else {
|
||||
$addColDivLinkSpan.html('+');
|
||||
}
|
||||
});
|
||||
$('#add_new').submit(function(event){
|
||||
$('#add_new').submit(function (event) {
|
||||
$('#add_new').toggle();
|
||||
});
|
||||
$("#tableslistcontainer").find("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');
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('db_multi_table_query.js', function () {
|
||||
$('.tableNameSelect').each(function(){
|
||||
$('.tableNameSelect').each(function () {
|
||||
$(this).off('change');
|
||||
});
|
||||
$('#update_query_button').off('click');
|
||||
@ -25,7 +25,6 @@ AJAX.registerTeardown('db_multi_table_query.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
|
||||
var editor = PMA_getSQLEditor($('#MultiSqlquery'), {}, 'both');
|
||||
$('.CodeMirror-line').css('text-align', 'left');
|
||||
editor.setSize(-1, 50);
|
||||
@ -34,25 +33,24 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
PMA_init_slider();
|
||||
addNewColumnCallbacks();
|
||||
|
||||
function escapeBacktick(s) {
|
||||
function escapeBacktick (s) {
|
||||
return s.replace('`', '``');
|
||||
}
|
||||
|
||||
function escapeSingleQuote(s) {
|
||||
function escapeSingleQuote (s) {
|
||||
return s.replace('\\', '\\\\').replace('\'', '\\\'');
|
||||
}
|
||||
|
||||
$('#update_query_button').on('click', function() {
|
||||
$('#update_query_button').on('click', function () {
|
||||
var columns = [];
|
||||
var table_aliases = {};
|
||||
$('.tableNameSelect').each(function() {
|
||||
$('.tableNameSelect').each(function () {
|
||||
$show = $(this).siblings('.show_col').first();
|
||||
if ($(this).val() !== "" && $show.prop('checked')) {
|
||||
|
||||
if ($(this).val() !== '' && $show.prop('checked')) {
|
||||
var table_alias = $(this).siblings('.table_alias').first().val();
|
||||
var column_alias = $(this).siblings('.col_alias').first().val();
|
||||
|
||||
if (table_alias !== "") {
|
||||
if (table_alias !== '') {
|
||||
columns.push([table_alias, $(this).siblings('.columnNameSelect').first().val()]);
|
||||
} else {
|
||||
columns.push([$(this).val(), $(this).siblings('.columnNameSelect').first().val()]);
|
||||
@ -76,12 +74,12 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
|
||||
query = 'SELECT ';
|
||||
query += '`' + escapeBacktick(columns[0][0]) + '`.`' + escapeBacktick(columns[0][1]) + '`';
|
||||
if (columns[0][2] !== "") {
|
||||
if (columns[0][2] !== '') {
|
||||
query += ' AS ' + columns[0][2];
|
||||
}
|
||||
for (var i = 1; i < columns.length; i++) {
|
||||
query += ', `' + escapeBacktick(columns[i][0]) + '`.`' + escapeBacktick(columns[i][1]) + '`';
|
||||
if (columns[i][2] !== "") {
|
||||
if (columns[i][2] !== '') {
|
||||
query += ' AS `' + escapeBacktick(columns[0][2]) + '`';
|
||||
}
|
||||
}
|
||||
@ -92,8 +90,8 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
if (table_count > 0) {
|
||||
query += ', ';
|
||||
}
|
||||
query += '`' + escapeBacktick(table) + '`'
|
||||
if (table_aliases[table][i] !== "") {
|
||||
query += '`' + escapeBacktick(table) + '`';
|
||||
if (table_aliases[table][i] !== '') {
|
||||
query += ' AS `' + escapeBacktick(table_aliases[table][i]) + '`';
|
||||
}
|
||||
table_count++;
|
||||
@ -108,42 +106,41 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
|
||||
var count = 0;
|
||||
|
||||
$('.tableNameSelect').each(function() {
|
||||
$('.tableNameSelect').each(function () {
|
||||
$criteria_div = $(this).siblings('.slide-wrapper').first();
|
||||
$use_criteria = $(this).siblings('.criteria_col').first();
|
||||
if ($(this).val() !== "" && $use_criteria.prop('checked')) {
|
||||
if ($(this).val() !== '' && $use_criteria.prop('checked')) {
|
||||
if (count > 0) {
|
||||
$criteria_div.find('input.logical_op').each(function(){
|
||||
$criteria_div.find('input.logical_op').each(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
query += ' ' + $(this).val() + ' ';
|
||||
}
|
||||
});
|
||||
}
|
||||
formats_text = {
|
||||
'=' : " = '%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'"
|
||||
}
|
||||
'=' : ' = \'%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\''
|
||||
};
|
||||
query += '`' + escapeBacktick($(this).val()) + '`.';
|
||||
query += '`' + escapeBacktick($(this).siblings('.columnNameSelect').first().val()) + '`';
|
||||
if ($criteria_div.find('.criteria_rhs').first().val() === 'text') {
|
||||
// query += " '" + $criteria_div.find('.rhs_text_val').first().val() + "'";
|
||||
query += sprintf(formats_text[$criteria_div.find('.criteria_op').first().val()], escapeSingleQuote($criteria_div.find('.rhs_text_val').first().val()));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
query += ' ' + $criteria_div.find('.criteria_op').first().val();
|
||||
query += ' `' + escapeBacktick($criteria_div.find('.tableNameSelect').first().val()) + '`.';
|
||||
query += '`' + escapeBacktick($criteria_div.find('.columnNameSelect').first().val()) + '`';
|
||||
@ -155,10 +152,9 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
|
||||
query += ';';
|
||||
editor.getDoc().setValue(query);
|
||||
|
||||
});
|
||||
|
||||
$('#submit_query').on('click', function() {
|
||||
$('#submit_query').on('click', function () {
|
||||
var query = editor.getDoc().getValue();
|
||||
var data = {
|
||||
'db': $('#db_name').val(),
|
||||
@ -167,18 +163,18 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
'token': PMA_commonParams.get('token')
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "db_multi_table_query.php",
|
||||
type: 'POST',
|
||||
url: 'db_multi_table_query.php',
|
||||
data: data,
|
||||
success: function(data) {
|
||||
success: function (data) {
|
||||
$results_dom = $(data.message);
|
||||
$results_dom.find('.ajax:not(.pageselector)').each(function() {
|
||||
$(this).on('click', function(event) {
|
||||
$results_dom.find('.ajax:not(.pageselector)').each(function () {
|
||||
$(this).on('click', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
$results_dom.find('.autosubmit, .pageselector, .showAllRows, .filter_rows').each(function() {
|
||||
$(this).on('change click select focus', function(event) {
|
||||
$results_dom.find('.autosubmit, .pageselector, .showAllRows, .filter_rows').each(function () {
|
||||
$(this).on('change click select focus', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
@ -188,7 +184,7 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
});
|
||||
});
|
||||
|
||||
$('#add_column_button').on('click', function() {
|
||||
$('#add_column_button').on('click', function () {
|
||||
column_count++;
|
||||
$new_column_dom = $($('#new_column_layout').html()).clone();
|
||||
$new_column_dom.find('div').first().find('div').first().attr('id', column_count.toString());
|
||||
@ -200,24 +196,25 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
addNewColumnCallbacks();
|
||||
});
|
||||
|
||||
function addNewColumnCallbacks() {
|
||||
$('.tableNameSelect').each(function(){
|
||||
$(this).on('change', function() {
|
||||
function addNewColumnCallbacks () {
|
||||
$('.tableNameSelect').each(function () {
|
||||
$(this).on('change', function () {
|
||||
$sibs = $(this).siblings('.columnNameSelect');
|
||||
if ($sibs.length === 0)
|
||||
if ($sibs.length === 0) {
|
||||
$sibs = $(this).parent().parent().find('.columnNameSelect');
|
||||
}
|
||||
$sibs.first().html($('#' + $.md5($(this).val())).html());
|
||||
});
|
||||
});
|
||||
|
||||
$('.removeColumn').each(function() {
|
||||
$(this).on('click', function() {
|
||||
$('.removeColumn').each(function () {
|
||||
$(this).on('click', function () {
|
||||
$(this).parent().remove();
|
||||
});
|
||||
});
|
||||
|
||||
$('a.ajax').each(function() {
|
||||
$(this).on('click', function(event, from) {
|
||||
$('a.ajax').each(function () {
|
||||
$(this).on('click', function (event, from) {
|
||||
if (from === null) {
|
||||
$checkbox = $(this).siblings('.criteria_col').first();
|
||||
$checkbox.prop('checked', !$checkbox.prop('checked'));
|
||||
@ -229,15 +226,15 @@ AJAX.registerOnload('db_multi_table_query.js', function () {
|
||||
});
|
||||
});
|
||||
|
||||
$('.criteria_col').each(function() {
|
||||
$(this).on('change', function() {
|
||||
$('.criteria_col').each(function () {
|
||||
$(this).on('change', function () {
|
||||
$anchor = $(this).siblings('a.ajax').first();
|
||||
$anchor.trigger('click', ['Trigger']);
|
||||
});
|
||||
});
|
||||
|
||||
$('.criteria_rhs').each(function() {
|
||||
$(this).on('change', function() {
|
||||
$('.criteria_rhs').each(function () {
|
||||
$(this).on('change', function () {
|
||||
$rhs_col = $(this).parent().parent().siblings('.rhs_table').first();
|
||||
$rhs_text = $(this).parent().parent().siblings('.rhs_text').first();
|
||||
if ($(this).val() === 'text') {
|
||||
|
||||
@ -23,25 +23,24 @@
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('db_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");
|
||||
$(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('db_operations.js', function () {
|
||||
|
||||
/**
|
||||
* Ajax event handlers for 'Rename Database'
|
||||
*/
|
||||
$(document).on('submit', "#rename_db_form.ajax", function (event) {
|
||||
$(document).on('submit', '#rename_db_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var old_db_name = PMA_commonParams.get('db');
|
||||
var new_db_name = $('#new_db_name').val();
|
||||
|
||||
if (new_db_name == old_db_name) {
|
||||
PMA_ajaxShowMessage(PMA_messages.strDatabaseRenameToSameName, false, "error");
|
||||
PMA_ajaxShowMessage(PMA_messages.strDatabaseRenameToSameName, false, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -53,14 +52,14 @@ AJAX.registerOnload('db_operations.js', function () {
|
||||
|
||||
$form.PMA_confirm(question, $form.attr('action'), function (url) {
|
||||
PMA_ajaxShowMessage(PMA_messages.strRenamingDatabases, false);
|
||||
$.post(url, $("#rename_db_form").serialize() + '&is_js_confirmed=1', function (data) {
|
||||
$.post(url, $('#rename_db_form').serialize() + '&is_js_confirmed=1', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
PMA_commonParams.set('db', data.newname);
|
||||
|
||||
PMA_reloadNavigation(function () {
|
||||
$('#pma_navigation_tree')
|
||||
.find("a:not('.expander')")
|
||||
.find('a:not(\'.expander\')')
|
||||
.each(function (index) {
|
||||
var $thisAnchor = $(this);
|
||||
if ($thisAnchor.text() == data.newname) {
|
||||
@ -80,7 +79,7 @@ AJAX.registerOnload('db_operations.js', function () {
|
||||
/**
|
||||
* Ajax Event Handler for 'Copy Database'
|
||||
*/
|
||||
$(document).on('submit', "#copy_db_form.ajax", function (event) {
|
||||
$(document).on('submit', '#copy_db_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
PMA_ajaxShowMessage(PMA_messages.strCopyingDatabase, false);
|
||||
var $form = $(this);
|
||||
@ -89,7 +88,7 @@ AJAX.registerOnload('db_operations.js', function () {
|
||||
// use messages that stay on screen
|
||||
$('div.success, div.error').fadeOut();
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
if ($("#checkbox_switch").is(":checked")) {
|
||||
if ($('#checkbox_switch').is(':checked')) {
|
||||
PMA_commonParams.set('db', data.newname);
|
||||
PMA_commonActions.refreshMain(false, function () {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
@ -108,12 +107,12 @@ AJAX.registerOnload('db_operations.js', function () {
|
||||
/**
|
||||
* Ajax Event handler for 'Change Charset' of the database
|
||||
*/
|
||||
$(document).on('submit', "#change_db_charset_form.ajax", function (event) {
|
||||
$(document).on('submit', '#change_db_charset_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
PMA_ajaxShowMessage(PMA_messages.strChangingCharset);
|
||||
$.post($form.attr('action'), $form.serialize() + "&submitcollation=1", function (data) {
|
||||
$.post($form.attr('action'), $form.serialize() + '&submitcollation=1', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
} else {
|
||||
@ -125,7 +124,7 @@ AJAX.registerOnload('db_operations.js', function () {
|
||||
/**
|
||||
* Ajax event handlers for Drop Database
|
||||
*/
|
||||
$(document).on('click', "#drop_db_anchor.ajax", function (event) {
|
||||
$(document).on('click', '#drop_db_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
@ -143,7 +142,7 @@ AJAX.registerOnload('db_operations.js', function () {
|
||||
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
//Database deleted successfully, refresh both the frames
|
||||
// Database deleted successfully, refresh both the frames
|
||||
PMA_reloadNavigation();
|
||||
PMA_commonParams.set('db', '');
|
||||
PMA_commonActions.refreshMain(
|
||||
|
||||
23
js/db_qbe.js
23
js/db_qbe.js
@ -21,14 +21,13 @@
|
||||
*/
|
||||
AJAX.registerTeardown('db_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");
|
||||
$(document).off('change', '#searchId');
|
||||
$(document).off('click', '#saveSearch');
|
||||
$(document).off('click', '#updateSearch');
|
||||
$(document).off('click', '#deleteSearch');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('db_qbe.js', function () {
|
||||
|
||||
PMA_getSQLEditor($('#textSqlquery'), {}, 'both');
|
||||
|
||||
/**
|
||||
@ -44,7 +43,7 @@ AJAX.registerOnload('db_qbe.js', function () {
|
||||
/**
|
||||
* Ajax event handlers for 'Select saved search'
|
||||
*/
|
||||
$(document).on('change', "#searchId", function (event) {
|
||||
$(document).on('change', '#searchId', function (event) {
|
||||
$('#action').val('load');
|
||||
$('#formQBE').submit();
|
||||
});
|
||||
@ -52,22 +51,22 @@ AJAX.registerOnload('db_qbe.js', function () {
|
||||
/**
|
||||
* Ajax event handlers for 'Create bookmark'
|
||||
*/
|
||||
$(document).on('click', "#saveSearch", function () {
|
||||
$(document).on('click', '#saveSearch', function () {
|
||||
$('#action').val('create');
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajax event handlers for 'Update bookmark'
|
||||
*/
|
||||
$(document).on('click', "#updateSearch", function (event) {
|
||||
$(document).on('click', '#updateSearch', function (event) {
|
||||
$('#action').val('update');
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajax event handlers for 'Delete bookmark'
|
||||
*/
|
||||
$(document).on('click', "#deleteSearch", function (event) {
|
||||
var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $("#searchId").find("option:selected").text());
|
||||
$(document).on('click', '#deleteSearch', function (event) {
|
||||
var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $('#searchId').find('option:selected').text());
|
||||
if (!confirm(question)) {
|
||||
return false;
|
||||
}
|
||||
@ -76,5 +75,5 @@ AJAX.registerOnload('db_qbe.js', function () {
|
||||
});
|
||||
|
||||
var windowwidth = $(window).width();
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 35 ) + 'px');
|
||||
});
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 35) + 'px');
|
||||
});
|
||||
|
||||
@ -23,19 +23,19 @@ AJAX.registerTeardown('db_search.js', function () {
|
||||
$('a.delete_results').off('click');
|
||||
$('#buttonGo').off('click');
|
||||
$('#togglesearchresultlink').off('click');
|
||||
$("#togglequerybox").off('click');
|
||||
$('#togglequerybox').off('click');
|
||||
$('#togglesearchformlink').off('click');
|
||||
$(document).off('submit', "#db_search_form.ajax");
|
||||
$(document).off('submit', '#db_search_form.ajax');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('db_search.js', function () {
|
||||
/** Hide the table link in the initial search result */
|
||||
var icon = PMA_getImage('s_tbl.png', '', {'id': 'table-image'}).toString();
|
||||
$("#table-info").prepend(icon).hide();
|
||||
var icon = PMA_getImage('s_tbl.png', '', { 'id': 'table-image' }).toString();
|
||||
$('#table-info').prepend(icon).hide();
|
||||
|
||||
/** Hide the browse and deleted results in the new search criteria */
|
||||
$('#buttonGo').click(function () {
|
||||
$("#table-info").hide();
|
||||
$('#table-info').hide();
|
||||
$('#browse-results').hide();
|
||||
$('#sqlqueryform').hide();
|
||||
$('#togglequerybox').hide();
|
||||
@ -45,50 +45,50 @@ AJAX.registerOnload('db_search.js', function () {
|
||||
*/
|
||||
$('#togglesearchresultsdiv')
|
||||
/** don't show it until we have results on-screen */
|
||||
.hide();
|
||||
.hide();
|
||||
|
||||
/**
|
||||
* Changing the displayed text according to
|
||||
* the hide/show criteria in search result forms
|
||||
*/
|
||||
$('#togglesearchresultlink')
|
||||
.html(PMA_messages.strHideSearchResults)
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
$('#searchresults').slideToggle();
|
||||
if ($link.text() == PMA_messages.strHideSearchResults) {
|
||||
$link.text(PMA_messages.strShowSearchResults);
|
||||
} else {
|
||||
$link.text(PMA_messages.strHideSearchResults);
|
||||
}
|
||||
/** avoid default click action */
|
||||
return false;
|
||||
});
|
||||
.html(PMA_messages.strHideSearchResults)
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
$('#searchresults').slideToggle();
|
||||
if ($link.text() == PMA_messages.strHideSearchResults) {
|
||||
$link.text(PMA_messages.strShowSearchResults);
|
||||
} else {
|
||||
$link.text(PMA_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
|
||||
.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() == PMA_messages.strHideQueryBox) {
|
||||
$link.text(PMA_messages.strShowQueryBox);
|
||||
} else {
|
||||
$link.text(PMA_messages.strHideQueryBox);
|
||||
}
|
||||
/** avoid default click action */
|
||||
return false;
|
||||
});
|
||||
$('#togglequerybox')
|
||||
.hide()
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
$('#sqlqueryform').slideToggle('medium');
|
||||
if ($link.text() == PMA_messages.strHideQueryBox) {
|
||||
$link.text(PMA_messages.strShowQueryBox);
|
||||
} else {
|
||||
$link.text(PMA_messages.strHideQueryBox);
|
||||
}
|
||||
/** avoid default click action */
|
||||
return false;
|
||||
});
|
||||
|
||||
/** don't show it until we have results on-screen */
|
||||
|
||||
@ -97,8 +97,8 @@ AJAX.registerOnload('db_search.js', function () {
|
||||
* the hide/show criteria in search criteria form
|
||||
*/
|
||||
$('#togglesearchformlink')
|
||||
.html(PMA_messages.strShowSearchCriteria)
|
||||
.on('click', function () {
|
||||
.html(PMA_messages.strShowSearchCriteria)
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
$('#db_search_form').slideToggle();
|
||||
if ($link.text() == PMA_messages.strHideSearchCriteria) {
|
||||
@ -113,18 +113,18 @@ AJAX.registerOnload('db_search.js', function () {
|
||||
/*
|
||||
* Ajax Event handler for retrieving the results from a table
|
||||
*/
|
||||
$(document).on('click', 'a.browse_results', function(e){
|
||||
$(document).on('click', 'a.browse_results', function (e) {
|
||||
e.preventDefault();
|
||||
/** Hides the results shown by the delete criteria */
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages.strBrowsing, false);
|
||||
$('#sqlqueryform').hide();
|
||||
$('#togglequerybox').hide();
|
||||
/** Load the browse results to the page */
|
||||
$("#table-info").show();
|
||||
$('#table-info').show();
|
||||
var table_name = $(this).data('table-name');
|
||||
$('#table-link').attr({"href" : $(this).attr('href')}).text(table_name);
|
||||
$('#table-link').attr({ 'href' : $(this).attr('href') }).text(table_name);
|
||||
|
||||
var url = $(this).attr('href') + "#searchresults";
|
||||
var url = $(this).attr('href') + '#searchresults';
|
||||
var browse_sql = $(this).data('browse-sql');
|
||||
var params = {
|
||||
'ajax_request': true,
|
||||
@ -142,7 +142,7 @@ AJAX.registerOnload('db_search.js', function () {
|
||||
PMA_highlightSQL($('#browse-results'));
|
||||
$('html, body')
|
||||
.animate({
|
||||
scrollTop: $("#browse-results").offset().top
|
||||
scrollTop: $('#browse-results').offset().top
|
||||
}, 1000);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
@ -153,10 +153,10 @@ AJAX.registerOnload('db_search.js', function () {
|
||||
/*
|
||||
* Ajax Event handler for deleting the results from a table
|
||||
*/
|
||||
$(document).on('click', 'a.delete_results', function(e){
|
||||
$(document).on('click', 'a.delete_results', function (e) {
|
||||
e.preventDefault();
|
||||
/** Hides the results shown by the browse criteria */
|
||||
$("#table-info").hide();
|
||||
$('#table-info').hide();
|
||||
$('#sqlqueryform').hide();
|
||||
$('#togglequerybox').hide();
|
||||
/** Conformation message for deletion */
|
||||
@ -191,7 +191,7 @@ AJAX.registerOnload('db_search.js', function () {
|
||||
$('#togglequerybox').show();
|
||||
$('html, body')
|
||||
.animate({
|
||||
scrollTop: $("#browse-results").offset().top
|
||||
scrollTop: $('#browse-results').offset().top
|
||||
}, 1000);
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
});
|
||||
@ -201,7 +201,7 @@ AJAX.registerOnload('db_search.js', function () {
|
||||
/**
|
||||
* Ajax Event handler for retrieving the result of an SQL Query
|
||||
*/
|
||||
$(document).on('submit', "#db_search_form.ajax", function (event) {
|
||||
$(document).on('submit', '#db_search_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strSearching, false);
|
||||
@ -210,18 +210,18 @@ AJAX.registerOnload('db_search.js', function () {
|
||||
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
|
||||
var url = $form.serialize() + "&submit_search=" + $("#buttonGo").val();
|
||||
var url = $form.serialize() + '&submit_search=' + $('#buttonGo').val();
|
||||
$.post($form.attr('action'), url, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
// found results
|
||||
$("#searchresults").html(data.message);
|
||||
$('#searchresults').html(data.message);
|
||||
|
||||
$('#togglesearchresultlink')
|
||||
// always start with the Show message
|
||||
.text(PMA_messages.strHideSearchResults);
|
||||
.text(PMA_messages.strHideSearchResults);
|
||||
$('#togglesearchresultsdiv')
|
||||
// now it's time to show the div containing the link
|
||||
.show();
|
||||
.show();
|
||||
$('#searchresults').show();
|
||||
|
||||
|
||||
@ -237,7 +237,7 @@ AJAX.registerOnload('db_search.js', function () {
|
||||
.show();
|
||||
} else {
|
||||
// error message (zero rows)
|
||||
$("#searchresults").html(data.error).show();
|
||||
$('#searchresults').html(data.error).show();
|
||||
}
|
||||
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
|
||||
@ -22,22 +22,22 @@
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('db_structure.js', function () {
|
||||
$(document).off('click', "a.truncate_table_anchor.ajax");
|
||||
$(document).off('click', "a.drop_table_anchor.ajax");
|
||||
$(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', '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');
|
||||
$("#filterText").off('keyup');
|
||||
$('#filterText').off('keyup');
|
||||
});
|
||||
|
||||
/**
|
||||
* Adjust number of rows and total size in the summary
|
||||
* when truncating, creating, dropping or inserting into a table
|
||||
*/
|
||||
function PMA_adjustTotals() {
|
||||
function PMA_adjustTotals () {
|
||||
var byteUnits = [
|
||||
PMA_messages.strB,
|
||||
PMA_messages.strKiB,
|
||||
@ -50,7 +50,7 @@ function PMA_adjustTotals() {
|
||||
/**
|
||||
* @var $allTr jQuery object that references all the rows in the list of tables
|
||||
*/
|
||||
var $allTr = $("#tablesForm").find("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;
|
||||
@ -102,14 +102,14 @@ function PMA_adjustTotals() {
|
||||
});
|
||||
// Add some commas for readability:
|
||||
// 1000000 becomes 1,000,000
|
||||
var strRowSum = rowsSum + "";
|
||||
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;
|
||||
strRowSum = '~' + strRowSum;
|
||||
}
|
||||
// Calculate the magnitude for the size and overhead values
|
||||
var size_magnitude = 0, overhead_magnitude = 0;
|
||||
@ -126,27 +126,26 @@ function PMA_adjustTotals() {
|
||||
overheadSum = Math.round(overheadSum * 10) / 10;
|
||||
|
||||
// Update summary with new data
|
||||
var $summary = $("#tbl_summary_row");
|
||||
var $summary = $('#tbl_summary_row');
|
||||
$summary.find('.tbl_num').text(PMA_sprintf(PMA_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[size_magnitude]);
|
||||
$summary.find('.tbl_overhead').text(overheadSum + " " + byteUnits[overhead_magnitude]);
|
||||
$summary.find('.tbl_size').text(sizeSum + ' ' + byteUnits[size_magnitude]);
|
||||
$summary.find('.tbl_overhead').text(overheadSum + ' ' + byteUnits[overhead_magnitude]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the real row count for a table or DB.
|
||||
* @param object $target Target for appending the real count value.
|
||||
*/
|
||||
function PMA_fetchRealRowCount($target)
|
||||
{
|
||||
function PMA_fetchRealRowCount ($target) {
|
||||
var $throbber = $('#pma_navigation').find('.throbber')
|
||||
.first()
|
||||
.clone()
|
||||
.css({visibility: 'visible', display: 'inline-block'})
|
||||
.css({ visibility: 'visible', display: 'inline-block' })
|
||||
.click(false);
|
||||
$target.html($throbber);
|
||||
$.ajax({
|
||||
@ -162,7 +161,7 @@ function PMA_fetchRealRowCount($target)
|
||||
function (index, table) {
|
||||
// Update each table row count.
|
||||
$('table.data td[data-table*="' + table.table + '"]')
|
||||
.text(table.row_count);
|
||||
.text(table.row_count);
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -191,16 +190,16 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
* @param function success function to be called on success
|
||||
*
|
||||
*/
|
||||
var jqConfirm = function(msg, success) {
|
||||
var dialogObj = $("<div class='hide'>"+msg+"</div>");
|
||||
var jqConfirm = function (msg, success) {
|
||||
var dialogObj = $('<div class=\'hide\'>' + msg + '</div>');
|
||||
$('body').append(dialogObj);
|
||||
var buttonOptions = {};
|
||||
buttonOptions[PMA_messages.strContinue] = function () {
|
||||
success();
|
||||
$( this ).dialog( "close" );
|
||||
$(this).dialog('close');
|
||||
};
|
||||
buttonOptions[PMA_messages.strCancel] = function () {
|
||||
$( this ).dialog( "close" );
|
||||
$(this).dialog('close');
|
||||
$('#tablesForm')[0].reset();
|
||||
};
|
||||
$(dialogObj).dialog({
|
||||
@ -211,41 +210,40 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Filtering tables on table listing of particular database
|
||||
*
|
||||
*/
|
||||
$("#filterText").keyup(function() {
|
||||
$('#filterText').keyup(function () {
|
||||
var filterInput = $(this).val().toUpperCase();
|
||||
var structureTable = $('#structureTable')[0];
|
||||
$('#structureTable tbody tr').each(function() {
|
||||
$('#structureTable tbody tr').each(function () {
|
||||
var tr = $(this);
|
||||
var a = tr.find('a')[0];
|
||||
if (a) {
|
||||
if (a.text.trim().toUpperCase().indexOf(filterInput) > -1) {
|
||||
tr[0].style.display = "";
|
||||
tr[0].style.display = '';
|
||||
} else {
|
||||
tr[0].style.display = "none";
|
||||
tr[0].style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
/**
|
||||
* Event handler on select of "Make consistent with central list"
|
||||
*/
|
||||
$('select[name=submit_mult]').change(function(event) {
|
||||
$('select[name=submit_mult]').change(function (event) {
|
||||
if ($(this).val() === 'make_consistent_with_central_list') {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
jqConfirm(
|
||||
PMA_messages.makeConsistentMessage, function(){
|
||||
PMA_messages.makeConsistentMessage, function () {
|
||||
$('#tablesForm').submit();
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
else if ($(this).val() === 'copy_tbl' || $(this).val() === 'add_prefix_tbl' || $(this).val() === 'replace_prefix_tbl' || $(this).val() === 'copy_tbl_change_prefix') {
|
||||
} else if ($(this).val() === 'copy_tbl' || $(this).val() === 'add_prefix_tbl' || $(this).val() === 'replace_prefix_tbl' || $(this).val() === 'copy_tbl_change_prefix') {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if ($('input[name="selected_tbl[]"]:checked').length === 0) {
|
||||
@ -255,14 +253,11 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
var modalTitle = '';
|
||||
if ($(this).val() === 'copy_tbl') {
|
||||
modalTitle = PMA_messages.strCopyTablesTo;
|
||||
}
|
||||
else if ($(this).val() === 'add_prefix_tbl') {
|
||||
} else if ($(this).val() === 'add_prefix_tbl') {
|
||||
modalTitle = PMA_messages.strAddPrefix;
|
||||
}
|
||||
else if ($(this).val() === 'replace_prefix_tbl') {
|
||||
} else if ($(this).val() === 'replace_prefix_tbl') {
|
||||
modalTitle = PMA_messages.strReplacePrefix;
|
||||
}
|
||||
else if ($(this).val() === 'copy_tbl_change_prefix') {
|
||||
} else if ($(this).val() === 'copy_tbl_change_prefix') {
|
||||
modalTitle = PMA_messages.strCopyPrefix;
|
||||
}
|
||||
$.ajax({
|
||||
@ -271,17 +266,16 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
dataType: 'html',
|
||||
data: formData
|
||||
|
||||
}).done(function(data) {
|
||||
|
||||
var dialogObj = $("<div class='hide'>"+data+"</div>");
|
||||
}).done(function (data) {
|
||||
var dialogObj = $('<div class=\'hide\'>' + data + '</div>');
|
||||
$('body').append(dialogObj);
|
||||
var buttonOptions = {};
|
||||
buttonOptions[PMA_messages.strContinue] = function () {
|
||||
$('#ajax_form').submit();
|
||||
$( this ).dialog( "close" );
|
||||
$(this).dialog('close');
|
||||
};
|
||||
buttonOptions[PMA_messages.strCancel] = function () {
|
||||
$( this ).dialog( "close" );
|
||||
$(this).dialog('close');
|
||||
$('#tablesForm')[0].reset();
|
||||
};
|
||||
$(dialogObj).dialog({
|
||||
@ -292,8 +286,7 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
buttons: buttonOptions
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('#tablesForm').submit();
|
||||
}
|
||||
});
|
||||
@ -301,7 +294,7 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
/**
|
||||
* Ajax Event handler for 'Truncate Table'
|
||||
*/
|
||||
$(document).on('click', "a.truncate_table_anchor.ajax", function (event) {
|
||||
$(document).on('click', 'a.truncate_table_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
/**
|
||||
@ -309,7 +302,7 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
*/
|
||||
var $this_anchor = $(this);
|
||||
|
||||
//extract current table name and build the question string
|
||||
// extract current table name and build the question string
|
||||
/**
|
||||
* @var curr_table_name String containing the name of the table to be truncated
|
||||
*/
|
||||
@ -322,7 +315,6 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
getForeignKeyCheckboxLoader();
|
||||
|
||||
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
|
||||
var params = getJSConfirmCommonParam(this);
|
||||
@ -334,31 +326,31 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
var $tr = $this_anchor.closest('tr');
|
||||
$tr.find('.tbl_rows').text('0');
|
||||
$tr.find('.tbl_size, .tbl_overhead').text('-');
|
||||
//Fetch inner span of this anchor
|
||||
//and replace the icon with its disabled version
|
||||
// Fetch inner span of this anchor
|
||||
// and replace the icon with its disabled version
|
||||
var span = $this_anchor.html().replace(/b_empty/, 'bd_empty');
|
||||
//To disable further attempts to truncate the table,
|
||||
//replace the a element with its inner span (modified)
|
||||
// To disable further attempts to truncate the table,
|
||||
// replace the a element with its inner span (modified)
|
||||
$this_anchor
|
||||
.replaceWith(span)
|
||||
.removeClass('truncate_table_anchor');
|
||||
PMA_adjustTotals();
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}, loadForeignKeyCheckbox); //end $.PMA_confirm()
|
||||
}); //end of Truncate Table Ajax action
|
||||
}, loadForeignKeyCheckbox); // end $.PMA_confirm()
|
||||
}); // 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) {
|
||||
$(document).on('click', 'a.drop_table_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $this_anchor = $(this);
|
||||
|
||||
//extract current table name and build the question string
|
||||
// extract current table name and build the question string
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
@ -385,7 +377,6 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
question += getForeignKeyCheckboxLoader();
|
||||
|
||||
$this_anchor.PMA_confirm(question, $this_anchor.attr('href'), function (url) {
|
||||
|
||||
var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
|
||||
var params = getJSConfirmCommonParam(this);
|
||||
@ -393,28 +384,28 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$curr_row.hide("medium").remove();
|
||||
$curr_row.hide('medium').remove();
|
||||
PMA_adjustTotals();
|
||||
PMA_reloadNavigation();
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}, loadForeignKeyCheckbox); // end $.PMA_confirm()
|
||||
}); //end of Drop Table Ajax action
|
||||
}); // end of Drop Table Ajax action
|
||||
|
||||
/**
|
||||
* Attach Event Handler for 'Print' link
|
||||
*/
|
||||
$(document).on('click', "#printView", function (event) {
|
||||
$(document).on('click', '#printView', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Take to preview mode
|
||||
printPreview();
|
||||
}); //end of Print View action
|
||||
}); // end of Print View action
|
||||
|
||||
//Calculate Real End for InnoDB
|
||||
// Calculate Real End for InnoDB
|
||||
/**
|
||||
* Ajax Event handler for calculating the real end for a InnoDB table
|
||||
*
|
||||
@ -431,14 +422,14 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
return true;
|
||||
});
|
||||
return false;
|
||||
}); //end Calculate Real End for InnoDB
|
||||
}); // end Calculate Real End for InnoDB
|
||||
|
||||
// Add tooltip to favorite icons.
|
||||
$(".favorite_table_anchor").each(function () {
|
||||
$('.favorite_table_anchor').each(function () {
|
||||
PMA_tooltip(
|
||||
$(this),
|
||||
'a',
|
||||
$(this).attr("title")
|
||||
$(this).attr('title')
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@ -11,17 +11,16 @@ AJAX.registerTeardown('db_tracking.js', function () {
|
||||
* Bind event handlers
|
||||
*/
|
||||
AJAX.registerOnload('db_tracking.js', function () {
|
||||
|
||||
var $versions = $('#versions');
|
||||
$versions.find('tr:first 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}
|
||||
0: { sorter: false },
|
||||
2: { sorter: 'integer' },
|
||||
5: { sorter: false },
|
||||
6: { sorter: false },
|
||||
7: { sorter: false }
|
||||
}
|
||||
});
|
||||
|
||||
@ -30,8 +29,8 @@ AJAX.registerOnload('db_tracking.js', function () {
|
||||
$noVersions.tablesorter({
|
||||
sortList: [[1, 0]],
|
||||
headers: {
|
||||
0: {sorter: false},
|
||||
2: {sorter: false}
|
||||
0: { sorter: false },
|
||||
2: { sorter: false }
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -15,11 +15,11 @@ var ErrorReport = {
|
||||
* @return void
|
||||
*/
|
||||
error_handler: function (exception) {
|
||||
if (exception.name === null || typeof(exception.name) == "undefined") {
|
||||
if (exception.name === null || typeof(exception.name) === 'undefined') {
|
||||
exception.name = ErrorReport._extractExceptionName(exception);
|
||||
}
|
||||
ErrorReport._last_exception = exception;
|
||||
$.get("error_report.php", {
|
||||
$.get('error_report.php', {
|
||||
ajax_request: true,
|
||||
server: PMA_commonParams.get('server'),
|
||||
get_settings: true,
|
||||
@ -29,17 +29,17 @@ var ErrorReport = {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
return;
|
||||
}
|
||||
if (data.report_setting == "ask") {
|
||||
if (data.report_setting == 'ask') {
|
||||
ErrorReport._showErrorNotification();
|
||||
} else if (data.report_setting == "always") {
|
||||
} else if (data.report_setting == 'always') {
|
||||
report_data = ErrorReport._get_report_data(exception);
|
||||
post_data = $.extend(report_data, {
|
||||
send_error_report: true,
|
||||
automatic: true
|
||||
});
|
||||
$.post("error_report.php", post_data, function (data) {
|
||||
$.post('error_report.php', post_data, function (data) {
|
||||
if (data.success === false) {
|
||||
//in the case of an error, show the error message returned.
|
||||
// in the case of an error, show the error message returned.
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.message, false);
|
||||
@ -58,7 +58,7 @@ var ErrorReport = {
|
||||
_showReportDialog: function (exception) {
|
||||
var report_data = ErrorReport._get_report_data(exception);
|
||||
|
||||
/*Remove the hidden dialogs if there are*/
|
||||
/* Remove the hidden dialogs if there are*/
|
||||
if ($('#error_report_dialog').length !== 0) {
|
||||
$('#error_report_dialog').remove();
|
||||
}
|
||||
@ -71,13 +71,13 @@ var ErrorReport = {
|
||||
var $dialog = $(this);
|
||||
var post_data = $.extend(report_data, {
|
||||
send_error_report: true,
|
||||
description: $("#report_description").val(),
|
||||
always_send: $("#always_send_checkbox")[0].checked
|
||||
description: $('#report_description').val(),
|
||||
always_send: $('#always_send_checkbox')[0].checked
|
||||
});
|
||||
$.post("error_report.php", post_data, function (data) {
|
||||
$.post('error_report.php', post_data, function (data) {
|
||||
$dialog.dialog('close');
|
||||
if (data.success === false) {
|
||||
//in the case of an error, show the error message returned.
|
||||
// in the case of an error, show the error message returned.
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.message, 3000);
|
||||
@ -89,23 +89,23 @@ var ErrorReport = {
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
$.post("error_report.php", report_data, function (data) {
|
||||
$.post('error_report.php', report_data, function (data) {
|
||||
if (data.success === false) {
|
||||
//in the case of an error, show the error message returned.
|
||||
// in the case of an error, show the error message returned.
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
// Show dialog if the request was successful
|
||||
$div
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: PMA_messages.strSubmitErrorReport,
|
||||
width: 650,
|
||||
modal: true,
|
||||
buttons: button_options,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: PMA_messages.strSubmitErrorReport,
|
||||
width: 650,
|
||||
modal: true,
|
||||
buttons: button_options,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
}); // end $.get()
|
||||
},
|
||||
@ -121,7 +121,7 @@ var ErrorReport = {
|
||||
'<div style="position:fixed;bottom:0;left:0;right:0;margin:0;' +
|
||||
'z-index:1000" class="error" id="error_notification"></div>'
|
||||
).append(
|
||||
PMA_getImage("s_error.png") + PMA_messages.strErrorOccurred
|
||||
PMA_getImage('s_error.png') + PMA_messages.strErrorOccurred
|
||||
);
|
||||
|
||||
var $buttons = $('<div class="floatright"></div>');
|
||||
@ -142,9 +142,9 @@ var ErrorReport = {
|
||||
|
||||
$div.append($buttons);
|
||||
$div.appendTo(document.body);
|
||||
$("#change_error_settings").on("click", ErrorReport._redirect_to_settings);
|
||||
$("#show_error_report").on("click", ErrorReport._createReportDialog);
|
||||
$("#ignore_error").on("click", ErrorReport._removeErrorNotification);
|
||||
$('#change_error_settings').on('click', ErrorReport._redirect_to_settings);
|
||||
$('#show_error_report').on('click', ErrorReport._createReportDialog);
|
||||
$('#ignore_error').on('click', ErrorReport._removeErrorNotification);
|
||||
},
|
||||
/**
|
||||
* Removes the notification if it was displayed before
|
||||
@ -156,7 +156,7 @@ var ErrorReport = {
|
||||
// don't remove the hash fragment by navigating to #
|
||||
e.preventDefault();
|
||||
}
|
||||
$("#error_notification").fadeOut(function () {
|
||||
$('#error_notification').fadeOut(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
},
|
||||
@ -166,8 +166,8 @@ var ErrorReport = {
|
||||
* @return String
|
||||
*/
|
||||
_extractExceptionName: function (exception) {
|
||||
if (exception.message === null || typeof(exception.message) == "undefined") {
|
||||
return "";
|
||||
if (exception.message === null || typeof(exception.message) === 'undefined') {
|
||||
return '';
|
||||
}
|
||||
|
||||
var reg = /([a-zA-Z]+):/;
|
||||
@ -176,7 +176,7 @@ var ErrorReport = {
|
||||
return regex_result[1];
|
||||
}
|
||||
|
||||
return "";
|
||||
return '';
|
||||
},
|
||||
/**
|
||||
* Shows the modal dialog previewing the report
|
||||
@ -194,7 +194,7 @@ var ErrorReport = {
|
||||
* @return void
|
||||
*/
|
||||
_redirect_to_settings: function () {
|
||||
window.location.href = "prefs_forms.php";
|
||||
window.location.href = 'prefs_forms.php';
|
||||
},
|
||||
/**
|
||||
* Returns the report data to send to the server
|
||||
@ -205,10 +205,10 @@ var ErrorReport = {
|
||||
*/
|
||||
_get_report_data: function (exception) {
|
||||
var report_data = {
|
||||
"ajax_request": true,
|
||||
"exception": exception,
|
||||
"current_url": window.location.href,
|
||||
"exception_type": 'js'
|
||||
'ajax_request': true,
|
||||
'exception': exception,
|
||||
'current_url': window.location.href,
|
||||
'exception_type': 'js'
|
||||
};
|
||||
if (AJAX.scriptHandler._scripts.length > 0) {
|
||||
report_data.scripts = AJAX.scriptHandler._scripts.map(
|
||||
@ -226,9 +226,9 @@ var ErrorReport = {
|
||||
*/
|
||||
wrap_global_functions: function () {
|
||||
for (var key in window) {
|
||||
if (key.indexOf("PMA_") === 0) {
|
||||
if (key.indexOf('PMA_') === 0) {
|
||||
var global = window[key];
|
||||
if (typeof(global) === "function") {
|
||||
if (typeof(global) === 'function') {
|
||||
window[key] = ErrorReport.wrap_function(global);
|
||||
}
|
||||
}
|
||||
@ -251,8 +251,8 @@ var ErrorReport = {
|
||||
}
|
||||
};
|
||||
new_func.wrapped = true;
|
||||
//Set guid of wrapped function same as original function, so it can be removed
|
||||
//See bug#4146 (problem with jquery draggable and sortable)
|
||||
// Set guid of wrapped function same as original function, so it can be removed
|
||||
// See bug#4146 (problem with jquery draggable and sortable)
|
||||
new_func.guid = func.guid = func.guid || new_func.guid || jQuery.guid++;
|
||||
return new_func;
|
||||
} else {
|
||||
@ -280,7 +280,7 @@ var ErrorReport = {
|
||||
var oldOn = $.fn.on;
|
||||
$.fn.on = function () {
|
||||
for (var i = 1; i <= 3; i++) {
|
||||
if (typeof(arguments[i]) === "function") {
|
||||
if (typeof(arguments[i]) === 'function') {
|
||||
arguments[i] = ErrorReport.wrap_function(arguments[i]);
|
||||
break;
|
||||
}
|
||||
@ -302,7 +302,7 @@ var ErrorReport = {
|
||||
|
||||
};
|
||||
|
||||
AJAX.registerOnload('error_report.js', function(){
|
||||
AJAX.registerOnload('error_report.js', function () {
|
||||
TraceKit.report.subscribe(ErrorReport.error_handler);
|
||||
ErrorReport.set_up_error_reporting();
|
||||
ErrorReport.wrap_global_functions();
|
||||
|
||||
313
js/export.js
313
js/export.js
@ -7,23 +7,21 @@
|
||||
/**
|
||||
* Disables the "Dump some row(s)" sub-options
|
||||
*/
|
||||
function disable_dump_some_rows_sub_options()
|
||||
{
|
||||
$("label[for='limit_to']").fadeTo('fast', 0.4);
|
||||
$("label[for='limit_from']").fadeTo('fast', 0.4);
|
||||
$("input[type='text'][name='limit_to']").prop('disabled', 'disabled');
|
||||
$("input[type='text'][name='limit_from']").prop('disabled', 'disabled');
|
||||
function disable_dump_some_rows_sub_options () {
|
||||
$('label[for=\'limit_to\']').fadeTo('fast', 0.4);
|
||||
$('label[for=\'limit_from\']').fadeTo('fast', 0.4);
|
||||
$('input[type=\'text\'][name=\'limit_to\']').prop('disabled', 'disabled');
|
||||
$('input[type=\'text\'][name=\'limit_from\']').prop('disabled', 'disabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the "Dump some row(s)" sub-options
|
||||
*/
|
||||
function enable_dump_some_rows_sub_options()
|
||||
{
|
||||
$("label[for='limit_to']").fadeTo('fast', 1);
|
||||
$("label[for='limit_from']").fadeTo('fast', 1);
|
||||
$("input[type='text'][name='limit_to']").prop('disabled', '');
|
||||
$("input[type='text'][name='limit_from']").prop('disabled', '');
|
||||
function enable_dump_some_rows_sub_options () {
|
||||
$('label[for=\'limit_to\']').fadeTo('fast', 1);
|
||||
$('label[for=\'limit_from\']').fadeTo('fast', 1);
|
||||
$('input[type=\'text\'][name=\'limit_to\']').prop('disabled', '');
|
||||
$('input[type=\'text\'][name=\'limit_from\']').prop('disabled', '');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -31,8 +29,7 @@ function enable_dump_some_rows_sub_options()
|
||||
*
|
||||
* @returns template data
|
||||
*/
|
||||
function getTemplateData()
|
||||
{
|
||||
function getTemplateData () {
|
||||
var $form = $('form[name="dump"]');
|
||||
var blacklist = ['token', 'server', 'db', 'table', 'single_table',
|
||||
'export_type', 'export_method', 'sql_query', 'template_id'];
|
||||
@ -71,8 +68,7 @@ function getTemplateData()
|
||||
*
|
||||
* @param name name of the template
|
||||
*/
|
||||
function createTemplate(name)
|
||||
{
|
||||
function createTemplate (name) {
|
||||
var templateData = getTemplateData();
|
||||
|
||||
var params = {
|
||||
@ -91,7 +87,7 @@ function createTemplate(name)
|
||||
if (response.success === true) {
|
||||
$('#templateName').val('');
|
||||
$('#template').html(response.data);
|
||||
$("#template").find("option").each(function() {
|
||||
$('#template').find('option').each(function () {
|
||||
if ($(this).text() == name) {
|
||||
$(this).prop('selected', true);
|
||||
}
|
||||
@ -108,8 +104,7 @@ function createTemplate(name)
|
||||
*
|
||||
* @param id ID of the template to load
|
||||
*/
|
||||
function loadTemplate(id)
|
||||
{
|
||||
function loadTemplate (id) {
|
||||
var params = {
|
||||
ajax_request : true,
|
||||
server : PMA_commonParams.get('server'),
|
||||
@ -156,8 +151,7 @@ function loadTemplate(id)
|
||||
*
|
||||
* @param id ID of the template to update
|
||||
*/
|
||||
function updateTemplate(id)
|
||||
{
|
||||
function updateTemplate (id) {
|
||||
var templateData = getTemplateData();
|
||||
|
||||
var params = {
|
||||
@ -186,8 +180,7 @@ function updateTemplate(id)
|
||||
*
|
||||
* @param id ID of the template to delete
|
||||
*/
|
||||
function deleteTemplate(id)
|
||||
{
|
||||
function deleteTemplate (id) {
|
||||
var params = {
|
||||
ajax_request : true,
|
||||
server : PMA_commonParams.get('server'),
|
||||
@ -213,13 +206,13 @@ function deleteTemplate(id)
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('export.js', function () {
|
||||
$("#plugins").off('change');
|
||||
$("input[type='radio'][name='sql_structure_or_data']").off('change');
|
||||
$("input[type='radio'][name$='_structure_or_data']").off('change');
|
||||
$("input[type='radio'][name='output_format']").off('change');
|
||||
$("#checkbox_sql_include_comments").off('change');
|
||||
$("input[type='radio'][name='quick_or_custom']").off('change');
|
||||
$("input[type='radio'][name='allrows']").off('change');
|
||||
$('#plugins').off('change');
|
||||
$('input[type=\'radio\'][name=\'sql_structure_or_data\']').off('change');
|
||||
$('input[type=\'radio\'][name$=\'_structure_or_data\']').off('change');
|
||||
$('input[type=\'radio\'][name=\'output_format\']').off('change');
|
||||
$('#checkbox_sql_include_comments').off('change');
|
||||
$('input[type=\'radio\'][name=\'quick_or_custom\']').off('change');
|
||||
$('input[type=\'radio\'][name=\'allrows\']').off('change');
|
||||
$('#btn_alias_config').off('click');
|
||||
$('.alias_remove').off('click');
|
||||
$('#db_alias_button').off('click');
|
||||
@ -237,7 +230,6 @@ AJAX.registerTeardown('export.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('export.js', function () {
|
||||
|
||||
/**
|
||||
* Export template handling code
|
||||
*/
|
||||
@ -281,63 +273,62 @@ AJAX.registerOnload('export.js', function () {
|
||||
* Toggles the hiding and showing of each plugin's options
|
||||
* according to the currently selected plugin from the dropdown list
|
||||
*/
|
||||
$("#plugins").change(function () {
|
||||
$("#format_specific_opts").find("div.format_specific_options").hide();
|
||||
var selected_plugin_name = $("#plugins").find("option:selected").val();
|
||||
$("#" + selected_plugin_name + "_options").show();
|
||||
$('#plugins').change(function () {
|
||||
$('#format_specific_opts').find('div.format_specific_options').hide();
|
||||
var selected_plugin_name = $('#plugins').find('option:selected').val();
|
||||
$('#' + selected_plugin_name + '_options').show();
|
||||
});
|
||||
|
||||
/**
|
||||
* Toggles the enabling and disabling of the SQL plugin's comment options that apply only when exporting structure
|
||||
*/
|
||||
$("input[type='radio'][name='sql_structure_or_data']").change(function () {
|
||||
var comments_are_present = $("#checkbox_sql_include_comments").prop("checked");
|
||||
var show = $("input[type='radio'][name='sql_structure_or_data']:checked").val();
|
||||
$('input[type=\'radio\'][name=\'sql_structure_or_data\']').change(function () {
|
||||
var comments_are_present = $('#checkbox_sql_include_comments').prop('checked');
|
||||
var show = $('input[type=\'radio\'][name=\'sql_structure_or_data\']:checked').val();
|
||||
if (show == 'data') {
|
||||
// disable the SQL comment options
|
||||
if (comments_are_present) {
|
||||
$("#checkbox_sql_dates").prop('disabled', true).parent().fadeTo('fast', 0.4);
|
||||
$('#checkbox_sql_dates').prop('disabled', true).parent().fadeTo('fast', 0.4);
|
||||
}
|
||||
$("#checkbox_sql_relation").prop('disabled', true).parent().fadeTo('fast', 0.4);
|
||||
$("#checkbox_sql_mime").prop('disabled', true).parent().fadeTo('fast', 0.4);
|
||||
$('#checkbox_sql_relation').prop('disabled', true).parent().fadeTo('fast', 0.4);
|
||||
$('#checkbox_sql_mime').prop('disabled', true).parent().fadeTo('fast', 0.4);
|
||||
} else {
|
||||
// enable the SQL comment options
|
||||
if (comments_are_present) {
|
||||
$("#checkbox_sql_dates").prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
$('#checkbox_sql_dates').prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
}
|
||||
$("#checkbox_sql_relation").prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
$("#checkbox_sql_mime").prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
$('#checkbox_sql_relation').prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
$('#checkbox_sql_mime').prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
}
|
||||
|
||||
if (show == 'structure') {
|
||||
$('#checkbox_sql_auto_increment').prop('disabled', true).parent().fadeTo('fast', 0.4);
|
||||
} else {
|
||||
$("#checkbox_sql_auto_increment").prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
$('#checkbox_sql_auto_increment').prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
}
|
||||
});
|
||||
|
||||
// For separate-file exports only ZIP compression is allowed
|
||||
$('input[type="checkbox"][name="as_separate_files"]').change(function(){
|
||||
$('input[type="checkbox"][name="as_separate_files"]').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#compression').val('zip');
|
||||
}
|
||||
});
|
||||
|
||||
$('#compression').change(function(){
|
||||
$('#compression').change(function () {
|
||||
if ($('option:selected').val() !== 'zip') {
|
||||
$('input[type="checkbox"][name="as_separate_files"]').prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function setup_table_structure_or_data() {
|
||||
if ($("input[name='export_type']").val() != 'database') {
|
||||
function setup_table_structure_or_data () {
|
||||
if ($('input[name=\'export_type\']').val() != 'database') {
|
||||
return;
|
||||
}
|
||||
var pluginName = $("#plugins").find("option:selected").val();
|
||||
var formElemName = pluginName + "_structure_or_data";
|
||||
var force_structure_or_data = !($("input[name='" + formElemName + "_default']").length);
|
||||
var pluginName = $('#plugins').find('option:selected').val();
|
||||
var formElemName = pluginName + '_structure_or_data';
|
||||
var force_structure_or_data = !($('input[name=\'' + formElemName + '_default\']').length);
|
||||
|
||||
if (force_structure_or_data === true) {
|
||||
$('input[name="structure_or_data_forced"]').val(1);
|
||||
@ -385,13 +376,12 @@ function setup_table_structure_or_data() {
|
||||
* Toggles the hiding and showing of plugin structure-specific and data-specific
|
||||
* options
|
||||
*/
|
||||
function toggle_structure_data_opts()
|
||||
{
|
||||
var pluginName = $("select#plugins").val();
|
||||
var radioFormName = pluginName + "_structure_or_data";
|
||||
var dataDiv = "#" + pluginName + "_data";
|
||||
var structureDiv = "#" + pluginName + "_structure";
|
||||
var show = $("input[type='radio'][name='" + radioFormName + "']:checked").val();
|
||||
function toggle_structure_data_opts () {
|
||||
var pluginName = $('select#plugins').val();
|
||||
var radioFormName = pluginName + '_structure_or_data';
|
||||
var dataDiv = '#' + pluginName + '_data';
|
||||
var structureDiv = '#' + pluginName + '_structure';
|
||||
var show = $('input[type=\'radio\'][name=\'' + radioFormName + '\']:checked').val();
|
||||
if (show == 'data') {
|
||||
$(dataDiv).slideDown('slow');
|
||||
$(structureDiv).slideUp('slow');
|
||||
@ -408,48 +398,46 @@ function toggle_structure_data_opts()
|
||||
/**
|
||||
* Toggles the disabling of the "save to file" options
|
||||
*/
|
||||
function toggle_save_to_file()
|
||||
{
|
||||
var $ulSaveAsfile = $("#ul_save_asfile");
|
||||
if (!$("#radio_dump_asfile").prop("checked")) {
|
||||
$ulSaveAsfile.find("> li").fadeTo('fast', 0.4);
|
||||
$ulSaveAsfile.find("> li > input").prop('disabled', true);
|
||||
$ulSaveAsfile.find("> li > select").prop('disabled', true);
|
||||
function toggle_save_to_file () {
|
||||
var $ulSaveAsfile = $('#ul_save_asfile');
|
||||
if (!$('#radio_dump_asfile').prop('checked')) {
|
||||
$ulSaveAsfile.find('> li').fadeTo('fast', 0.4);
|
||||
$ulSaveAsfile.find('> li > input').prop('disabled', true);
|
||||
$ulSaveAsfile.find('> li > select').prop('disabled', true);
|
||||
} else {
|
||||
$ulSaveAsfile.find("> li").fadeTo('fast', 1);
|
||||
$ulSaveAsfile.find("> li > input").prop('disabled', false);
|
||||
$ulSaveAsfile.find("> 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);
|
||||
}
|
||||
}
|
||||
|
||||
AJAX.registerOnload('export.js', function () {
|
||||
toggle_save_to_file();
|
||||
$("input[type='radio'][name='output_format']").change(toggle_save_to_file);
|
||||
$('input[type=\'radio\'][name=\'output_format\']').change(toggle_save_to_file);
|
||||
});
|
||||
|
||||
/**
|
||||
* For SQL plugin, toggles the disabling of the "display comments" options
|
||||
*/
|
||||
function toggle_sql_include_comments()
|
||||
{
|
||||
$("#checkbox_sql_include_comments").change(function () {
|
||||
var $ulIncludeComments = $("#ul_include_comments");
|
||||
if (!$("#checkbox_sql_include_comments").prop("checked")) {
|
||||
$ulIncludeComments.find("> li").fadeTo('fast', 0.4);
|
||||
$ulIncludeComments.find("> li > input").prop('disabled', true);
|
||||
function toggle_sql_include_comments () {
|
||||
$('#checkbox_sql_include_comments').change(function () {
|
||||
var $ulIncludeComments = $('#ul_include_comments');
|
||||
if (!$('#checkbox_sql_include_comments').prop('checked')) {
|
||||
$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").prop('disabled', false).parent("li").fadeTo('fast', 1);
|
||||
if ($('#radio_sql_structure_or_data_data').prop('checked')) {
|
||||
$('#text_sql_header_comment').prop('disabled', false).parent('li').fadeTo('fast', 1);
|
||||
} else {
|
||||
$ulIncludeComments.find("> li").fadeTo('fast', 1);
|
||||
$ulIncludeComments.find("> li > input").prop('disabled', false);
|
||||
$ulIncludeComments.find('> li').fadeTo('fast', 1);
|
||||
$ulIncludeComments.find('> li > input').prop('disabled', false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function check_table_select_all() {
|
||||
function check_table_select_all () {
|
||||
var total = $('input[name="table_select[]"]').length;
|
||||
var str_checked = $('input[name="table_structure[]"]:checked').length;
|
||||
var data_checked = $('input[name="table_data[]"]:checked').length;
|
||||
@ -458,34 +446,34 @@ function check_table_select_all() {
|
||||
|
||||
if (str_checked == total) {
|
||||
str_all
|
||||
.prop("indeterminate", false)
|
||||
.prop('indeterminate', false)
|
||||
.prop('checked', true);
|
||||
} else if (str_checked === 0) {
|
||||
str_all
|
||||
.prop("indeterminate", false)
|
||||
.prop('indeterminate', false)
|
||||
.prop('checked', false);
|
||||
} else {
|
||||
str_all
|
||||
.prop("indeterminate", true)
|
||||
.prop('indeterminate', true)
|
||||
.prop('checked', false);
|
||||
}
|
||||
|
||||
if (data_checked == total) {
|
||||
data_all
|
||||
.prop("indeterminate", false)
|
||||
.prop('indeterminate', false)
|
||||
.prop('checked', true);
|
||||
} else if (data_checked === 0) {
|
||||
data_all
|
||||
.prop("indeterminate", false)
|
||||
.prop('indeterminate', false)
|
||||
.prop('checked', false);
|
||||
} else {
|
||||
data_all
|
||||
.prop("indeterminate", true)
|
||||
.prop('indeterminate', true)
|
||||
.prop('checked', false);
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_table_select_all_str() {
|
||||
function toggle_table_select_all_str () {
|
||||
var str_all = $('#table_structure_all').is(':checked');
|
||||
if (str_all) {
|
||||
$('input[name="table_structure[]"]').prop('checked', true);
|
||||
@ -494,7 +482,7 @@ function toggle_table_select_all_str() {
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_table_select_all_data() {
|
||||
function toggle_table_select_all_data () {
|
||||
var data_all = $('#table_data_all').is(':checked');
|
||||
if (data_all) {
|
||||
$('input[name="table_data[]"]').prop('checked', true);
|
||||
@ -503,13 +491,13 @@ function toggle_table_select_all_data() {
|
||||
}
|
||||
}
|
||||
|
||||
function check_selected_tables(argument) {
|
||||
$('.export_table_select tbody tr').each(function() {
|
||||
function check_selected_tables (argument) {
|
||||
$('.export_table_select tbody tr').each(function () {
|
||||
check_table_selected(this);
|
||||
});
|
||||
}
|
||||
|
||||
function check_table_selected(row) {
|
||||
function check_table_selected (row) {
|
||||
var $row = $(row);
|
||||
var table_select = $row.find('input[name="table_select[]"]');
|
||||
var str_check = $row.find('input[name="table_structure[]"]');
|
||||
@ -519,18 +507,18 @@ function check_table_selected(row) {
|
||||
var structure = str_check.is(':checked:not(:disabled)');
|
||||
|
||||
if (data && structure) {
|
||||
table_select.prop({checked: true, indeterminate: false});
|
||||
table_select.prop({ checked: true, indeterminate: false });
|
||||
$row.addClass('marked');
|
||||
} else if (data || structure) {
|
||||
table_select.prop({checked: true, indeterminate: true});
|
||||
table_select.prop({ checked: true, indeterminate: true });
|
||||
$row.removeClass('marked');
|
||||
} else {
|
||||
table_select.prop({checked: false, indeterminate: false});
|
||||
table_select.prop({ checked: false, indeterminate: false });
|
||||
$row.removeClass('marked');
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_table_select(row) {
|
||||
function toggle_table_select (row) {
|
||||
var $row = $(row);
|
||||
var table_selected = $row.find('input[name="table_select[]"]').is(':checked');
|
||||
|
||||
@ -543,7 +531,7 @@ function toggle_table_select(row) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleAddProcCheckbox() {
|
||||
function handleAddProcCheckbox () {
|
||||
if ($('#table_structure_all').is(':checked') === true
|
||||
&& $('#table_data_all').is(':checked') === true
|
||||
) {
|
||||
@ -557,13 +545,13 @@ 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");
|
||||
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.prop('checked', $(this).prop('checked'));
|
||||
});
|
||||
$create_options.change(function () {
|
||||
if ($create_options.is(":checked")) {
|
||||
if ($create_options.is(':checked')) {
|
||||
$create.prop('checked', true);
|
||||
}
|
||||
});
|
||||
@ -571,57 +559,57 @@ AJAX.registerOnload('export.js', function () {
|
||||
/**
|
||||
* Disables the view output as text option if the output must be saved as a file
|
||||
*/
|
||||
$("#plugins").change(function () {
|
||||
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) {
|
||||
$("#radio_dump_asfile").prop('checked', true);
|
||||
$('#plugins').change(function () {
|
||||
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) {
|
||||
$('#radio_dump_asfile').prop('checked', true);
|
||||
toggle_save_to_file();
|
||||
}
|
||||
$("#radio_view_as_text").prop('disabled', true).parent().fadeTo('fast', 0.4);
|
||||
$('#radio_view_as_text').prop('disabled', true).parent().fadeTo('fast', 0.4);
|
||||
} else {
|
||||
$("#radio_view_as_text").prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
$('#radio_view_as_text').prop('disabled', false).parent().fadeTo('fast', 1);
|
||||
}
|
||||
});
|
||||
|
||||
$("input[type='radio'][name$='_structure_or_data']").on('change', function () {
|
||||
$('input[type=\'radio\'][name$=\'_structure_or_data\']').on('change', function () {
|
||||
toggle_structure_data_opts();
|
||||
});
|
||||
|
||||
$('input[name="table_select[]"]').on('change', function() {
|
||||
$('input[name="table_select[]"]').on('change', function () {
|
||||
toggle_table_select($(this).closest('tr'));
|
||||
check_table_select_all();
|
||||
handleAddProcCheckbox();
|
||||
});
|
||||
|
||||
$('input[name="table_structure[]"]').on('change', function() {
|
||||
$('input[name="table_structure[]"]').on('change', function () {
|
||||
check_table_selected($(this).closest('tr'));
|
||||
check_table_select_all();
|
||||
handleAddProcCheckbox();
|
||||
});
|
||||
|
||||
$('input[name="table_data[]"]').on('change', function() {
|
||||
$('input[name="table_data[]"]').on('change', function () {
|
||||
check_table_selected($(this).closest('tr'));
|
||||
check_table_select_all();
|
||||
handleAddProcCheckbox();
|
||||
});
|
||||
|
||||
$('#table_structure_all').on('change', function() {
|
||||
$('#table_structure_all').on('change', function () {
|
||||
toggle_table_select_all_str();
|
||||
check_selected_tables();
|
||||
handleAddProcCheckbox();
|
||||
});
|
||||
|
||||
$('#table_data_all').on('change', function() {
|
||||
$('#table_data_all').on('change', function () {
|
||||
toggle_table_select_all_data();
|
||||
check_selected_tables();
|
||||
handleAddProcCheckbox();
|
||||
});
|
||||
|
||||
if ($("input[name='export_type']").val() == 'database') {
|
||||
if ($('input[name=\'export_type\']').val() == 'database') {
|
||||
// Hide structure or data radio buttons
|
||||
$("input[type='radio'][name$='_structure_or_data']").each(function() {
|
||||
$('input[type=\'radio\'][name$=\'_structure_or_data\']').each(function () {
|
||||
var $this = $(this);
|
||||
var name = $this.prop('name');
|
||||
var val = $('input[name="' + name + '"]:checked').val();
|
||||
@ -639,7 +627,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
$this.parent().remove();
|
||||
}
|
||||
});
|
||||
$("input[type='radio'][name$='_structure_or_data']").remove();
|
||||
$('input[type=\'radio\'][name$=\'_structure_or_data\']').remove();
|
||||
|
||||
// Disable CREATE table checkbox for sql
|
||||
var createTableCheckbox = $('#checkbox_sql_create_table');
|
||||
@ -660,47 +648,45 @@ AJAX.registerOnload('export.js', function () {
|
||||
/**
|
||||
* Handle force structure_or_data
|
||||
*/
|
||||
$("#plugins").change(setup_table_structure_or_data);
|
||||
$('#plugins').change(setup_table_structure_or_data);
|
||||
});
|
||||
|
||||
/**
|
||||
* Toggles display of options when quick and custom export are selected
|
||||
*/
|
||||
function toggle_quick_or_custom()
|
||||
{
|
||||
if ($("input[name='quick_or_custom']").length === 0 // custom_no_form option
|
||||
|| $("#radio_custom_export").prop("checked") // custom
|
||||
function toggle_quick_or_custom () {
|
||||
if ($('input[name=\'quick_or_custom\']').length === 0 // custom_no_form option
|
||||
|| $('#radio_custom_export').prop('checked') // custom
|
||||
) {
|
||||
$("#databases_and_tables").show();
|
||||
$("#rows").show();
|
||||
$("#output").show();
|
||||
$("#format_specific_opts").show();
|
||||
$("#output_quick_export").hide();
|
||||
var selected_plugin_name = $("#plugins").find("option:selected").val();
|
||||
$("#" + selected_plugin_name + "_options").show();
|
||||
$('#databases_and_tables').show();
|
||||
$('#rows').show();
|
||||
$('#output').show();
|
||||
$('#format_specific_opts').show();
|
||||
$('#output_quick_export').hide();
|
||||
var selected_plugin_name = $('#plugins').find('option:selected').val();
|
||||
$('#' + selected_plugin_name + '_options').show();
|
||||
} else { // quick
|
||||
$("#databases_and_tables").hide();
|
||||
$("#rows").hide();
|
||||
$("#output").hide();
|
||||
$("#format_specific_opts").hide();
|
||||
$("#output_quick_export").show();
|
||||
$('#databases_and_tables').hide();
|
||||
$('#rows').hide();
|
||||
$('#output').hide();
|
||||
$('#format_specific_opts').hide();
|
||||
$('#output_quick_export').show();
|
||||
}
|
||||
}
|
||||
var time_out;
|
||||
function check_time_out(time_limit)
|
||||
{
|
||||
function check_time_out (time_limit) {
|
||||
if (typeof time_limit === 'undefined' || time_limit === 0) {
|
||||
return true;
|
||||
}
|
||||
//margin of one second to avoid race condition to set/access session variable
|
||||
// margin of one second to avoid race condition to set/access session variable
|
||||
time_limit = time_limit + 1;
|
||||
var href = "export.php";
|
||||
var href = 'export.php';
|
||||
var params = {
|
||||
'ajax_request' : true,
|
||||
'check_time_out' : true
|
||||
};
|
||||
clearTimeout(time_out);
|
||||
time_out = setTimeout(function(){
|
||||
time_out = setTimeout(function () {
|
||||
$.get(href, params, function (data) {
|
||||
if (data.message === 'timeout') {
|
||||
PMA_ajaxShowMessage(
|
||||
@ -712,7 +698,6 @@ function check_time_out(time_limit)
|
||||
}
|
||||
});
|
||||
}, time_limit * 1000);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -722,7 +707,7 @@ function check_time_out(time_limit)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function aliasSelectHandler(event) {
|
||||
function aliasSelectHandler (event) {
|
||||
var sel = event.data.sel;
|
||||
var type = event.data.type;
|
||||
var inputId = $(this).val();
|
||||
@ -748,7 +733,7 @@ function aliasSelectHandler(event) {
|
||||
} else if (type === '_tables') {
|
||||
$('.table_alias_select:visible').change();
|
||||
}
|
||||
$("#alias_modal").dialog("option", "position", "center");
|
||||
$('#alias_modal').dialog('option', 'position', 'center');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -758,20 +743,20 @@ function aliasSelectHandler(event) {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function createAliasModal(event) {
|
||||
function createAliasModal (event) {
|
||||
event.preventDefault();
|
||||
var dlgButtons = {};
|
||||
dlgButtons[PMA_messages.strSaveAndClose] = function() {
|
||||
$(this).dialog("close");
|
||||
dlgButtons[PMA_messages.strSaveAndClose] = function () {
|
||||
$(this).dialog('close');
|
||||
$('#alias_modal').parent().appendTo($('form[name="dump"]'));
|
||||
};
|
||||
$('#alias_modal').dialog({
|
||||
width: Math.min($(window).width() - 100, 700),
|
||||
maxHeight: $(window).height(),
|
||||
modal: true,
|
||||
dialogClass: "alias-dialog",
|
||||
dialogClass: 'alias-dialog',
|
||||
buttons: dlgButtons,
|
||||
create: function() {
|
||||
create: function () {
|
||||
$(this).css('maxHeight', $(window).height() - 150);
|
||||
var db = PMA_commonParams.get('db');
|
||||
if (db) {
|
||||
@ -799,9 +784,9 @@ function createAliasModal(event) {
|
||||
});
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
close: function () {
|
||||
var isEmpty = true;
|
||||
$(this).find('input[type="text"]').each(function() {
|
||||
$(this).find('input[type="text"]').each(function () {
|
||||
// trim empty input fields on close
|
||||
if ($(this).val()) {
|
||||
isEmpty = false;
|
||||
@ -812,11 +797,11 @@ function createAliasModal(event) {
|
||||
// Toggle checkbox based on aliases
|
||||
$('input#btn_alias_config').prop('checked', !isEmpty);
|
||||
},
|
||||
position: { my: "center top", at: "center top", of: window }
|
||||
position: { my: 'center top', at: 'center top', of: window }
|
||||
});
|
||||
}
|
||||
|
||||
function aliasToggleRow(elm) {
|
||||
function aliasToggleRow (elm) {
|
||||
var inputs = elm.parents('tr').find('input,button');
|
||||
if (elm.val()) {
|
||||
inputs.attr('disabled', false);
|
||||
@ -825,7 +810,7 @@ function aliasToggleRow(elm) {
|
||||
}
|
||||
}
|
||||
|
||||
function addAlias(type, name, field, value) {
|
||||
function addAlias (type, name, field, value) {
|
||||
if (value === '') {
|
||||
return;
|
||||
}
|
||||
@ -848,17 +833,17 @@ function addAlias(type, name, field, value) {
|
||||
}
|
||||
|
||||
AJAX.registerOnload('export.js', function () {
|
||||
$("input[type='radio'][name='quick_or_custom']").change(toggle_quick_or_custom);
|
||||
$('input[type=\'radio\'][name=\'quick_or_custom\']').change(toggle_quick_or_custom);
|
||||
|
||||
$("#scroll_to_options_msg").hide();
|
||||
$("#format_specific_opts").find("div.format_specific_options")
|
||||
$('#scroll_to_options_msg').hide();
|
||||
$('#format_specific_opts').find('div.format_specific_options')
|
||||
.hide()
|
||||
.css({
|
||||
"border": 0,
|
||||
"margin": 0,
|
||||
"padding": 0
|
||||
'border': 0,
|
||||
'margin': 0,
|
||||
'padding': 0
|
||||
})
|
||||
.find("h3")
|
||||
.find('h3')
|
||||
.remove();
|
||||
toggle_quick_or_custom();
|
||||
toggle_structure_data_opts();
|
||||
@ -874,8 +859,8 @@ AJAX.registerOnload('export.js', function () {
|
||||
/**
|
||||
* Disables the "Dump some row(s)" sub-options when it is not selected
|
||||
*/
|
||||
$("input[type='radio'][name='allrows']").change(function () {
|
||||
if ($("input[type='radio'][name='allrows']").prop("checked")) {
|
||||
$('input[type=\'radio\'][name=\'allrows\']').change(function () {
|
||||
if ($('input[type=\'radio\'][name=\'allrows\']').prop('checked')) {
|
||||
enable_dump_some_rows_sub_options();
|
||||
} else {
|
||||
disable_dump_some_rows_sub_options();
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
AJAX.registerOnload('export_output.js', function() {
|
||||
$(document).on("keydown", function(e) {
|
||||
AJAX.registerOnload('export_output.js', function () {
|
||||
$(document).on('keydown', function (e) {
|
||||
if ((e.which || e.keyCode) === 116) {
|
||||
e.preventDefault();
|
||||
$("#export_refresh_form").submit();
|
||||
$('#export_refresh_form').submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
1255
js/functions.js
1255
js/functions.js
File diff suppressed because it is too large
Load Diff
@ -11,9 +11,9 @@ var gisEditorLoaded = false;
|
||||
/**
|
||||
* Closes the GIS data editor and perform necessary clean up work.
|
||||
*/
|
||||
function closeGISEditor() {
|
||||
$("#popup_background").fadeOut("fast");
|
||||
$("#gis_editor").fadeOut("fast", function () {
|
||||
function closeGISEditor () {
|
||||
$('#popup_background').fadeOut('fast');
|
||||
$('#gis_editor').fadeOut('fast', function () {
|
||||
$(this).empty();
|
||||
});
|
||||
}
|
||||
@ -21,9 +21,9 @@ function closeGISEditor() {
|
||||
/**
|
||||
* Prepares the HTML received via AJAX.
|
||||
*/
|
||||
function prepareJSVersion() {
|
||||
function prepareJSVersion () {
|
||||
// Change the text on the submit button
|
||||
$("#gis_editor").find("input[name='gis_data[save]']")
|
||||
$('#gis_editor').find('input[name=\'gis_data[save]\']')
|
||||
.val(PMA_messages.strCopy)
|
||||
.insertAfter($('#gis_data_textarea'))
|
||||
.before('<br/><br/>');
|
||||
@ -31,7 +31,7 @@ function prepareJSVersion() {
|
||||
// Add close and cancel links
|
||||
$('#gis_data_editor').prepend('<a class="close_gis_editor" href="#">' + PMA_messages.strClose + '</a>');
|
||||
$('<a class="cancel_gis_editor" href="#"> ' + PMA_messages.strCancel + '</a>')
|
||||
.insertAfter($("input[name='gis_data[save]']"));
|
||||
.insertAfter($('input[name=\'gis_data[save]\']'));
|
||||
|
||||
// Remove the unnecessary text
|
||||
$('div#gis_data_output p').remove();
|
||||
@ -56,7 +56,7 @@ function prepareJSVersion() {
|
||||
* @param prefix prefix of the name
|
||||
* @returns the HTML for a data point
|
||||
*/
|
||||
function addDataPoint(pointNumber, prefix) {
|
||||
function addDataPoint (pointNumber, prefix) {
|
||||
return '<br/>' +
|
||||
PMA_sprintf(PMA_messages.strPointN, (pointNumber + 1)) + ': ' +
|
||||
'<label for="x">' + PMA_messages.strX + '</label>' +
|
||||
@ -68,7 +68,7 @@ function addDataPoint(pointNumber, prefix) {
|
||||
/**
|
||||
* Initialize the visualization in the GIS data editor.
|
||||
*/
|
||||
function initGISEditorVisualization() {
|
||||
function initGISEditorVisualization () {
|
||||
// Loads either SVG or OSM visualization based on the choice
|
||||
selectVisualization();
|
||||
// Adds necessary styles to the div that coontains the openStreetMap
|
||||
@ -89,15 +89,15 @@ function initGISEditorVisualization() {
|
||||
* @param input_name name of the input field
|
||||
* @param token token
|
||||
*/
|
||||
function loadJSAndGISEditor(value, field, type, input_name) {
|
||||
function loadJSAndGISEditor (value, field, type, input_name) {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var script;
|
||||
|
||||
// Loads a set of small JS file needed for the GIS editor
|
||||
var smallScripts = [ 'js/vendor/jquery/jquery.svg.js',
|
||||
'js/vendor/jquery/jquery.mousewheel.js',
|
||||
'js/vendor/jquery/jquery.event.drag-2.2.js',
|
||||
'js/tbl_gis_visualization.js' ];
|
||||
var smallScripts = ['js/vendor/jquery/jquery.svg.js',
|
||||
'js/vendor/jquery/jquery.mousewheel.js',
|
||||
'js/vendor/jquery/jquery.event.drag-2.2.js',
|
||||
'js/tbl_gis_visualization.js'];
|
||||
|
||||
for (var i = 0; i < smallScripts.length; i++) {
|
||||
script = document.createElement('script');
|
||||
@ -119,9 +119,9 @@ function loadJSAndGISEditor(value, field, type, input_name) {
|
||||
script.onload = function () {
|
||||
loadGISEditor(value, field, type, input_name);
|
||||
};
|
||||
script.onerror = function() {
|
||||
script.onerror = function () {
|
||||
loadGISEditor(value, field, type, input_name);
|
||||
}
|
||||
};
|
||||
|
||||
script.src = 'js/vendor/openlayers/OpenLayers.js';
|
||||
head.appendChild(script);
|
||||
@ -137,9 +137,8 @@ function loadJSAndGISEditor(value, field, type, input_name) {
|
||||
* @param type geometry type
|
||||
* @param input_name name of the input field
|
||||
*/
|
||||
function loadGISEditor(value, field, type, input_name) {
|
||||
|
||||
var $gis_editor = $("#gis_editor");
|
||||
function loadGISEditor (value, field, type, input_name) {
|
||||
var $gis_editor = $('#gis_editor');
|
||||
$.post('gis_data_editor.php', {
|
||||
'field' : field,
|
||||
'value' : value,
|
||||
@ -161,8 +160,7 @@ function loadGISEditor(value, field, type, input_name) {
|
||||
/**
|
||||
* Opens up the dialog for the GIS data editor.
|
||||
*/
|
||||
function openGISEditor() {
|
||||
|
||||
function openGISEditor () {
|
||||
// Center the popup
|
||||
var windowWidth = document.documentElement.clientWidth;
|
||||
var windowHeight = document.documentElement.clientHeight;
|
||||
@ -171,11 +169,11 @@ function openGISEditor() {
|
||||
var popupOffsetTop = windowHeight / 2 - popupHeight / 2;
|
||||
var popupOffsetLeft = windowWidth / 2 - popupWidth / 2;
|
||||
|
||||
var $gis_editor = $("#gis_editor");
|
||||
var $backgrouond = $("#popup_background");
|
||||
var $gis_editor = $('#gis_editor');
|
||||
var $backgrouond = $('#popup_background');
|
||||
|
||||
$gis_editor.css({"top": popupOffsetTop, "left": popupOffsetLeft, "width": popupWidth, "height": popupHeight});
|
||||
$backgrouond.css({"opacity" : "0.7"});
|
||||
$gis_editor.css({ 'top': popupOffsetTop, 'left': popupOffsetLeft, 'width': popupWidth, 'height': popupHeight });
|
||||
$backgrouond.css({ 'opacity' : '0.7' });
|
||||
|
||||
$gis_editor.append(
|
||||
'<div id="gis_data_editor">' +
|
||||
@ -185,21 +183,21 @@ function openGISEditor() {
|
||||
);
|
||||
|
||||
// Make it appear
|
||||
$backgrouond.fadeIn("fast");
|
||||
$gis_editor.fadeIn("fast");
|
||||
$backgrouond.fadeIn('fast');
|
||||
$gis_editor.fadeIn('fast');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and insert the GIS data in Well Known Text format
|
||||
* to the input field.
|
||||
*/
|
||||
function insertDataAndClose() {
|
||||
function insertDataAndClose () {
|
||||
var $form = $('form#gis_data_editor_form');
|
||||
var input_name = $form.find("input[name='input_name']").val();
|
||||
var input_name = $form.find('input[name=\'input_name\']').val();
|
||||
|
||||
$.post('gis_data_editor.php', $form.serialize() + "&generate=true&ajax_request=true", function (data) {
|
||||
$.post('gis_data_editor.php', $form.serialize() + '&generate=true&ajax_request=true', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$("input[name='" + input_name + "']").val(data.result);
|
||||
$('input[name=\'' + input_name + '\']').val(data.result);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
@ -211,10 +209,10 @@ function insertDataAndClose() {
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('gis_data_editor.js', function () {
|
||||
$(document).off('click', "#gis_editor input[name='gis_data[save]']");
|
||||
$(document).off('click', '#gis_editor input[name=\'gis_data[save]\']');
|
||||
$(document).off('submit', '#gis_editor');
|
||||
$(document).off('change', "#gis_editor input[type='text']");
|
||||
$(document).off('change', "#gis_editor select.gis_type");
|
||||
$(document).off('change', '#gis_editor input[type=\'text\']');
|
||||
$(document).off('change', '#gis_editor select.gis_type');
|
||||
$(document).off('click', '#gis_editor a.close_gis_editor, #gis_editor a.cancel_gis_editor');
|
||||
$(document).off('click', '#gis_editor a.addJs.addPoint');
|
||||
$(document).off('click', '#gis_editor a.addLine.addJs');
|
||||
@ -223,14 +221,13 @@ AJAX.registerTeardown('gis_data_editor.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
|
||||
// Remove the class that is added due to the URL being too long.
|
||||
$('span.open_gis_editor a').removeClass('formLinkSubmit');
|
||||
|
||||
/**
|
||||
* Prepares and insert the GIS data to the input field on clicking 'copy'.
|
||||
*/
|
||||
$(document).on('click', "#gis_editor input[name='gis_data[save]']", function (event) {
|
||||
$(document).on('click', '#gis_editor input[name=\'gis_data[save]\']', function (event) {
|
||||
event.preventDefault();
|
||||
insertDataAndClose();
|
||||
});
|
||||
@ -246,9 +243,9 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
/**
|
||||
* Trigger asynchronous calls on data change and update the output.
|
||||
*/
|
||||
$(document).on('change', "#gis_editor input[type='text']", function () {
|
||||
$(document).on('change', '#gis_editor input[type=\'text\']', function () {
|
||||
var $form = $('form#gis_data_editor_form');
|
||||
$.post('gis_data_editor.php', $form.serialize() + "&generate=true&ajax_request=true", function (data) {
|
||||
$.post('gis_data_editor.php', $form.serialize() + '&generate=true&ajax_request=true', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('#gis_data_textarea').val(data.result);
|
||||
$('#placeholder').empty().removeClass('hasSVG').html(data.visualization);
|
||||
@ -265,11 +262,11 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
/**
|
||||
* Update the form on change of the GIS type.
|
||||
*/
|
||||
$(document).on('change', "#gis_editor select.gis_type", function (event) {
|
||||
var $gis_editor = $("#gis_editor");
|
||||
$(document).on('change', '#gis_editor select.gis_type', function (event) {
|
||||
var $gis_editor = $('#gis_editor');
|
||||
var $form = $('form#gis_data_editor_form');
|
||||
|
||||
$.post('gis_data_editor.php', $form.serialize() + "&get_gis_editor=true&ajax_request=true", function (data) {
|
||||
$.post('gis_data_editor.php', $form.serialize() + '&get_gis_editor=true&ajax_request=true', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$gis_editor.html(data.gis_editor);
|
||||
initGISEditorVisualization();
|
||||
@ -296,7 +293,7 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
// Eg. name = gis_data[0][MULTIPOINT][add_point] => prefix = gis_data[0][MULTIPOINT]
|
||||
var prefix = name.substr(0, name.length - 11);
|
||||
// Find the number of points
|
||||
var $noOfPointsInput = $("input[name='" + prefix + "[no_of_points]" + "']");
|
||||
var $noOfPointsInput = $('input[name=\'' + prefix + '[no_of_points]' + '\']');
|
||||
var noOfPoints = parseInt($noOfPointsInput.val(), 10);
|
||||
// Add the new data point
|
||||
var html = addDataPoint(noOfPoints, prefix);
|
||||
@ -316,7 +313,7 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
var type = prefix.slice(prefix.lastIndexOf('[') + 1, prefix.lastIndexOf(']'));
|
||||
|
||||
// Find the number of lines
|
||||
var $noOfLinesInput = $("input[name='" + prefix + "[no_of_lines]" + "']");
|
||||
var $noOfLinesInput = $('input[name=\'' + prefix + '[no_of_lines]' + '\']');
|
||||
var noOfLines = parseInt($noOfLinesInput.val(), 10);
|
||||
|
||||
// Add the new linesting of inner ring based on the type
|
||||
@ -349,7 +346,7 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
// Eg. name = gis_data[0][MULTIPOLYGON][add_polygon] => prefix = gis_data[0][MULTIPOLYGON]
|
||||
var prefix = name.substr(0, name.length - 13);
|
||||
// Find the number of polygons
|
||||
var $noOfPolygonsInput = $("input[name='" + prefix + "[no_of_polygons]" + "']");
|
||||
var $noOfPolygonsInput = $('input[name=\'' + prefix + '[no_of_polygons]' + '\']');
|
||||
var noOfPolygons = parseInt($noOfPolygonsInput.val(), 10);
|
||||
|
||||
// Add the new polygon
|
||||
@ -376,11 +373,11 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
var $a = $(this);
|
||||
var prefix = 'gis_data[GEOMETRYCOLLECTION]';
|
||||
// Find the number of geoms
|
||||
var $noOfGeomsInput = $("input[name='" + prefix + "[geom_count]" + "']");
|
||||
var $noOfGeomsInput = $('input[name=\'' + prefix + '[geom_count]' + '\']');
|
||||
var noOfGeoms = parseInt($noOfGeomsInput.val(), 10);
|
||||
|
||||
var html1 = PMA_messages.strGeometry + ' ' + (noOfGeoms + 1) + ':<br/>';
|
||||
var $geomType = $("select[name='gis_data[" + (noOfGeoms - 1) + "][gis_type]']").clone();
|
||||
var $geomType = $('select[name=\'gis_data[' + (noOfGeoms - 1) + '][gis_type]\']').clone();
|
||||
$geomType.attr('name', 'gis_data[' + noOfGeoms + '][gis_type]').val('POINT');
|
||||
var html2 = '<br/>' + PMA_messages.strPoint + ' :' +
|
||||
'<label for="x"> ' + PMA_messages.strX + ' </label>' +
|
||||
|
||||
107
js/import.js
107
js/import.js
@ -9,17 +9,16 @@
|
||||
* Toggles the hiding and showing of each plugin's options
|
||||
* according to the currently selected plugin from the dropdown list
|
||||
*/
|
||||
function changePluginOpts()
|
||||
{
|
||||
$("#format_specific_opts").find("div.format_specific_options").each(function () {
|
||||
function changePluginOpts () {
|
||||
$('#format_specific_opts').find('div.format_specific_options').each(function () {
|
||||
$(this).hide();
|
||||
});
|
||||
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);
|
||||
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);
|
||||
} else {
|
||||
$("#import_notification").text("");
|
||||
$('#import_notification').text('');
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,18 +26,17 @@ function changePluginOpts()
|
||||
* Toggles the hiding and showing of each plugin's options and sets the selected value
|
||||
* in the plugin dropdown list according to the format of the selected file
|
||||
*/
|
||||
function matchFile(fname)
|
||||
{
|
||||
var fname_array = fname.toLowerCase().split(".");
|
||||
function matchFile (fname) {
|
||||
var fname_array = fname.toLowerCase().split('.');
|
||||
var len = fname_array.length;
|
||||
if (len !== 0) {
|
||||
var extension = fname_array[len - 1];
|
||||
if (extension == "gz" || extension == "bz2" || extension == "zip") {
|
||||
if (extension == 'gz' || extension == 'bz2' || extension == 'zip') {
|
||||
len--;
|
||||
}
|
||||
// Only toggle if the format of the file can be imported
|
||||
if ($("select[name='format'] option").filterByValue(fname_array[len - 1]).length == 1) {
|
||||
$("select[name='format'] option").filterByValue(fname_array[len - 1]).prop('selected', true);
|
||||
if ($('select[name=\'format\'] option').filterByValue(fname_array[len - 1]).length == 1) {
|
||||
$('select[name=\'format\'] option').filterByValue(fname_array[len - 1]).prop('selected', true);
|
||||
changePluginOpts();
|
||||
}
|
||||
}
|
||||
@ -48,69 +46,69 @@ function matchFile(fname)
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('import.js', function () {
|
||||
$("#plugins").off('change');
|
||||
$("#input_import_file").off('change');
|
||||
$("#select_local_import_file").off('change');
|
||||
$("#input_import_file").off('change').off('focus');
|
||||
$("#select_local_import_file").off('focus');
|
||||
$("#text_csv_enclosed").add("#text_csv_escaped").off('keyup');
|
||||
$('#plugins').off('change');
|
||||
$('#input_import_file').off('change');
|
||||
$('#select_local_import_file').off('change');
|
||||
$('#input_import_file').off('change').off('focus');
|
||||
$('#select_local_import_file').off('focus');
|
||||
$('#text_csv_enclosed').add('#text_csv_escaped').off('keyup');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('import.js', function () {
|
||||
// import_file_form validation.
|
||||
$(document).on('submit', '#import_file_form', function (event) {
|
||||
var radioLocalImport = $("#radio_local_import_file");
|
||||
var radioImport = $("#radio_import_file");
|
||||
var radioLocalImport = $('#radio_local_import_file');
|
||||
var radioImport = $('#radio_import_file');
|
||||
var fileMsg = '<div class="error"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error" /> ' + PMA_messages.strImportDialogMessage + '</div>';
|
||||
|
||||
if (radioLocalImport.length !== 0) {
|
||||
// remote upload.
|
||||
|
||||
if (radioImport.is(":checked") && $("#input_import_file").val() === '') {
|
||||
$("#input_import_file").focus();
|
||||
if (radioImport.is(':checked') && $('#input_import_file').val() === '') {
|
||||
$('#input_import_file').focus();
|
||||
PMA_ajaxShowMessage(fileMsg, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (radioLocalImport.is(":checked")) {
|
||||
if ($("#select_local_import_file").length === 0) {
|
||||
if (radioLocalImport.is(':checked')) {
|
||||
if ($('#select_local_import_file').length === 0) {
|
||||
PMA_ajaxShowMessage('<div class="error"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error" /> ' + PMA_messages.strNoImportFile + ' </div>', false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("#select_local_import_file").val() === '') {
|
||||
$("#select_local_import_file").focus();
|
||||
if ($('#select_local_import_file').val() === '') {
|
||||
$('#select_local_import_file').focus();
|
||||
PMA_ajaxShowMessage(fileMsg, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// local upload.
|
||||
if ($("#input_import_file").val() === '') {
|
||||
$("#input_import_file").focus();
|
||||
if ($('#input_import_file').val() === '') {
|
||||
$('#input_import_file').focus();
|
||||
PMA_ajaxShowMessage(fileMsg, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// show progress bar.
|
||||
$("#upload_form_status").css("display", "inline");
|
||||
$("#upload_form_status_info").css("display", "inline");
|
||||
$('#upload_form_status').css('display', 'inline');
|
||||
$('#upload_form_status_info').css('display', 'inline');
|
||||
});
|
||||
|
||||
// Initially display the options for the selected plugin
|
||||
changePluginOpts();
|
||||
|
||||
// Whenever the selected plugin changes, change the options displayed
|
||||
$("#plugins").change(function () {
|
||||
// Whenever the selected plugin changes, change the options displayed
|
||||
$('#plugins').change(function () {
|
||||
changePluginOpts();
|
||||
});
|
||||
|
||||
$("#input_import_file").change(function () {
|
||||
$('#input_import_file').change(function () {
|
||||
matchFile($(this).val());
|
||||
});
|
||||
|
||||
$("#select_local_import_file").change(function () {
|
||||
$('#select_local_import_file').change(function () {
|
||||
matchFile($(this).val());
|
||||
});
|
||||
|
||||
@ -118,41 +116,40 @@ AJAX.registerOnload('import.js', function () {
|
||||
* When the "Browse the server" form is clicked or the "Select from the web server upload directory"
|
||||
* form is clicked, the radio button beside it becomes selected and the other form becomes disabled.
|
||||
*/
|
||||
$("#input_import_file").on("focus change", function () {
|
||||
$("#radio_import_file").prop('checked', true);
|
||||
$("#radio_local_import_file").prop('checked', false);
|
||||
$('#input_import_file').on('focus change', function () {
|
||||
$('#radio_import_file').prop('checked', true);
|
||||
$('#radio_local_import_file').prop('checked', false);
|
||||
});
|
||||
$("#select_local_import_file").focus(function () {
|
||||
$("#radio_local_import_file").prop('checked', true);
|
||||
$("#radio_import_file").prop('checked', false);
|
||||
$('#select_local_import_file').focus(function () {
|
||||
$('#radio_local_import_file').prop('checked', true);
|
||||
$('#radio_import_file').prop('checked', false);
|
||||
});
|
||||
|
||||
/**
|
||||
* Set up the interface for Javascript-enabled browsers since the default is for
|
||||
* Javascript-disabled browsers
|
||||
*/
|
||||
$("#scroll_to_options_msg").hide();
|
||||
$("#format_specific_opts").find("div.format_specific_options")
|
||||
.css({
|
||||
"border": 0,
|
||||
"margin": 0,
|
||||
"padding": 0
|
||||
})
|
||||
.find("h3")
|
||||
.remove();
|
||||
//$("form[name=import] *").unwrap();
|
||||
$('#scroll_to_options_msg').hide();
|
||||
$('#format_specific_opts').find('div.format_specific_options')
|
||||
.css({
|
||||
'border': 0,
|
||||
'margin': 0,
|
||||
'padding': 0
|
||||
})
|
||||
.find('h3')
|
||||
.remove();
|
||||
// $("form[name=import] *").unwrap();
|
||||
|
||||
/**
|
||||
* for input element text_csv_enclosed and text_csv_escaped allow just one character to enter.
|
||||
* as mysql allows just one character for these fields,
|
||||
* if first character is escape then allow two including escape character.
|
||||
*/
|
||||
$("#text_csv_enclosed").add("#text_csv_escaped").on('keyup', function() {
|
||||
if($(this).val().length === 2 && $(this).val().charAt(0) !== "\\") {
|
||||
$('#text_csv_enclosed').add('#text_csv_escaped').on('keyup', function () {
|
||||
if ($(this).val().length === 2 && $(this).val().charAt(0) !== '\\') {
|
||||
$(this).val($(this).val().substring(0, 1));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
129
js/indexes.js
129
js/indexes.js
@ -13,8 +13,7 @@
|
||||
*
|
||||
* @param index_choice index choice
|
||||
*/
|
||||
function PMA_getIndexArray(index_choice)
|
||||
{
|
||||
function PMA_getIndexArray (index_choice) {
|
||||
var source_array = null;
|
||||
|
||||
switch (index_choice.toLowerCase()) {
|
||||
@ -43,8 +42,7 @@ function PMA_getIndexArray(index_choice)
|
||||
* Hides/shows the inputs and submits appropriately depending
|
||||
* on whether the index type chosen is 'SPATIAL' or not.
|
||||
*/
|
||||
function checkIndexType()
|
||||
{
|
||||
function checkIndexType () {
|
||||
/**
|
||||
* @var Object Dropdown to select the index choice.
|
||||
*/
|
||||
@ -118,7 +116,7 @@ function checkIndexType()
|
||||
$select_index_choice.val() == 'FULLTEXT') {
|
||||
$select_index_type.val('').prop('disabled', true);
|
||||
} else {
|
||||
$select_index_type.prop('disabled', false)
|
||||
$select_index_type.prop('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,8 +128,7 @@ function checkIndexType()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_setIndexFormParameters(source_array, index_choice)
|
||||
{
|
||||
function PMA_setIndexFormParameters (source_array, index_choice) {
|
||||
if (index_choice == 'index') {
|
||||
$('input[name="indexes"]').val(JSON.stringify(source_array));
|
||||
} else {
|
||||
@ -146,8 +143,7 @@ function PMA_setIndexFormParameters(source_array, index_choice)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_removeColumnFromIndex(col_index)
|
||||
{
|
||||
function PMA_removeColumnFromIndex (col_index) {
|
||||
// Get previous index details.
|
||||
var previous_index = $('select[name="field_key[' + col_index + ']"]')
|
||||
.attr('data-index');
|
||||
@ -160,7 +156,7 @@ function PMA_removeColumnFromIndex(col_index)
|
||||
|
||||
// Remove column from index array.
|
||||
var source_length = source_array[previous_index[1]].columns.length;
|
||||
for (var i=0; i<source_length; i++) {
|
||||
for (var i = 0; i < source_length; i++) {
|
||||
if (source_array[previous_index[1]].columns[i].col_index == col_index) {
|
||||
source_array[previous_index[1]].columns.splice(i, 1);
|
||||
}
|
||||
@ -188,8 +184,7 @@ function PMA_removeColumnFromIndex(col_index)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_addColumnToIndex(source_array, array_index, index_choice, col_index)
|
||||
{
|
||||
function PMA_addColumnToIndex (source_array, array_index, index_choice, col_index) {
|
||||
if (col_index >= 0) {
|
||||
// Remove column from other indexes (if any).
|
||||
PMA_removeColumnFromIndex(col_index);
|
||||
@ -257,8 +252,7 @@ function PMA_addColumnToIndex(source_array, array_index, index_choice, col_index
|
||||
*
|
||||
* @return jQuery Object
|
||||
*/
|
||||
function PMA_getCompositeIndexList(source_array, col_index)
|
||||
{
|
||||
function PMA_getCompositeIndexList (source_array, col_index) {
|
||||
// Remove any previous list.
|
||||
if ($('#composite_index_list').length) {
|
||||
$('#composite_index_list').remove();
|
||||
@ -274,10 +268,10 @@ function PMA_getCompositeIndexList(source_array, col_index)
|
||||
// Add each column to list available for composite index.
|
||||
var source_length = source_array.length;
|
||||
var already_present = false;
|
||||
for (var i=0; i<source_length; i++) {
|
||||
for (var i = 0; i < source_length; i++) {
|
||||
var sub_array_len = source_array[i].columns.length;
|
||||
var column_names = [];
|
||||
for (var j=0; j<sub_array_len; j++) {
|
||||
for (var j = 0; j < sub_array_len; j++) {
|
||||
column_names.push(
|
||||
$('input[name="field_name[' + source_array[i].columns[j].col_index + ']"]').val()
|
||||
);
|
||||
@ -312,8 +306,7 @@ function PMA_getCompositeIndexList(source_array, col_index)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_showAddIndexDialog(source_array, array_index, target_columns, col_index, index)
|
||||
{
|
||||
function PMA_showAddIndexDialog (source_array, array_index, target_columns, col_index, index) {
|
||||
// Prepare post-data.
|
||||
var $table = $('input[name="table"]');
|
||||
var table = $table.length > 0 ? $table.val() : '';
|
||||
@ -327,7 +320,7 @@ function PMA_showAddIndexDialog(source_array, array_index, target_columns, col_i
|
||||
};
|
||||
|
||||
var columns = {};
|
||||
for (var i=0; i<target_columns.length; i++) {
|
||||
for (var i = 0; i < target_columns.length; i++) {
|
||||
var column_name = $('input[name="field_name[' + target_columns[i] + ']"]').val();
|
||||
var column_type = $('select[name="field_type[' + target_columns[i] + ']"]').val().toLowerCase();
|
||||
columns[column_name] = [column_type, target_columns[i]];
|
||||
@ -377,41 +370,41 @@ function PMA_showAddIndexDialog(source_array, array_index, target_columns, col_i
|
||||
$(this).dialog('close');
|
||||
};
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
$.post("tbl_indexes.php", post_data, function (data) {
|
||||
$.post('tbl_indexes.php', post_data, function (data) {
|
||||
if (data.success === false) {
|
||||
//in the case of an error, show the error message returned.
|
||||
// in the case of an error, show the error message returned.
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
// Show dialog if the request was successful
|
||||
var $div = $('<div/>');
|
||||
$div
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: PMA_messages.strAddIndex,
|
||||
width: 450,
|
||||
minHeight: 250,
|
||||
open: function () {
|
||||
checkIndexName("index_frm");
|
||||
PMA_showHints($div);
|
||||
PMA_init_slider();
|
||||
$('#index_columns').find('td').each(function () {
|
||||
$(this).css("width", $(this).width() + 'px');
|
||||
});
|
||||
$('#index_columns').find('tbody').sortable({
|
||||
axis: 'y',
|
||||
containment: $("#index_columns").find("tbody"),
|
||||
tolerance: 'pointer'
|
||||
});
|
||||
// We dont need the slider at this moment.
|
||||
$(this).find('fieldset.tblFooters').remove();
|
||||
},
|
||||
modal: true,
|
||||
buttons: button_options,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: PMA_messages.strAddIndex,
|
||||
width: 450,
|
||||
minHeight: 250,
|
||||
open: function () {
|
||||
checkIndexName('index_frm');
|
||||
PMA_showHints($div);
|
||||
PMA_init_slider();
|
||||
$('#index_columns').find('td').each(function () {
|
||||
$(this).css('width', $(this).width() + 'px');
|
||||
});
|
||||
$('#index_columns').find('tbody').sortable({
|
||||
axis: 'y',
|
||||
containment: $('#index_columns').find('tbody'),
|
||||
tolerance: 'pointer'
|
||||
});
|
||||
// We dont need the slider at this moment.
|
||||
$(this).find('fieldset.tblFooters').remove();
|
||||
},
|
||||
modal: true,
|
||||
buttons: button_options,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -425,8 +418,7 @@ function PMA_showAddIndexDialog(source_array, array_index, target_columns, col_i
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_indexTypeSelectionDialog(source_array, index_choice, col_index)
|
||||
{
|
||||
function PMA_indexTypeSelectionDialog (source_array, index_choice, col_index) {
|
||||
var $single_column_radio = $('<input type="radio" id="single_column" name="index_choice"' +
|
||||
' checked="checked">' +
|
||||
'<label for="single_column">' + PMA_messages.strCreateSingleColumnIndex + '</label>');
|
||||
@ -468,13 +460,13 @@ function PMA_indexTypeSelectionDialog(source_array, index_choice, col_index)
|
||||
var array_index = $('input[name="composite_with"]:checked').val();
|
||||
var source_length = source_array[array_index].columns.length;
|
||||
var target_columns = [];
|
||||
for (var i=0; i<source_length; i++) {
|
||||
for (var i = 0; i < source_length; i++) {
|
||||
target_columns.push(source_array[array_index].columns[i].col_index);
|
||||
}
|
||||
target_columns.push(col_index);
|
||||
|
||||
PMA_showAddIndexDialog(source_array, array_index, target_columns, col_index,
|
||||
source_array[array_index]);
|
||||
source_array[array_index]);
|
||||
}
|
||||
|
||||
$(this).remove();
|
||||
@ -528,7 +520,7 @@ AJAX.registerTeardown('indexes.js', function () {
|
||||
$(document).off('click', '#preview_index_frm');
|
||||
$(document).off('change', '#select_index_choice');
|
||||
$(document).off('click', 'a.drop_primary_key_index_anchor.ajax');
|
||||
$(document).off('click', "#table_index tbody tr td.edit_index.ajax, #index_div .add_index.ajax");
|
||||
$(document).off('click', '#table_index tbody tr td.edit_index.ajax, #index_div .add_index.ajax');
|
||||
$(document).off('click', '#index_frm input[type=submit]');
|
||||
$('body').off('change', 'select[name*="field_key"]');
|
||||
$(document).off('click', '.show_index_dialog');
|
||||
@ -557,14 +549,14 @@ AJAX.registerOnload('indexes.js', function () {
|
||||
PMA_hideShowConnection($engine_selector);
|
||||
}
|
||||
|
||||
var $form = $("#index_frm");
|
||||
var $form = $('#index_frm');
|
||||
if ($form.length > 0) {
|
||||
showIndexEditDialog($form);
|
||||
}
|
||||
|
||||
$(document).on('click', '#save_index_frm', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $("#index_frm");
|
||||
var $form = $('#index_frm');
|
||||
var submitData = $form.serialize() + '&do_save_data=1&ajax_request=true&ajax_page_request=true';
|
||||
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
AJAX.source = $form;
|
||||
@ -579,7 +571,7 @@ AJAX.registerOnload('indexes.js', function () {
|
||||
$(document).on('change', '#select_index_choice', function (event) {
|
||||
event.preventDefault();
|
||||
checkIndexType();
|
||||
checkIndexName("index_frm");
|
||||
checkIndexName('index_frm');
|
||||
});
|
||||
|
||||
/**
|
||||
@ -625,7 +617,7 @@ AJAX.registerOnload('indexes.js', function () {
|
||||
$table_ref.siblings('div.notice').hide('medium');
|
||||
} else {
|
||||
// We are removing some of the rows only
|
||||
$rows_to_hide.hide("medium", function () {
|
||||
$rows_to_hide.hide('medium', function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
@ -639,23 +631,23 @@ AJAX.registerOnload('indexes.js', function () {
|
||||
PMA_highlightSQL($('#page_content'));
|
||||
}
|
||||
PMA_commonActions.refreshMain(false, function () {
|
||||
$("a.ajax[href^=#indexes]").click();
|
||||
$('a.ajax[href^=#indexes]').click();
|
||||
});
|
||||
PMA_reloadNavigation();
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}); // end $.PMA_confirm()
|
||||
}); //end Drop Primary Key/Index
|
||||
}); // end Drop Primary Key/Index
|
||||
|
||||
/**
|
||||
*Ajax event handler for index edit
|
||||
**/
|
||||
$(document).on('click', "#table_index tbody tr td.edit_index.ajax, #index_div .add_index.ajax", function (event) {
|
||||
$(document).on('click', '#table_index tbody tr td.edit_index.ajax, #index_div .add_index.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var url, title;
|
||||
if ($(this).find("a").length === 0) {
|
||||
if ($(this).find('a').length === 0) {
|
||||
// Add index
|
||||
var valid = checkFormElementInRange(
|
||||
$(this).closest('form')[0],
|
||||
@ -669,17 +661,17 @@ AJAX.registerOnload('indexes.js', function () {
|
||||
title = PMA_messages.strAddIndex;
|
||||
} else {
|
||||
// Edit index
|
||||
url = $(this).find("a").attr("href");
|
||||
if (url.substring(0, 16) == "tbl_indexes.php?") {
|
||||
url = $(this).find('a').attr('href');
|
||||
if (url.substring(0, 16) == 'tbl_indexes.php?') {
|
||||
url = url.substring(16, url.length);
|
||||
}
|
||||
title = PMA_messages.strEditIndex;
|
||||
}
|
||||
url += "&ajax_request=true";
|
||||
url += '&ajax_request=true';
|
||||
indexEditorDialog(url, title, function () {
|
||||
// refresh the page using ajax
|
||||
PMA_commonActions.refreshMain(false, function () {
|
||||
$("a.ajax[href^=#indexes]").click();
|
||||
$('a.ajax[href^=#indexes]').click();
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -720,13 +712,13 @@ AJAX.registerOnload('indexes.js', function () {
|
||||
var array_index = 0;
|
||||
var source_length = source_array[array_index].columns.length;
|
||||
var target_columns = [];
|
||||
for (var i=0; i<source_length; i++) {
|
||||
for (var i = 0; i < source_length; i++) {
|
||||
target_columns.push(source_array[array_index].columns[i].col_index);
|
||||
}
|
||||
target_columns.push(col_index);
|
||||
|
||||
PMA_showAddIndexDialog(source_array, array_index, target_columns, col_index,
|
||||
source_array[array_index]);
|
||||
source_array[array_index]);
|
||||
} else {
|
||||
// If there are multiple columns selected for an index, show advanced dialog.
|
||||
PMA_indexTypeSelectionDialog(source_array, index_choice, col_index);
|
||||
@ -757,7 +749,8 @@ AJAX.registerOnload('indexes.js', function () {
|
||||
});
|
||||
|
||||
$('#index_frm').on('submit', function () {
|
||||
if (typeof(this.elements['index[Key_name]'].disabled) != 'undefined')
|
||||
if (typeof(this.elements['index[Key_name]'].disabled) !== 'undefined') {
|
||||
this.elements['index[Key_name]'].disabled = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
(function($) {
|
||||
"use strict";
|
||||
(function ($) {
|
||||
'use strict';
|
||||
var formatByte = function (val, index) {
|
||||
var units = [
|
||||
PMA_messages.strB,
|
||||
@ -43,4 +43,4 @@
|
||||
}
|
||||
};
|
||||
};
|
||||
})(jQuery);
|
||||
}(jQuery));
|
||||
|
||||
@ -8,31 +8,29 @@ var ctrlKeyHistory = 0;
|
||||
*
|
||||
* @param object event data
|
||||
*/
|
||||
function onKeyDownArrowsHandler(e)
|
||||
{
|
||||
function onKeyDownArrowsHandler (e) {
|
||||
e = e || window.event;
|
||||
|
||||
var o = (e.srcElement || e.target);
|
||||
if (!o) {
|
||||
return;
|
||||
}
|
||||
if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") {
|
||||
if (o.tagName != 'TEXTAREA' && o.tagName != 'INPUT' && o.tagName != 'SELECT') {
|
||||
return;
|
||||
}
|
||||
if ((e.which != 17) && (e.which != 37) && (e.which != 38) && (e.which != 39) && (e.which !=40)) {
|
||||
if ((e.which != 17) && (e.which != 37) && (e.which != 38) && (e.which != 39) && (e.which != 40)) {
|
||||
return;
|
||||
}
|
||||
if (!o.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.type == "keyup") {
|
||||
if (e.which==17) {
|
||||
if (e.type == 'keyup') {
|
||||
if (e.which == 17) {
|
||||
ctrlKeyHistory = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (e.type == "keydown") {
|
||||
} else if (e.type == 'keydown') {
|
||||
if (e.which == 17) {
|
||||
ctrlKeyHistory = 1;
|
||||
}
|
||||
@ -44,8 +42,8 @@ function onKeyDownArrowsHandler(e)
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var pos = o.id.split("_");
|
||||
if (pos[0] != "field" || typeof pos[2] == "undefined") {
|
||||
var pos = o.id.split('_');
|
||||
if (pos[0] != 'field' || typeof pos[2] === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -72,13 +70,13 @@ function onKeyDownArrowsHandler(e)
|
||||
return;
|
||||
}
|
||||
|
||||
var is_firefox = navigator.userAgent.toLowerCase().indexOf("firefox/") > -1;
|
||||
var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox/') > -1;
|
||||
|
||||
var id = "field_" + y + "_" + x;
|
||||
var id = 'field_' + y + '_' + x;
|
||||
|
||||
var nO = document.getElementById(id);
|
||||
if (! nO) {
|
||||
id = "field_" + y + "_" + x + "_0";
|
||||
id = 'field_' + y + '_' + x + '_0';
|
||||
nO = document.getElementById(id);
|
||||
}
|
||||
|
||||
@ -97,7 +95,7 @@ function onKeyDownArrowsHandler(e)
|
||||
var ffcheck = 0;
|
||||
var ffversion;
|
||||
for (ffversion = 3 ; ffversion < 25 ; ffversion++) {
|
||||
var is_firefox_v_24 = navigator.userAgent.toLowerCase().indexOf('firefox/'+ffversion) > -1;
|
||||
var is_firefox_v_24 = navigator.userAgent.toLowerCase().indexOf('firefox/' + ffversion) > -1;
|
||||
if (is_firefox_v_24) {
|
||||
ffcheck = 1;
|
||||
break;
|
||||
@ -106,20 +104,17 @@ function onKeyDownArrowsHandler(e)
|
||||
if (ffcheck == 1) {
|
||||
if (e.which == 38 || e.which == 37) {
|
||||
nOvalue++;
|
||||
}
|
||||
else if (e.which == 40 || e.which == 39) {
|
||||
} else if (e.which == 40 || e.which == 39) {
|
||||
nOvalue--;
|
||||
}
|
||||
nO.selectedIndex=nOvalue;
|
||||
}
|
||||
else {
|
||||
nO.selectedIndex = nOvalue;
|
||||
} else {
|
||||
if (e.which == 38 || e.which == 37) {
|
||||
lvalue++;
|
||||
}
|
||||
else if (e.which == 40 || e.which == 39) {
|
||||
} else if (e.which == 40 || e.which == 39) {
|
||||
lvalue--;
|
||||
}
|
||||
o.selectedIndex=lvalue;
|
||||
o.selectedIndex = lvalue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
282
js/makegrid.js
282
js/makegrid.js
@ -14,15 +14,15 @@
|
||||
* @param enableVisib Optional, if false, show/hide column feature will be disabled
|
||||
* @param enableGridEdit Optional, if false, grid editing feature will be disabled
|
||||
*/
|
||||
function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdit) {
|
||||
function PMA_makegrid (t, enableResize, enableReorder, enableVisib, enableGridEdit) {
|
||||
var g = {
|
||||
/***********
|
||||
/** *********
|
||||
* Constant
|
||||
***********/
|
||||
minColWidth: 15,
|
||||
|
||||
|
||||
/***********
|
||||
/** *********
|
||||
* Variables, assigned with default value, changed later
|
||||
***********/
|
||||
actionSpan: 5, // number of colspan in Actions header in a table
|
||||
@ -67,7 +67,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
table: null,
|
||||
|
||||
|
||||
/************
|
||||
/** **********
|
||||
* Functions
|
||||
************/
|
||||
|
||||
@ -159,8 +159,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
// show the column pointer in the right place
|
||||
var colPos = $(hoveredCol).position();
|
||||
var newleft = newn < g.colReorder.n ?
|
||||
colPos.left :
|
||||
colPos.left + $(hoveredCol).outerWidth();
|
||||
colPos.left :
|
||||
colPos.left + $(hoveredCol).outerWidth();
|
||||
$(g.cPointer)
|
||||
.css({
|
||||
left: newleft,
|
||||
@ -236,7 +236,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.t).find('tr').each(function () {
|
||||
$(this).find('th.draggable:visible:eq(' + n + ') span,' +
|
||||
'td:visible:eq(' + (g.actionSpan + n) + ') span')
|
||||
.css('width', nw);
|
||||
.css('width', nw);
|
||||
});
|
||||
},
|
||||
|
||||
@ -251,13 +251,13 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
for (var n = 0, l = $firstRowCols.length; n < l; n++) {
|
||||
var $col = $($firstRowCols[n]);
|
||||
var colWidth;
|
||||
if (navigator.userAgent.toLowerCase().indexOf("safari") != -1) {
|
||||
if (navigator.userAgent.toLowerCase().indexOf('safari') != -1) {
|
||||
colWidth = $col.outerWidth();
|
||||
} else {
|
||||
colWidth = $col.outerWidth(true);
|
||||
}
|
||||
$($resizeHandles[n]).css('left', $col.position().left + colWidth)
|
||||
.show();
|
||||
.show();
|
||||
if ($col.hasClass('condition')) {
|
||||
$($resizeHandles[n]).addClass('condition');
|
||||
if (n > 0) {
|
||||
@ -282,12 +282,12 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
if (newn < oldn) {
|
||||
$(this).find('th.draggable:eq(' + newn + '),' +
|
||||
'td:eq(' + (g.actionSpan + newn) + ')')
|
||||
.before($(this).find('th.draggable:eq(' + oldn + '),' +
|
||||
.before($(this).find('th.draggable:eq(' + oldn + '),' +
|
||||
'td:eq(' + (g.actionSpan + oldn) + ')'));
|
||||
} else {
|
||||
$(this).find('th.draggable:eq(' + newn + '),' +
|
||||
'td:eq(' + (g.actionSpan + newn) + ')')
|
||||
.after($(this).find('th.draggable:eq(' + oldn + '),' +
|
||||
.after($(this).find('th.draggable:eq(' + oldn + '),' +
|
||||
'td:eq(' + (g.actionSpan + oldn) + ')'));
|
||||
}
|
||||
});
|
||||
@ -297,10 +297,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
// adjust the column visibility list
|
||||
if (newn < oldn) {
|
||||
$(g.cList).find('.lDiv div:eq(' + newn + ')')
|
||||
.before($(g.cList).find('.lDiv div:eq(' + oldn + ')'));
|
||||
.before($(g.cList).find('.lDiv div:eq(' + oldn + ')'));
|
||||
} else {
|
||||
$(g.cList).find('.lDiv div:eq(' + newn + ')')
|
||||
.after($(g.cList).find('.lDiv div:eq(' + oldn + ')'));
|
||||
.after($(g.cList).find('.lDiv div:eq(' + oldn + ')'));
|
||||
}
|
||||
// adjust the colOrder
|
||||
var tmp = g.colOrder[oldn];
|
||||
@ -380,16 +380,16 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
table_create_time: g.tableCreateTime
|
||||
};
|
||||
if (g.colOrder.length > 0) {
|
||||
$.extend(post_params, {col_order: g.colOrder.toString()});
|
||||
$.extend(post_params, { col_order: g.colOrder.toString() });
|
||||
}
|
||||
if (g.colVisib.length > 0) {
|
||||
$.extend(post_params, {col_visib: g.colVisib.toString()});
|
||||
$.extend(post_params, { col_visib: g.colVisib.toString() });
|
||||
}
|
||||
$.post('sql.php', post_params, function (data) {
|
||||
if (data.success !== true) {
|
||||
var $temp_div = $(document.createElement('div'));
|
||||
$temp_div.html(data.error);
|
||||
$temp_div.addClass("error");
|
||||
$temp_div.addClass('error');
|
||||
PMA_ajaxShowMessage($temp_div, false);
|
||||
}
|
||||
});
|
||||
@ -470,7 +470,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.t).find('tr').each(function () {
|
||||
$(this).find('th.draggable:eq(' + n + '),' +
|
||||
'td:eq(' + (g.actionSpan + n) + ')')
|
||||
.hide();
|
||||
.hide();
|
||||
});
|
||||
g.colVisib[n] = 0;
|
||||
$(g.cList).find('.lDiv div:eq(' + n + ') input').prop('checked', false);
|
||||
@ -483,7 +483,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.t).find('tr').each(function () {
|
||||
$(this).find('th.draggable:eq(' + n + '),' +
|
||||
'td:eq(' + (g.actionSpan + n) + ')')
|
||||
.show();
|
||||
.show();
|
||||
});
|
||||
g.colVisib[n] = 1;
|
||||
$(g.cList).find('.lDiv div:eq(' + n + ') input').prop('checked', true);
|
||||
@ -522,9 +522,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
pos.left = $(document).width() - $(g.cList).outerWidth(true);
|
||||
}
|
||||
$(g.cList).css({
|
||||
left: pos.left,
|
||||
top: pos.top + $(obj).outerHeight(true)
|
||||
})
|
||||
left: pos.left,
|
||||
top: pos.top + $(obj).outerHeight(true)
|
||||
})
|
||||
.show();
|
||||
$(obj).addClass('coldrop-hover');
|
||||
}
|
||||
@ -547,9 +547,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var $cd = $(g.cDrop).find('div:eq(' + i + ')'); // column drop-down arrow
|
||||
var pos = $($th[i]).position();
|
||||
$cd.css({
|
||||
left: pos.left + $($th[i]).width() - $cd.width(),
|
||||
top: pos.top
|
||||
});
|
||||
left: pos.left + $($th[i]).width() - $cd.width(),
|
||||
top: pos.top
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -572,8 +572,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
*/
|
||||
showEditCell: function (cell) {
|
||||
if ($(cell).is('.grid_edit') &&
|
||||
!g.colRsz && !g.colReorder)
|
||||
{
|
||||
!g.colRsz && !g.colReorder) {
|
||||
if (!g.isCellEditActive) {
|
||||
var $cell = $(cell);
|
||||
|
||||
@ -590,9 +589,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.cEdit).find('.edit_area').empty().hide();
|
||||
// reposition the cEdit element
|
||||
$(g.cEdit).css({
|
||||
top: $cell.position().top,
|
||||
left: $cell.position().left
|
||||
})
|
||||
top: $cell.position().top,
|
||||
left: $cell.position().left
|
||||
})
|
||||
.show()
|
||||
.find('.edit_box')
|
||||
.css({
|
||||
@ -601,7 +600,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
});
|
||||
// fill the cell edit with text from <td>
|
||||
var value = PMA_getCellValue(cell);
|
||||
if($cell.attr('data-type') == 'json'){
|
||||
if ($cell.attr('data-type') == 'json') {
|
||||
value = JSON.stringify(JSON.parse(value), null, 4);
|
||||
}
|
||||
$(g.cEdit).find('.edit_box').val(value);
|
||||
@ -613,7 +612,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
}
|
||||
|
||||
function moveCursorToEnd(input) {
|
||||
function moveCursorToEnd (input) {
|
||||
var originalValue = input.val();
|
||||
var originallength = originalValue.length;
|
||||
input.val('');
|
||||
@ -671,17 +670,17 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
value = value.substring(0, g.maxTruncatedLen) + '...';
|
||||
}
|
||||
|
||||
//Add <br> before carriage return.
|
||||
// Add <br> before carriage return.
|
||||
new_html = escapeHtml(value);
|
||||
new_html = new_html.replace(/\n/g, '<br>\n');
|
||||
|
||||
//remove decimal places if column type not supported
|
||||
if (($this_field.attr('data-decimals') == 0) && ( $this_field.attr('data-type').indexOf('time') != -1)) {
|
||||
// remove decimal places if column type not supported
|
||||
if (($this_field.attr('data-decimals') == 0) && ($this_field.attr('data-type').indexOf('time') != -1)) {
|
||||
new_html = new_html.substring(0, new_html.indexOf('.'));
|
||||
}
|
||||
|
||||
//remove addtional decimal places
|
||||
if (($this_field.attr('data-decimals') > 0) && ( $this_field.attr('data-type').indexOf('time') != -1)){
|
||||
// remove addtional decimal places
|
||||
if (($this_field.attr('data-decimals') > 0) && ($this_field.attr('data-type').indexOf('time') != -1)) {
|
||||
new_html = new_html.substring(0, new_html.length - (6 - $this_field.attr('data-decimals')));
|
||||
}
|
||||
|
||||
@ -846,11 +845,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
});
|
||||
}
|
||||
|
||||
//reset the position of the edit_area div after closing datetime picker
|
||||
$(g.cEdit).find('.edit_area').css({'top' :'0','position':''});
|
||||
// reset the position of the edit_area div after closing datetime picker
|
||||
$(g.cEdit).find('.edit_area').css({ 'top' :'0','position':'' });
|
||||
|
||||
if ($td.is('.relation')) {
|
||||
//handle relations
|
||||
// handle relations
|
||||
$editArea.addClass('edit_area_loading');
|
||||
|
||||
// initialize the original data
|
||||
@ -898,9 +897,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.cEdit).find('.edit_box').val($(this).val());
|
||||
});
|
||||
g.isEditCellTextEditable = true;
|
||||
}
|
||||
else if ($td.is('.enum')) {
|
||||
//handle enum fields
|
||||
} else if ($td.is('.enum')) {
|
||||
// handle enum fields
|
||||
$editArea.addClass('edit_area_loading');
|
||||
|
||||
/**
|
||||
@ -926,9 +924,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$editArea.on('change', 'select', function () {
|
||||
$(g.cEdit).find('.edit_box').val($(this).val());
|
||||
});
|
||||
}
|
||||
else if ($td.is('.set')) {
|
||||
//handle set fields
|
||||
} else if ($td.is('.set')) {
|
||||
// handle set fields
|
||||
$editArea.addClass('edit_area_loading');
|
||||
|
||||
/**
|
||||
@ -962,8 +959,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$editArea.on('change', 'select', function () {
|
||||
$(g.cEdit).find('.edit_box').val($(this).val());
|
||||
});
|
||||
}
|
||||
else if ($td.is('.truncated, .transformed')) {
|
||||
} else if ($td.is('.truncated, .transformed')) {
|
||||
if ($td.is('.to_be_saved')) { // cell has been edited
|
||||
var value = $td.data('value');
|
||||
$(g.cEdit).find('.edit_box').val(value);
|
||||
@ -978,7 +974,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
});
|
||||
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
|
||||
} else {
|
||||
//handle truncated/transformed values values
|
||||
// handle truncated/transformed values values
|
||||
$editArea.addClass('edit_area_loading');
|
||||
|
||||
// initialize the original data
|
||||
@ -1018,7 +1014,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var showMicrosec = false;
|
||||
var timeFormat = 'HH:mm:ss';
|
||||
// check for decimal places of seconds
|
||||
if (($td.attr('data-decimals') > 0) && ($td.attr('data-type').indexOf('time') != -1)){
|
||||
if (($td.attr('data-decimals') > 0) && ($td.attr('data-type').indexOf('time') != -1)) {
|
||||
if (datetime_value && datetime_value.indexOf('.') === false) {
|
||||
datetime_value += '.';
|
||||
}
|
||||
@ -1063,7 +1059,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
});
|
||||
|
||||
$input_field.datepicker("show");
|
||||
$input_field.datepicker('show');
|
||||
toggleDatepickerIfInvalid($td, $input_field);
|
||||
|
||||
// unbind the mousedown event to prevent the problem of
|
||||
@ -1071,9 +1067,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
// change in names when updating
|
||||
$(document).off('mousedown', $.datepicker._checkExternalClick);
|
||||
|
||||
//move ui-datepicker-div inside cEdit div
|
||||
// move ui-datepicker-div inside cEdit div
|
||||
var datepicker_div = $('#ui-datepicker-div');
|
||||
datepicker_div.css({'top': 0, 'left': 0, 'position': 'relative'});
|
||||
datepicker_div.css({ 'top': 0, 'left': 0, 'position': 'relative' });
|
||||
$(g.cEdit).append(datepicker_div);
|
||||
|
||||
// cancel any click on the datepicker element
|
||||
@ -1113,7 +1109,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
/**
|
||||
* @var relational_display string 'K' if relational key, 'D' if relational display column
|
||||
*/
|
||||
var relational_display = $(g.o).find("input[name=relational_display]:checked").val();
|
||||
var relational_display = $(g.o).find('input[name=relational_display]:checked').val();
|
||||
/**
|
||||
* @var transform_fields Array containing the name/value pairs for transformed fields
|
||||
*/
|
||||
@ -1221,7 +1217,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
fields.push($this_field.data('value').replace(/\n/g, '\r\n'));
|
||||
|
||||
var cell_index = $this_field.index('.to_be_saved');
|
||||
if ($this_field.is(":not(.relation, .enum, .set, .bit)")) {
|
||||
if ($this_field.is(':not(.relation, .enum, .set, .bit)')) {
|
||||
if ($this_field.is('.transformed')) {
|
||||
transform_fields[cell_index] = {};
|
||||
$.extend(transform_fields[cell_index], this_field_params);
|
||||
@ -1236,12 +1232,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var field_str = '`' + g.table + '`.' + '`' + field_name + '`';
|
||||
for (var field in condition_array) {
|
||||
if (field.indexOf(field_str) > -1) {
|
||||
condition_array[field] = is_null ? 'IS NULL' : "= '" + this_field_params[field_name].replace(/'/g, "''") + "'";
|
||||
condition_array[field] = is_null ? 'IS NULL' : '= \'' + this_field_params[field_name].replace(/'/g, '\'\'') + '\'';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}); // end of loop for every edited cells in a row
|
||||
|
||||
// save new_clause
|
||||
@ -1258,7 +1253,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
me_fields_type.push(fields_type);
|
||||
me_fields.push(fields);
|
||||
me_fields_null.push(fields_null);
|
||||
|
||||
}); // end of loop for every edited rows
|
||||
|
||||
rel_fields_list = $.param(relation_fields);
|
||||
@ -1268,24 +1262,24 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
/**
|
||||
* @var post_params Object containing parameters for the POST request
|
||||
*/
|
||||
var post_params = {'ajax_request' : true,
|
||||
'sql_query' : full_sql_query,
|
||||
'server' : g.server,
|
||||
'db' : g.db,
|
||||
'table' : g.table,
|
||||
'clause_is_unique' : is_unique,
|
||||
'where_clause' : full_where_clause,
|
||||
'fields[multi_edit]' : me_fields,
|
||||
'fields_name[multi_edit]' : me_fields_name,
|
||||
'fields_type[multi_edit]' : me_fields_type,
|
||||
'fields_null[multi_edit]' : me_fields_null,
|
||||
'rel_fields_list' : rel_fields_list,
|
||||
'do_transformations' : transformation_fields,
|
||||
'transform_fields_list' : transform_fields_list,
|
||||
'relational_display' : relational_display,
|
||||
'goto' : 'sql.php',
|
||||
'submit_type' : 'save'
|
||||
};
|
||||
var post_params = { 'ajax_request' : true,
|
||||
'sql_query' : full_sql_query,
|
||||
'server' : g.server,
|
||||
'db' : g.db,
|
||||
'table' : g.table,
|
||||
'clause_is_unique' : is_unique,
|
||||
'where_clause' : full_where_clause,
|
||||
'fields[multi_edit]' : me_fields,
|
||||
'fields_name[multi_edit]' : me_fields_name,
|
||||
'fields_type[multi_edit]' : me_fields_type,
|
||||
'fields_null[multi_edit]' : me_fields_null,
|
||||
'rel_fields_list' : rel_fields_list,
|
||||
'do_transformations' : transformation_fields,
|
||||
'transform_fields_list' : transform_fields_list,
|
||||
'relational_display' : relational_display,
|
||||
'goto' : 'sql.php',
|
||||
'submit_type' : 'save'
|
||||
};
|
||||
|
||||
if (!g.saveCellsAtOnce) {
|
||||
$(g.cEdit).find('*').prop('disabled', true);
|
||||
@ -1347,19 +1341,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
});
|
||||
});
|
||||
// update the display of executed SQL query command
|
||||
if (typeof data.sql_query != 'undefined') {
|
||||
//extract query box
|
||||
if (typeof data.sql_query !== 'undefined') {
|
||||
// extract query box
|
||||
var $result_query = $($.parseHTML(data.sql_query));
|
||||
var sqlOuter = $result_query.find('.sqlOuter').wrap('<p>').parent().html();
|
||||
var tools = $result_query.find('.tools').wrap('<p>').parent().html();
|
||||
// sqlOuter and tools will not be present if 'Show SQL queries' configuration is off
|
||||
if (typeof sqlOuter != 'undefined' && typeof tools != 'undefined') {
|
||||
if (typeof sqlOuter !== 'undefined' && typeof tools !== 'undefined') {
|
||||
$(g.o).find('.result_query:not(:last)').remove();
|
||||
var $existing_query = $(g.o).find('.result_query');
|
||||
// If two query box exists update query in second else add a second box
|
||||
if ($existing_query.find('div.sqlOuter').length > 1) {
|
||||
$existing_query.children(":nth-child(4)").remove();
|
||||
$existing_query.children(":nth-child(4)").remove();
|
||||
$existing_query.children(':nth-child(4)').remove();
|
||||
$existing_query.children(':nth-child(4)').remove();
|
||||
$existing_query.append(sqlOuter + tools);
|
||||
} else {
|
||||
$existing_query.append(sqlOuter + tools);
|
||||
@ -1387,7 +1381,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
}
|
||||
}
|
||||
}).done(function(){
|
||||
}).done(function () {
|
||||
if (options !== undefined && options.move) {
|
||||
g.showEditCell(options.cell);
|
||||
}
|
||||
@ -1437,7 +1431,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$test_element = $(g.cEdit).find('select');
|
||||
this_field_params[field_name] = $test_element.map(function () {
|
||||
return $(this).val();
|
||||
}).get().join(",");
|
||||
}).get().join(',');
|
||||
} else if ($this_field.is('.relation, .enum')) {
|
||||
// for relation and enumeration, take the results from edit box value,
|
||||
// because selected value from drop-down, new window or multiple
|
||||
@ -1589,7 +1583,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
// register events
|
||||
$(g.t).find('th.draggable')
|
||||
.mousedown(function (e) {
|
||||
$(g.o).addClass("turnOffSelect");
|
||||
$(g.o).addClass('turnOffSelect');
|
||||
if (g.visibleHeadersCount > 1) {
|
||||
g.dragStartReorder(e, this);
|
||||
}
|
||||
@ -1603,26 +1597,26 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
})
|
||||
.mouseleave(function () {
|
||||
g.showReorderHint = false;
|
||||
$(this).tooltip("option", {
|
||||
$(this).tooltip('option', {
|
||||
content: g.updateHint()
|
||||
});
|
||||
})
|
||||
.dblclick(function (e) {
|
||||
e.preventDefault();
|
||||
$("<div/>")
|
||||
.prop("title", PMA_messages.strColNameCopyTitle)
|
||||
.addClass("modal-copy")
|
||||
.text(PMA_messages.strColNameCopyText)
|
||||
.append(
|
||||
$("<input/>")
|
||||
.prop("readonly", true)
|
||||
.val($(this).data("column"))
|
||||
$('<div/>')
|
||||
.prop('title', PMA_messages.strColNameCopyTitle)
|
||||
.addClass('modal-copy')
|
||||
.text(PMA_messages.strColNameCopyText)
|
||||
.append(
|
||||
$('<input/>')
|
||||
.prop('readonly', true)
|
||||
.val($(this).data('column'))
|
||||
)
|
||||
.dialog({
|
||||
resizable: false,
|
||||
modal: true
|
||||
})
|
||||
.find("input").focus().select();
|
||||
.dialog({
|
||||
resizable: false,
|
||||
modal: true
|
||||
})
|
||||
.find('input').focus().select();
|
||||
});
|
||||
$(g.t).find('th.draggable a')
|
||||
.dblclick(function (e) {
|
||||
@ -1692,19 +1686,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
|
||||
// create column visibility drop-down arrow(s)
|
||||
$colVisibTh.each(function () {
|
||||
var $th = $(this);
|
||||
var cd = document.createElement('div'); // column drop-down arrow
|
||||
var pos = $th.position();
|
||||
$(cd).addClass('coldrop')
|
||||
.click(function () {
|
||||
if (g.cList.style.display == 'none') {
|
||||
g.showColList(this);
|
||||
} else {
|
||||
g.hideColList();
|
||||
}
|
||||
});
|
||||
$(g.cDrop).append(cd);
|
||||
});
|
||||
var $th = $(this);
|
||||
var cd = document.createElement('div'); // column drop-down arrow
|
||||
var pos = $th.position();
|
||||
$(cd).addClass('coldrop')
|
||||
.click(function () {
|
||||
if (g.cList.style.display == 'none') {
|
||||
g.showColList(this);
|
||||
} else {
|
||||
g.hideColList();
|
||||
}
|
||||
});
|
||||
$(g.cDrop).append(cd);
|
||||
});
|
||||
|
||||
// add column visibility control
|
||||
g.cList.innerHTML = '<div class="lDiv"></div>';
|
||||
@ -1759,7 +1753,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
/**
|
||||
* Move currently Editing Cell to Up
|
||||
*/
|
||||
moveUp: function(e) {
|
||||
moveUp: function (e) {
|
||||
e.preventDefault();
|
||||
var $this_field = $(g.currentEditCell);
|
||||
var field_name = getFieldName($(g.t), $this_field);
|
||||
@ -1773,7 +1767,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var $prev_row;
|
||||
var j = 0;
|
||||
|
||||
$this_field.parents('tr').first().parents('tbody').children().each(function(){
|
||||
$this_field.parents('tr').first().parents('tbody').children().each(function () {
|
||||
if ($(this).find('.where_clause').val() == where_clause) {
|
||||
found = true;
|
||||
$found_row = $(this);
|
||||
@ -1786,7 +1780,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var new_cell;
|
||||
|
||||
if (found && $prev_row) {
|
||||
$prev_row.children('td').each(function(){
|
||||
$prev_row.children('td').each(function () {
|
||||
if (getFieldName($(g.t), $(this)) == field_name) {
|
||||
new_cell = this;
|
||||
}
|
||||
@ -1794,14 +1788,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
|
||||
if (new_cell) {
|
||||
g.hideEditCell(false, false, false, {move : true, cell : new_cell});
|
||||
g.hideEditCell(false, false, false, { move : true, cell : new_cell });
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Move currently Editing Cell to Down
|
||||
*/
|
||||
moveDown: function(e) {
|
||||
moveDown: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $this_field = $(g.currentEditCell);
|
||||
@ -1816,7 +1810,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var $next_row;
|
||||
var j = 0;
|
||||
var next_row_found = false;
|
||||
$this_field.parents('tr').first().parents('tbody').children().each(function(){
|
||||
$this_field.parents('tr').first().parents('tbody').children().each(function () {
|
||||
if ($(this).find('.where_clause').val() == where_clause) {
|
||||
found = true;
|
||||
$found_row = $(this);
|
||||
@ -1833,7 +1827,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
|
||||
var new_cell;
|
||||
if (found && $next_row) {
|
||||
$next_row.children('td').each(function(){
|
||||
$next_row.children('td').each(function () {
|
||||
if (getFieldName($(g.t), $(this)) == field_name) {
|
||||
new_cell = this;
|
||||
}
|
||||
@ -1841,14 +1835,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
|
||||
if (new_cell) {
|
||||
g.hideEditCell(false, false, false, {move : true, cell : new_cell});
|
||||
g.hideEditCell(false, false, false, { move : true, cell : new_cell });
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Move currently Editing Cell to Left
|
||||
*/
|
||||
moveLeft: function(e) {
|
||||
moveLeft: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $this_field = $(g.currentEditCell);
|
||||
@ -1861,7 +1855,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var found = false;
|
||||
var $found_row;
|
||||
var j = 0;
|
||||
$this_field.parents('tr').first().parents('tbody').children().each(function(){
|
||||
$this_field.parents('tr').first().parents('tbody').children().each(function () {
|
||||
if ($(this).find('.where_clause').val() == where_clause) {
|
||||
found = true;
|
||||
$found_row = $(this);
|
||||
@ -1871,7 +1865,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var left_cell;
|
||||
var cell_found = false;
|
||||
if (found) {
|
||||
$found_row.children('td.grid_edit').each(function(){
|
||||
$found_row.children('td.grid_edit').each(function () {
|
||||
if (getFieldName($(g.t), $(this)) === field_name) {
|
||||
cell_found = true;
|
||||
}
|
||||
@ -1882,14 +1876,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
|
||||
if (left_cell) {
|
||||
g.hideEditCell(false, false, false, {move : true, cell : left_cell});
|
||||
g.hideEditCell(false, false, false, { move : true, cell : left_cell });
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Move currently Editing Cell to Right
|
||||
*/
|
||||
moveRight: function(e) {
|
||||
moveRight: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $this_field = $(g.currentEditCell);
|
||||
@ -1902,7 +1896,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var found = false;
|
||||
var $found_row;
|
||||
var j = 0;
|
||||
$this_field.parents('tr').first().parents('tbody').children().each(function(){
|
||||
$this_field.parents('tr').first().parents('tbody').children().each(function () {
|
||||
if ($(this).find('.where_clause').val() == where_clause) {
|
||||
found = true;
|
||||
$found_row = $(this);
|
||||
@ -1913,7 +1907,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var cell_found = false;
|
||||
var next_cell_found = false;
|
||||
if (found) {
|
||||
$found_row.children('td.grid_edit').each(function(){
|
||||
$found_row.children('td.grid_edit').each(function () {
|
||||
if (getFieldName($(g.t), $(this)) === field_name) {
|
||||
cell_found = true;
|
||||
}
|
||||
@ -1929,7 +1923,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
|
||||
if (right_cell) {
|
||||
g.hideEditCell(false, false, false, {move : true, cell : right_cell});
|
||||
g.hideEditCell(false, false, false, { move : true, cell : right_cell });
|
||||
}
|
||||
},
|
||||
|
||||
@ -1937,8 +1931,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
* Initialize grid editing feature.
|
||||
*/
|
||||
initGridEdit: function () {
|
||||
|
||||
function startGridEditing(e, cell) {
|
||||
function startGridEditing (e, cell) {
|
||||
if (g.isCellEditActive) {
|
||||
g.saveOrPostEditedCell();
|
||||
} else {
|
||||
@ -1947,12 +1940,12 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function handleCtrlNavigation(e) {
|
||||
if ((e.ctrlKey && e.which == 38 ) || (e.altKey && e.which == 38)) {
|
||||
function handleCtrlNavigation (e) {
|
||||
if ((e.ctrlKey && e.which == 38) || (e.altKey && e.which == 38)) {
|
||||
g.moveUp(e);
|
||||
} else if ((e.ctrlKey && e.which == 40) || (e.altKey && e.which == 40)) {
|
||||
g.moveDown(e);
|
||||
} else if ((e.ctrlKey && e.which == 37 ) || (e.altKey && e.which == 37)) {
|
||||
} else if ((e.ctrlKey && e.which == 37) || (e.altKey && e.which == 37)) {
|
||||
g.moveLeft(e);
|
||||
} else if ((e.ctrlKey && e.which == 39) || (e.altKey && e.which == 39)) {
|
||||
g.moveRight(e);
|
||||
@ -2085,7 +2078,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
}).keydown(function (e) {
|
||||
if (e.which == 27 && g.isCellEditActive) {
|
||||
|
||||
// cancel on pressing "Esc"
|
||||
g.hideEditCell(true);
|
||||
}
|
||||
@ -2115,14 +2107,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
};
|
||||
|
||||
/******************
|
||||
/** ****************
|
||||
* Initialize grid
|
||||
******************/
|
||||
|
||||
// wrap all truncated data cells with span indicating the original length
|
||||
// todo update the original length after a grid edit
|
||||
$(t).find('td.data.truncated:not(:has(span))')
|
||||
.wrapInner(function() {
|
||||
.wrapInner(function () {
|
||||
return '<span title="' + PMA_messages.strOriginalLength + ' ' +
|
||||
$(this).data('originallength') + '"></span>';
|
||||
});
|
||||
@ -2203,9 +2195,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
|
||||
// create tooltip for each <th> with draggable class
|
||||
PMA_tooltip(
|
||||
$(t).find("th.draggable"),
|
||||
'th',
|
||||
g.updateHint()
|
||||
$(t).find('th.draggable'),
|
||||
'th',
|
||||
g.updateHint()
|
||||
);
|
||||
|
||||
// register events for hint tooltip (anchors inside draggable th)
|
||||
@ -2213,14 +2205,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
.mouseenter(function () {
|
||||
g.showSortHint = true;
|
||||
g.showMultiSortHint = true;
|
||||
$(t).find("th.draggable").tooltip("option", {
|
||||
$(t).find('th.draggable').tooltip('option', {
|
||||
content: g.updateHint()
|
||||
});
|
||||
})
|
||||
.mouseleave(function () {
|
||||
g.showSortHint = false;
|
||||
g.showMultiSortHint = false;
|
||||
$(t).find("th.draggable").tooltip("option", {
|
||||
$(t).find('th.draggable').tooltip('option', {
|
||||
content: g.updateHint()
|
||||
});
|
||||
});
|
||||
@ -2231,7 +2223,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
g.dragMove(e);
|
||||
});
|
||||
$(document).mouseup(function (e) {
|
||||
$(g.o).removeClass("turnOffSelect");
|
||||
$(g.o).removeClass('turnOffSelect');
|
||||
g.dragEnd(e);
|
||||
});
|
||||
}
|
||||
@ -2245,12 +2237,12 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
* jQuery plugin to cancel selection in HTML code.
|
||||
*/
|
||||
(function ($) {
|
||||
$.fn.noSelect = function (p) { //no select plugin by Paulo P.Marinas
|
||||
$.fn.noSelect = function (p) { // no select plugin by Paulo P.Marinas
|
||||
var prevent = (p === null) ? true : p;
|
||||
var is_msie = navigator.userAgent.indexOf('MSIE') > -1 || !!window.navigator.userAgent.match(/Trident.*rv\:11\./);
|
||||
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
|
||||
var is_safari = navigator.userAgent.indexOf("Safari") > -1;
|
||||
var is_opera = navigator.userAgent.indexOf("Presto") > -1;
|
||||
var is_safari = navigator.userAgent.indexOf('Safari') > -1;
|
||||
var is_opera = navigator.userAgent.indexOf('Presto') > -1;
|
||||
if (prevent) {
|
||||
return this.each(function () {
|
||||
if (is_msie || is_safari) {
|
||||
@ -2277,5 +2269,5 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
});
|
||||
}
|
||||
}; //end noSelect
|
||||
})(jQuery);
|
||||
}; // end noSelect
|
||||
}(jQuery));
|
||||
|
||||
@ -20,21 +20,21 @@
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
(function ($) {
|
||||
function MenuResizer($container, widthCalculator) {
|
||||
function MenuResizer ($container, widthCalculator) {
|
||||
var self = this;
|
||||
self.$container = $container;
|
||||
self.widthCalculator = widthCalculator;
|
||||
var windowWidth = $(window).width();
|
||||
|
||||
if (windowWidth < 768) {
|
||||
$('#pma_navigation_resizer').css({'width': '0px'});
|
||||
$('#pma_navigation_resizer').css({ 'width': '0px' });
|
||||
}
|
||||
// Sets the image for the left and right scroll indicator
|
||||
$('.scrollindicator--left').html($(PMA_getImage('b_left.png').toString()));
|
||||
$('.scrollindicator--right').html($(PMA_getImage('b_right.png').toString()));
|
||||
|
||||
// Set the width of the navigation bar without scroll indicator
|
||||
$('.navigationbar').css({'width': widthCalculator.call($container) - 60});
|
||||
$('.navigationbar').css({ 'width': widthCalculator.call($container) - 60 });
|
||||
|
||||
// Scroll the navigation bar on click
|
||||
$('.scrollindicator--right')
|
||||
@ -47,34 +47,34 @@
|
||||
});
|
||||
|
||||
// create submenu container
|
||||
var link = $('<a />', {href: '#', 'class': 'tab nowrap'})
|
||||
var link = $('<a />', { href: '#', 'class': 'tab nowrap' })
|
||||
.text(PMA_messages.strMore)
|
||||
.on('click', false); // same as event.preventDefault()
|
||||
var img = $container.find('li img');
|
||||
if (img.length) {
|
||||
$(PMA_getImage('b_more.png').toString()).prependTo(link);
|
||||
}
|
||||
var $submenu = $('<li />', {'class': 'submenu'})
|
||||
var $submenu = $('<li />', { 'class': 'submenu' })
|
||||
.append(link)
|
||||
.append($('<ul />'))
|
||||
.mouseenter(function() {
|
||||
.mouseenter(function () {
|
||||
if ($(this).find('ul .tabactive').length === 0) {
|
||||
$(this)
|
||||
.addClass('submenuhover')
|
||||
.find('> a')
|
||||
.addClass('tabactive');
|
||||
.addClass('submenuhover')
|
||||
.find('> a')
|
||||
.addClass('tabactive');
|
||||
}
|
||||
})
|
||||
.mouseleave(function() {
|
||||
.mouseleave(function () {
|
||||
if ($(this).find('ul .tabactive').length === 0) {
|
||||
$(this)
|
||||
.removeClass('submenuhover')
|
||||
.find('> a')
|
||||
.removeClass('tabactive');
|
||||
.removeClass('submenuhover')
|
||||
.find('> a')
|
||||
.removeClass('tabactive');
|
||||
}
|
||||
});
|
||||
$container.children('.clearfloat').remove();
|
||||
$container.append($submenu).append("<div class='clearfloat'></div>");
|
||||
$container.append($submenu).append('<div class=\'clearfloat\'></div>');
|
||||
setTimeout(function () {
|
||||
self.resize();
|
||||
}, 4);
|
||||
@ -101,7 +101,7 @@
|
||||
windowWidth += 15;
|
||||
}
|
||||
var navigationwidth = wmax;
|
||||
if (windowWidth < 768){
|
||||
if (windowWidth < 768) {
|
||||
wmax = 2000;
|
||||
}
|
||||
|
||||
@ -140,13 +140,12 @@
|
||||
}
|
||||
// Show/hide the "More" tab as needed
|
||||
if (windowWidth < 768) {
|
||||
$('.navigationbar').css({'width': windowWidth - 80 - $('#pma_navigation').width()});
|
||||
$('.navigationbar').css({ 'width': windowWidth - 80 - $('#pma_navigation').width() });
|
||||
$submenu.removeClass('shown');
|
||||
$('.navigationbar').css({'overflow': 'hidden'});
|
||||
}
|
||||
else {
|
||||
$('.navigationbar').css({'width': 'auto'});
|
||||
$('.navigationbar').css({'overflow': 'visible'});
|
||||
$('.navigationbar').css({ 'overflow': 'hidden' });
|
||||
} else {
|
||||
$('.navigationbar').css({ 'width': 'auto' });
|
||||
$('.navigationbar').css({ 'overflow': 'visible' });
|
||||
if ($submenu_ul.find('li').length > 0) {
|
||||
$submenu.addClass('shown');
|
||||
} else {
|
||||
@ -163,16 +162,16 @@
|
||||
}
|
||||
if ($submenu.find('.tabactive').length) {
|
||||
$submenu
|
||||
.addClass('active')
|
||||
.find('> a')
|
||||
.removeClass('tab')
|
||||
.addClass('tabactive');
|
||||
.addClass('active')
|
||||
.find('> a')
|
||||
.removeClass('tab')
|
||||
.addClass('tabactive');
|
||||
} else {
|
||||
$submenu
|
||||
.removeClass('active')
|
||||
.find('> a')
|
||||
.addClass('tab')
|
||||
.removeClass('tabactive');
|
||||
.removeClass('active')
|
||||
.find('> a')
|
||||
.addClass('tab')
|
||||
.removeClass('tabactive');
|
||||
}
|
||||
};
|
||||
MenuResizer.prototype.destroy = function () {
|
||||
@ -183,7 +182,7 @@
|
||||
|
||||
/** Public API */
|
||||
var methods = {
|
||||
init: function(widthCalculator) {
|
||||
init: function (widthCalculator) {
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
if (! $this.data('menuResizer')) {
|
||||
@ -213,7 +212,7 @@
|
||||
};
|
||||
|
||||
/** Extend jQuery */
|
||||
$.fn.menuResizer = function(method) {
|
||||
$.fn.menuResizer = function (method) {
|
||||
if (methods[method]) {
|
||||
return methods[method].call(this);
|
||||
} else if (typeof method === 'function') {
|
||||
@ -222,4 +221,4 @@
|
||||
$.error('Method ' + method + ' does not exist on jQuery.menuResizer');
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
}(jQuery));
|
||||
|
||||
@ -223,7 +223,7 @@ PMA_MicroHistory = {
|
||||
* Allows direct bookmarking and microhistory.
|
||||
*/
|
||||
PMA_SetUrlHash = (function (jQuery, window) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
/**
|
||||
* Indictaes whether we have already completed
|
||||
* the initialisation of the hash
|
||||
@ -236,7 +236,7 @@ PMA_SetUrlHash = (function (jQuery, window) {
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
var savedHash = "";
|
||||
var savedHash = '';
|
||||
/**
|
||||
* Flag to indicate if the change of hash was triggered
|
||||
* by a user pressing the back/forward button or if
|
||||
@ -247,7 +247,7 @@ PMA_SetUrlHash = (function (jQuery, window) {
|
||||
var userChange = true;
|
||||
|
||||
// Fix favicon disappearing in Firefox when setting location.hash
|
||||
function resetFavicon() {
|
||||
function resetFavicon () {
|
||||
if (navigator.userAgent.indexOf('Firefox') > -1) {
|
||||
// Move the link tags for the favicon to the bottom
|
||||
// of the head element to force a reload of the favicon
|
||||
@ -260,7 +260,7 @@ PMA_SetUrlHash = (function (jQuery, window) {
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setUrlHash(index, hash) {
|
||||
function setUrlHash (index, hash) {
|
||||
/*
|
||||
* Known problem:
|
||||
* Setting hash leads to reload in webkit:
|
||||
@ -271,10 +271,10 @@ PMA_SetUrlHash = (function (jQuery, window) {
|
||||
|
||||
userChange = false;
|
||||
if (ready) {
|
||||
window.location.hash = "PMAURL-" + index + ":" + hash;
|
||||
window.location.hash = 'PMAURL-' + index + ':' + hash;
|
||||
resetFavicon();
|
||||
} else {
|
||||
savedHash = "PMAURL-" + index + ":" + hash;
|
||||
savedHash = 'PMAURL-' + index + ':' + hash;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@ -299,9 +299,9 @@ PMA_SetUrlHash = (function (jQuery, window) {
|
||||
// when the page finishes loading
|
||||
jQuery(function () {
|
||||
/* Check if we should set URL */
|
||||
if (savedHash !== "") {
|
||||
if (savedHash !== '') {
|
||||
window.location.hash = savedHash;
|
||||
savedHash = "";
|
||||
savedHash = '';
|
||||
resetFavicon();
|
||||
}
|
||||
// Indicate that we're done initialising
|
||||
@ -329,4 +329,4 @@ PMA_SetUrlHash = (function (jQuery, window) {
|
||||
* Publicly exposes a reference to the otherwise private setUrlHash function
|
||||
*/
|
||||
return setUrlHash;
|
||||
})(jQuery, window);
|
||||
}(jQuery, window));
|
||||
|
||||
@ -7,15 +7,14 @@
|
||||
* @requires jQuery
|
||||
*/
|
||||
|
||||
function captureURL(url)
|
||||
{
|
||||
function captureURL (url) {
|
||||
var URL = {};
|
||||
url = '' + url;
|
||||
// Exclude the url part till HTTP
|
||||
url = url.substr(url.search("sql.php"), url.length);
|
||||
url = url.substr(url.search('sql.php'), url.length);
|
||||
// The url part between ORDER BY and &session_max_rows needs to be replaced.
|
||||
URL.head = url.substr(0, url.indexOf('ORDER+BY') + 9);
|
||||
URL.tail = url.substr(url.indexOf("&session_max_rows"), url.length);
|
||||
URL.tail = url.substr(url.indexOf('&session_max_rows'), url.length);
|
||||
return URL;
|
||||
}
|
||||
|
||||
@ -26,21 +25,20 @@ function captureURL(url)
|
||||
* @param object parent HTMLDom Object
|
||||
*/
|
||||
|
||||
function removeColumnFromMultiSort(target, parent)
|
||||
{
|
||||
function removeColumnFromMultiSort (target, parent) {
|
||||
var URL = captureURL(target);
|
||||
var begin = target.indexOf('ORDER+BY') + 8;
|
||||
var end = target.indexOf('&session_max_rows');
|
||||
// get the names of the columns involved
|
||||
var between_part = target.substr(begin, end-begin);
|
||||
var between_part = target.substr(begin, end - begin);
|
||||
var columns = between_part.split('%2C+');
|
||||
// If the given column is not part of the order clause exit from this function
|
||||
var index = parent.find('small').length ? parent.find('small').text() : '';
|
||||
if (index === ''){
|
||||
if (index === '') {
|
||||
return '';
|
||||
}
|
||||
// Remove the current clicked column
|
||||
columns.splice(index-1, 1);
|
||||
columns.splice(index - 1, 1);
|
||||
// If all the columns have been removed dont submit a query with nothing
|
||||
// After order by clause.
|
||||
if (columns.length === 0) {
|
||||
@ -57,7 +55,7 @@ function removeColumnFromMultiSort(target, parent)
|
||||
}
|
||||
|
||||
AJAX.registerOnload('keyhandler.js', function () {
|
||||
$("th.draggable.column_heading.pointer.marker a").on('click', function (event) {
|
||||
$('th.draggable.column_heading.pointer.marker a').on('click', function (event) {
|
||||
var url = $(this).parent().find('input').val();
|
||||
if (event.ctrlKey || event.altKey) {
|
||||
event.preventDefault();
|
||||
@ -65,17 +63,17 @@ AJAX.registerOnload('keyhandler.js', function () {
|
||||
if (url) {
|
||||
AJAX.source = $(this);
|
||||
PMA_ajaxShowMessage();
|
||||
$.get(url, {'ajax_request' : true, 'ajax_page_request' : true}, AJAX.responseHandler);
|
||||
$.get(url, { 'ajax_request' : true, 'ajax_page_request' : true }, AJAX.responseHandler);
|
||||
}
|
||||
} else if (event.shiftKey) {
|
||||
event.preventDefault();
|
||||
AJAX.source = $(this);
|
||||
PMA_ajaxShowMessage();
|
||||
$.get(url, {'ajax_request' : true, 'ajax_page_request' : true}, AJAX.responseHandler);
|
||||
$.get(url, { 'ajax_request' : true, 'ajax_page_request' : true }, AJAX.responseHandler);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
AJAX.registerTeardown('keyhandler.js', function () {
|
||||
$(document).off('click', "th.draggable.column_heading.pointer.marker a");
|
||||
$(document).off('click', 'th.draggable.column_heading.pointer.marker a');
|
||||
});
|
||||
|
||||
175
js/navigation.js
175
js/navigation.js
@ -10,7 +10,7 @@
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
function navTreeStateUpdate() {
|
||||
function navTreeStateUpdate () {
|
||||
// update if session storage is supported
|
||||
if (isStorageSupported('sessionStorage')) {
|
||||
var storage = window.sessionStorage;
|
||||
@ -20,7 +20,7 @@ function navTreeStateUpdate() {
|
||||
storage.setItem('navTreePaths', JSON.stringify(traverseNavigationForPaths()));
|
||||
storage.setItem('server', PMA_commonParams.get('server'));
|
||||
storage.setItem('token', PMA_commonParams.get('token'));
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
// storage capacity exceeded & old navigation tree
|
||||
// state is no more valid, so remove it
|
||||
storage.removeItem('navTreePaths');
|
||||
@ -36,7 +36,7 @@ function navTreeStateUpdate() {
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
function navFilterStateUpdate(filterName, filterValue) {
|
||||
function navFilterStateUpdate (filterName, filterValue) {
|
||||
if (isStorageSupported('sessionStorage')) {
|
||||
var storage = window.sessionStorage;
|
||||
try {
|
||||
@ -57,7 +57,7 @@ function navFilterStateUpdate(filterName, filterValue) {
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
function navFilterStateRestore() {
|
||||
function navFilterStateRestore () {
|
||||
if (isStorageSupported('sessionStorage')
|
||||
&& typeof window.sessionStorage.navTreeSearchFilters !== 'undefined'
|
||||
) {
|
||||
@ -66,14 +66,14 @@ function navFilterStateRestore() {
|
||||
return;
|
||||
}
|
||||
// restore database filter if present and not empty
|
||||
if (searchClauses.hasOwnProperty("dbFilter")
|
||||
if (searchClauses.hasOwnProperty('dbFilter')
|
||||
&& searchClauses.dbFilter.length
|
||||
) {
|
||||
$obj = $('#pma_navigation_tree');
|
||||
if (! $obj.data('fastFilter')) {
|
||||
$obj.data(
|
||||
'fastFilter',
|
||||
new PMA_fastFilter.filter($obj, "")
|
||||
new PMA_fastFilter.filter($obj, '')
|
||||
);
|
||||
}
|
||||
$obj.find('li.fast_filter.db_fast_filter input.searchClause')
|
||||
@ -96,14 +96,14 @@ function navFilterStateRestore() {
|
||||
// clear state if item is not visible,
|
||||
// happens when table filter becomes invisible
|
||||
// as db filter has already been applied
|
||||
if (! $obj.is(":visible")) {
|
||||
navFilterStateUpdate(filterName, "");
|
||||
if (! $obj.is(':visible')) {
|
||||
navFilterStateUpdate(filterName, '');
|
||||
return true;
|
||||
}
|
||||
if (! $obj.data('fastFilter')) {
|
||||
$obj.data(
|
||||
'fastFilter',
|
||||
new PMA_fastFilter.filter($obj, "")
|
||||
new PMA_fastFilter.filter($obj, '')
|
||||
);
|
||||
}
|
||||
$(this).val(searchClauses[filterName])
|
||||
@ -122,8 +122,7 @@ function navFilterStateRestore() {
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
function loadChildNodes(isNode, $expandElem, callback) {
|
||||
|
||||
function loadChildNodes (isNode, $expandElem, callback) {
|
||||
var $destination = null;
|
||||
var params = null;
|
||||
|
||||
@ -182,10 +181,10 @@ function loadChildNodes(isNode, $expandElem, callback) {
|
||||
$('#pma_errors').replaceWith(data._errors);
|
||||
}
|
||||
}
|
||||
if (callback && typeof callback == 'function') {
|
||||
if (callback && typeof callback === 'function') {
|
||||
callback(data);
|
||||
}
|
||||
} else if(data.redirect_flag == "1") {
|
||||
} else if (data.redirect_flag == '1') {
|
||||
if (window.location.href.indexOf('?') === -1) {
|
||||
window.location.href += '?session_expired=1';
|
||||
} else {
|
||||
@ -209,7 +208,7 @@ function loadChildNodes(isNode, $expandElem, callback) {
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
function collapseTreeNode($expandElem) {
|
||||
function collapseTreeNode ($expandElem) {
|
||||
var $children = $expandElem.closest('li').children('div.list_container');
|
||||
var $icon = $expandElem.find('img');
|
||||
if ($expandElem.hasClass('loaded')) {
|
||||
@ -229,7 +228,7 @@ function collapseTreeNode($expandElem) {
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function traverseNavigationForPaths() {
|
||||
function traverseNavigationForPaths () {
|
||||
var params = {
|
||||
pos: $('#pma_navigation_tree').find('div.dbselector select').val()
|
||||
};
|
||||
@ -325,7 +324,7 @@ $(function () {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
$(document).on("change", '#navi_db_select', function (event) {
|
||||
$(document).on('change', '#navi_db_select', function (event) {
|
||||
if (! $(this).val()) {
|
||||
PMA_commonParams.set('db', '');
|
||||
PMA_reloadNavigation();
|
||||
@ -339,7 +338,7 @@ $(function () {
|
||||
*/
|
||||
$(document).on('click', '#pma_navigation_collapse', function (event) {
|
||||
event.preventDefault();
|
||||
$('#pma_navigation_tree').find('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();
|
||||
@ -545,7 +544,7 @@ $(function () {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
var buttonOptions = {};
|
||||
buttonOptions[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
$('<div/>')
|
||||
.attr('id', 'unhideNavItemDialog')
|
||||
@ -590,14 +589,13 @@ $(function () {
|
||||
});
|
||||
|
||||
// Add/Remove favorite table using Ajax.
|
||||
$(document).on("click", ".favorite_table_anchor", function (event) {
|
||||
$(document).on('click', '.favorite_table_anchor', function (event) {
|
||||
event.preventDefault();
|
||||
$self = $(this);
|
||||
var anchor_id = $self.attr("id");
|
||||
if($self.data("favtargetn") !== null) {
|
||||
if($('a[data-favtargets="' + $self.data("favtargetn") + '"]').length > 0)
|
||||
{
|
||||
$('a[data-favtargets="' + $self.data("favtargetn") + '"]').trigger('click');
|
||||
var anchor_id = $self.attr('id');
|
||||
if ($self.data('favtargetn') !== null) {
|
||||
if ($('a[data-favtargets="' + $self.data('favtargetn') + '"]').length > 0) {
|
||||
$('a[data-favtargets="' + $self.data('favtargetn') + '"]').trigger('click');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -619,7 +617,7 @@ $(function () {
|
||||
PMA_tooltip(
|
||||
$('#' + anchor_id),
|
||||
'a',
|
||||
$('#' + anchor_id).attr("title")
|
||||
$('#' + anchor_id).attr('title')
|
||||
);
|
||||
// Update localStorage.
|
||||
if (isStorageSupported('localStorage')) {
|
||||
@ -635,7 +633,7 @@ $(function () {
|
||||
if (isStorageSupported('sessionStorage')) {
|
||||
var storage = window.sessionStorage;
|
||||
// remove tree from storage if Navi_panel config form is submitted
|
||||
$(document).on('submit', 'form.config-form', function(event) {
|
||||
$(document).on('submit', 'form.config-form', function (event) {
|
||||
storage.removeItem('navTreePaths');
|
||||
});
|
||||
// Initialize if no previous state is defined
|
||||
@ -663,7 +661,7 @@ $(function () {
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
function expandTreeNode($expandElem, callback) {
|
||||
function expandTreeNode ($expandElem, callback) {
|
||||
var $children = $expandElem.closest('li').children('div.list_container');
|
||||
var $icon = $expandElem.find('img');
|
||||
if ($expandElem.hasClass('loaded')) {
|
||||
@ -671,7 +669,7 @@ function expandTreeNode($expandElem, callback) {
|
||||
$icon.removeClass('ic_b_plus').addClass('ic_b_minus');
|
||||
$children.slideDown('fast');
|
||||
}
|
||||
if (callback && typeof callback == 'function') {
|
||||
if (callback && typeof callback === 'function') {
|
||||
callback.call();
|
||||
}
|
||||
$children.promise().done(navTreeStateUpdate);
|
||||
@ -679,7 +677,7 @@ function expandTreeNode($expandElem, callback) {
|
||||
var $throbber = $('#pma_navigation').find('.throbber')
|
||||
.first()
|
||||
.clone()
|
||||
.css({visibility: 'visible', display: 'block'})
|
||||
.css({ visibility: 'visible', display: 'block' })
|
||||
.click(false);
|
||||
$icon.hide();
|
||||
$throbber.insertBefore($icon);
|
||||
@ -695,7 +693,7 @@ function expandTreeNode($expandElem, callback) {
|
||||
.find('a.expander.container')
|
||||
.click();
|
||||
}
|
||||
if (callback && typeof callback == 'function') {
|
||||
if (callback && typeof callback === 'function') {
|
||||
callback.call();
|
||||
}
|
||||
PMA_showFullName($destination);
|
||||
@ -717,7 +715,7 @@ function expandTreeNode($expandElem, callback) {
|
||||
* @param boolean $forceToTop Whether to force scroll to top
|
||||
*
|
||||
*/
|
||||
function scrollToView($element, $forceToTop) {
|
||||
function scrollToView ($element, $forceToTop) {
|
||||
navFilterStateRestore();
|
||||
var $container = $('#pma_navigation_tree_content');
|
||||
var elemTop = $element.offset().top - $container.offset().top;
|
||||
@ -739,7 +737,7 @@ function scrollToView($element, $forceToTop) {
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
function PMA_showCurrentNavigation() {
|
||||
function PMA_showCurrentNavigation () {
|
||||
var db = PMA_commonParams.get('db');
|
||||
var table = PMA_commonParams.get('table');
|
||||
$('#pma_navigation_tree')
|
||||
@ -785,7 +783,7 @@ function PMA_showCurrentNavigation() {
|
||||
}
|
||||
PMA_showFullName($('#pma_navigation_tree'));
|
||||
|
||||
function handleTableOrDb(table, $dbItem) {
|
||||
function handleTableOrDb (table, $dbItem) {
|
||||
if (table) {
|
||||
loadAndHighlightTableOrView($dbItem, table);
|
||||
} else {
|
||||
@ -803,7 +801,7 @@ function PMA_showCurrentNavigation() {
|
||||
}
|
||||
}
|
||||
|
||||
function findLoadedItem($container, name, clazz, doSelect) {
|
||||
function findLoadedItem ($container, name, clazz, doSelect) {
|
||||
var ret = false;
|
||||
$container.children('ul').children('li').each(function () {
|
||||
var $li = $(this);
|
||||
@ -842,13 +840,13 @@ function PMA_showCurrentNavigation() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function loadAndHighlightTableOrView($dbItem, itemName) {
|
||||
function loadAndHighlightTableOrView ($dbItem, itemName) {
|
||||
var $container = $dbItem.children('div.list_container');
|
||||
var $expander;
|
||||
var $whichItem = isItemInContainer($container, itemName, 'li.table, li.view');
|
||||
//If item already there in some container
|
||||
// If item already there in some container
|
||||
if ($whichItem) {
|
||||
//get the relevant container while may also be a subcontainer
|
||||
// get the relevant container while may also be a subcontainer
|
||||
var $relatedContainer = $whichItem.closest('li.subContainer').length
|
||||
? $whichItem.closest('li.subContainer')
|
||||
: $dbItem;
|
||||
@ -856,13 +854,13 @@ function PMA_showCurrentNavigation() {
|
||||
$relatedContainer.children('div.list_container'),
|
||||
itemName, null, true
|
||||
);
|
||||
//Show directly
|
||||
// Show directly
|
||||
showTableOrView($whichItem, $relatedContainer.children('div:first').children('a.expander'));
|
||||
//else if item not there, try loading once
|
||||
// else if item not there, try loading once
|
||||
} else {
|
||||
var $sub_containers = $dbItem.find('.subContainer');
|
||||
//If there are subContainers i.e. tableContainer or viewContainer
|
||||
if($sub_containers.length > 0) {
|
||||
// If there are subContainers i.e. tableContainer or viewContainer
|
||||
if ($sub_containers.length > 0) {
|
||||
var $containers = [];
|
||||
$sub_containers.each(function (index) {
|
||||
$containers[index] = $(this);
|
||||
@ -885,7 +883,7 @@ function PMA_showCurrentNavigation() {
|
||||
}
|
||||
}
|
||||
|
||||
function loadAndShowTableOrView($expander, $relatedContainer, itemName) {
|
||||
function loadAndShowTableOrView ($expander, $relatedContainer, itemName) {
|
||||
loadChildNodes(true, $expander, function (data) {
|
||||
var $whichItem = findLoadedItem(
|
||||
$relatedContainer.children('div.list_container'),
|
||||
@ -897,7 +895,7 @@ function PMA_showCurrentNavigation() {
|
||||
});
|
||||
}
|
||||
|
||||
function showTableOrView($whichItem, $expander) {
|
||||
function showTableOrView ($whichItem, $expander) {
|
||||
expandTreeNode($expander, function (data) {
|
||||
if ($whichItem) {
|
||||
scrollToView($whichItem, false);
|
||||
@ -905,8 +903,7 @@ function PMA_showCurrentNavigation() {
|
||||
});
|
||||
}
|
||||
|
||||
function isItemInContainer($container, name, clazz)
|
||||
{
|
||||
function isItemInContainer ($container, name, clazz) {
|
||||
var $whichItem = null;
|
||||
$items = $container.find(clazz);
|
||||
var found = false;
|
||||
@ -925,7 +922,7 @@ function PMA_showCurrentNavigation() {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_disableNaviSettings() {
|
||||
function PMA_disableNaviSettings () {
|
||||
$('#pma_navigation_settings_icon').addClass('hide');
|
||||
$('#pma_navigation_settings').remove();
|
||||
}
|
||||
@ -936,7 +933,7 @@ function PMA_disableNaviSettings() {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_ensureNaviSettings(selflink) {
|
||||
function PMA_ensureNaviSettings (selflink) {
|
||||
$('#pma_navigation_settings_icon').removeClass('hide');
|
||||
|
||||
if (!$('#pma_navigation_settings').length) {
|
||||
@ -969,7 +966,7 @@ function PMA_ensureNaviSettings(selflink) {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_reloadNavigation(callback, paths) {
|
||||
function PMA_reloadNavigation (callback, paths) {
|
||||
var params = {
|
||||
reload: true,
|
||||
no_debug: true,
|
||||
@ -984,7 +981,7 @@ function PMA_reloadNavigation(callback, paths) {
|
||||
}
|
||||
requestNaviReload(params);
|
||||
|
||||
function requestNaviReload(params) {
|
||||
function requestNaviReload (params) {
|
||||
var url = $('#pma_navigation').find('a.navigation_url').attr('href');
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
@ -1005,7 +1002,7 @@ function PMA_reloadNavigation(callback, paths) {
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_selectCurrentDb() {
|
||||
function PMA_selectCurrentDb () {
|
||||
var $naviDbSelect = $('#navi_db_select');
|
||||
|
||||
if (!$naviDbSelect.length) {
|
||||
@ -1018,7 +1015,6 @@ function PMA_selectCurrentDb() {
|
||||
|
||||
$naviDbSelect.val(PMA_commonParams.get('db'));
|
||||
return $naviDbSelect.val() === PMA_commonParams.get('db');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1031,7 +1027,7 @@ function PMA_selectCurrentDb() {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_navigationTreePagination($this) {
|
||||
function PMA_navigationTreePagination ($this) {
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
var isDbSelector = $this.closest('div.pageselector').is('.dbselector');
|
||||
var url, params;
|
||||
@ -1040,7 +1036,7 @@ function PMA_navigationTreePagination($this) {
|
||||
params = 'ajax_request=true';
|
||||
} else { // tagName == 'SELECT'
|
||||
url = 'navigation.php';
|
||||
params = $this.closest("form").serialize() + '&ajax_request=true';
|
||||
params = $this.closest('form').serialize() + '&ajax_request=true';
|
||||
}
|
||||
var searchClause = PMA_fastFilter.getSearchClause();
|
||||
if (searchClause) {
|
||||
@ -1125,7 +1121,7 @@ var ResizeHandler = function () {
|
||||
}
|
||||
$('#pma_navigation').width(pos);
|
||||
$('body').css('margin-' + this.left, pos + 'px');
|
||||
$("#floating_menubar, #pma_console")
|
||||
$('#floating_menubar, #pma_console')
|
||||
.css('margin-' + this.left, (pos + resizer_width) + 'px');
|
||||
$resizer.css(this.left, pos + 'px');
|
||||
if (pos === 0) {
|
||||
@ -1138,7 +1134,7 @@ var ResizeHandler = function () {
|
||||
.css(this.left, pos)
|
||||
.html(this.getSymbol(pos))
|
||||
.prop('title', PMA_messages.strHidePanel);
|
||||
$('#pma_navigation_resizer').css({'width': '3px'});
|
||||
$('#pma_navigation_resizer').css({ 'width': '3px' });
|
||||
} else {
|
||||
$collapser
|
||||
.css(this.left, windowWidth - 22)
|
||||
@ -1146,7 +1142,7 @@ var ResizeHandler = function () {
|
||||
.prop('title', PMA_messages.strHidePanel);
|
||||
$('#pma_navigation').width(windowWidth);
|
||||
$('body').css('margin-' + this.left, '0px');
|
||||
$('#pma_navigation_resizer').css({'width': '0px'});
|
||||
$('#pma_navigation_resizer').css({ 'width': '0px' });
|
||||
}
|
||||
setTimeout(function () {
|
||||
$(window).trigger('resize');
|
||||
@ -1209,9 +1205,9 @@ var ResizeHandler = function () {
|
||||
this.mousedown = function (event) {
|
||||
event.preventDefault();
|
||||
$(document)
|
||||
.on('mousemove', {'resize_handler': event.data.resize_handler},
|
||||
.on('mousemove', { 'resize_handler': event.data.resize_handler },
|
||||
$.throttle(event.data.resize_handler.mousemove, 4))
|
||||
.on('mouseup', {'resize_handler': event.data.resize_handler},
|
||||
.on('mouseup', { 'resize_handler': event.data.resize_handler },
|
||||
event.data.resize_handler.mouseup);
|
||||
$('body').css('cursor', 'col-resize');
|
||||
};
|
||||
@ -1268,15 +1264,15 @@ var ResizeHandler = function () {
|
||||
* @return void
|
||||
*/
|
||||
this.treeResize = function (event) {
|
||||
var $nav = $("#pma_navigation"),
|
||||
$nav_tree = $("#pma_navigation_tree"),
|
||||
$nav_header = $("#pma_navigation_header"),
|
||||
$nav_tree_content = $("#pma_navigation_tree_content");
|
||||
var $nav = $('#pma_navigation'),
|
||||
$nav_tree = $('#pma_navigation_tree'),
|
||||
$nav_header = $('#pma_navigation_header'),
|
||||
$nav_tree_content = $('#pma_navigation_tree_content');
|
||||
$nav_tree.height($nav.height() - $nav_header.height());
|
||||
if ($nav_tree_content.length > 0) {
|
||||
$nav_tree_content.height($nav_tree.height() - $nav_tree_content.position().top);
|
||||
} else {
|
||||
//TODO: in fast filter search response there is no #pma_navigation_tree_content, needs to be added in php
|
||||
// TODO: in fast filter search response there is no #pma_navigation_tree_content, needs to be added in php
|
||||
$nav_tree.css({
|
||||
'overflow-y': 'auto'
|
||||
});
|
||||
@ -1287,16 +1283,15 @@ var ResizeHandler = function () {
|
||||
// Hide the pma_navigation initially when loaded on mobile
|
||||
if ($(window).width() < 768) {
|
||||
this.setWidth(0);
|
||||
}
|
||||
else if (Cookies.get('pma_navi_width')) {
|
||||
} else if (Cookies.get('pma_navi_width')) {
|
||||
// If we have a cookie, set the width of the panel to its value
|
||||
var pos = Math.abs(parseInt(Cookies.get('pma_navi_width'), 10) || 0);
|
||||
this.setWidth(pos);
|
||||
$('#topmenu').menuResizer('resize');
|
||||
}
|
||||
// Register the events for the resizer and the collapser
|
||||
$(document).on('mousedown', '#pma_navigation_resizer', {'resize_handler': this}, this.mousedown);
|
||||
$(document).on('click', '#pma_navigation_collapser', {'resize_handler': this}, this.collapse);
|
||||
$(document).on('mousedown', '#pma_navigation_resizer', { 'resize_handler': this }, this.mousedown);
|
||||
$(document).on('click', '#pma_navigation_collapser', { 'resize_handler': this }, this.collapse);
|
||||
|
||||
// Add the correct arrow symbol to the collapser
|
||||
$('#pma_navigation_collapser').html(this.getSymbol($('#pma_navigation').width()));
|
||||
@ -1452,13 +1447,13 @@ var PMA_fastFilter = {
|
||||
// filters items that are directly under the div as well as grouped in
|
||||
// groups. Does not filter child items (i.e. a database search does
|
||||
// not filter tables)
|
||||
var item_filter = function($curr) {
|
||||
$curr.children('ul').children('li.navGroup').each(function() {
|
||||
$(this).children('div.list_container').each(function() {
|
||||
var item_filter = function ($curr) {
|
||||
$curr.children('ul').children('li.navGroup').each(function () {
|
||||
$(this).children('div.list_container').each(function () {
|
||||
item_filter($(this)); // recursive
|
||||
});
|
||||
});
|
||||
$curr.children('ul').children('li').children('a').not('.container').each(function() {
|
||||
$curr.children('ul').children('li').children('a').not('.container').each(function () {
|
||||
if (regex.test($(this).text())) {
|
||||
$(this).parent().show().removeClass('hidden');
|
||||
} else {
|
||||
@ -1470,14 +1465,14 @@ var PMA_fastFilter = {
|
||||
|
||||
// hides containers that does not have any visible children
|
||||
var container_filter = function ($curr) {
|
||||
$curr.children('ul').children('li.navGroup').each(function() {
|
||||
$curr.children('ul').children('li.navGroup').each(function () {
|
||||
var $group = $(this);
|
||||
$group.children('div.list_container').each(function() {
|
||||
$group.children('div.list_container').each(function () {
|
||||
container_filter($(this)); // recursive
|
||||
});
|
||||
$group.show().removeClass('hidden');
|
||||
if ($group.children('div.list_container').children('ul')
|
||||
.children('li').not('.hidden').length === 0) {
|
||||
.children('li').not('.hidden').length === 0) {
|
||||
$group.hide().addClass('hidden');
|
||||
}
|
||||
});
|
||||
@ -1546,7 +1541,7 @@ PMA_fastFilter.filter.prototype.request = function () {
|
||||
$('#pma_navigation_content')
|
||||
.find('img.throbber')
|
||||
.clone()
|
||||
.css({visibility: 'visible', display: 'block'})
|
||||
.css({ visibility: 'visible', display: 'block' })
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1603,7 +1598,7 @@ PMA_fastFilter.filter.prototype.swap = function (list) {
|
||||
* @return void
|
||||
*/
|
||||
PMA_fastFilter.filter.prototype.restore = function (focus) {
|
||||
if(this.$this.children('ul').first().hasClass('search_results')) {
|
||||
if (this.$this.children('ul').first().hasClass('search_results')) {
|
||||
this.$this.html(this.$clone.html()).children().show();
|
||||
this.$this.data('fastFilter', this);
|
||||
if (focus) {
|
||||
@ -1622,39 +1617,35 @@ PMA_fastFilter.filter.prototype.restore = function (focus) {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_showFullName($containerELem) {
|
||||
|
||||
$containerELem.find('.hover_show_full').mouseenter(function() {
|
||||
function PMA_showFullName ($containerELem) {
|
||||
$containerELem.find('.hover_show_full').mouseenter(function () {
|
||||
/** mouseenter */
|
||||
var $this = $(this);
|
||||
var thisOffset = $this.offset();
|
||||
if($this.text() === '') {
|
||||
if ($this.text() === '') {
|
||||
return;
|
||||
}
|
||||
var $parent = $this.parent();
|
||||
if( ($parent.offset().left + $parent.outerWidth())
|
||||
< (thisOffset.left + $this.outerWidth()))
|
||||
{
|
||||
if (($parent.offset().left + $parent.outerWidth())
|
||||
< (thisOffset.left + $this.outerWidth())) {
|
||||
var $fullNameLayer = $('#full_name_layer');
|
||||
if($fullNameLayer.length === 0)
|
||||
{
|
||||
if ($fullNameLayer.length === 0) {
|
||||
$('body').append('<div id="full_name_layer" class="hide"></div>');
|
||||
$('#full_name_layer').mouseleave(function() {
|
||||
$('#full_name_layer').mouseleave(function () {
|
||||
/** mouseleave */
|
||||
$(this).addClass('hide')
|
||||
.removeClass('hovering');
|
||||
}).mouseenter(function() {
|
||||
.removeClass('hovering');
|
||||
}).mouseenter(function () {
|
||||
/** mouseenter */
|
||||
$(this).addClass('hovering');
|
||||
});
|
||||
$fullNameLayer = $('#full_name_layer');
|
||||
}
|
||||
$fullNameLayer.removeClass('hide');
|
||||
$fullNameLayer.css({left: thisOffset.left, top: thisOffset.top});
|
||||
$fullNameLayer.css({ left: thisOffset.left, top: thisOffset.top });
|
||||
$fullNameLayer.html($this.clone());
|
||||
setTimeout(function() {
|
||||
if(! $fullNameLayer.hasClass('hovering'))
|
||||
{
|
||||
setTimeout(function () {
|
||||
if (! $fullNameLayer.hasClass('hovering')) {
|
||||
$fullNameLayer.trigger('mouseleave');
|
||||
}
|
||||
}, 200);
|
||||
|
||||
@ -14,54 +14,52 @@
|
||||
var normalizeto = '1nf';
|
||||
var primary_key;
|
||||
var data_parsed = null;
|
||||
function appendHtmlColumnsList()
|
||||
{
|
||||
function appendHtmlColumnsList () {
|
||||
$.get(
|
||||
"normalization.php",
|
||||
'normalization.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"getColumns": true
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'getColumns': true
|
||||
},
|
||||
function(data) {
|
||||
function (data) {
|
||||
if (data.success === true) {
|
||||
$('select[name=makeAtomic]').html(data.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
function goTo3NFStep1(newTables)
|
||||
{
|
||||
function goTo3NFStep1 (newTables) {
|
||||
if (Object.keys(newTables).length === 1) {
|
||||
newTables = [PMA_commonParams.get('table')];
|
||||
}
|
||||
$.post(
|
||||
"normalization.php",
|
||||
'normalization.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"tables": newTables,
|
||||
"step": '3.1'
|
||||
}, function(data) {
|
||||
$("#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() {
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'tables': newTables,
|
||||
'step': '3.1'
|
||||
}, function (data) {
|
||||
$('#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();
|
||||
$('#' + form_id + ' input[value=\'' + colname + '\']').next().remove();
|
||||
$('#' + form_id + ' input[value=\'' + colname + '\']').remove();
|
||||
});
|
||||
$("#mainContent").find("#newCols").html('');
|
||||
$('#mainContent').find('#newCols').html('');
|
||||
$('.tblFooters').html('');
|
||||
|
||||
if (data.subText !== "") {
|
||||
if (data.subText !== '') {
|
||||
$('<input/>')
|
||||
.attr({type: 'button', value: PMA_messages.strDone})
|
||||
.on('click', function() {
|
||||
.attr({ type: 'button', value: PMA_messages.strDone })
|
||||
.on('click', function () {
|
||||
processDependencies('', true);
|
||||
})
|
||||
.appendTo('.tblFooters');
|
||||
@ -69,32 +67,32 @@ function goTo3NFStep1(newTables)
|
||||
}
|
||||
);
|
||||
}
|
||||
function goTo2NFStep1() {
|
||||
function goTo2NFStep1 () {
|
||||
$.post(
|
||||
"normalization.php",
|
||||
'normalization.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"step": '2.1'
|
||||
}, function(data) {
|
||||
$("#page_content h3").html(PMA_messages.str2NFNormalization);
|
||||
$("#mainContent legend").html(data.legendText);
|
||||
$("#mainContent h4").html(data.headText);
|
||||
$("#mainContent p").html(data.subText);
|
||||
$("#mainContent #extra").html(data.extra);
|
||||
$("#mainContent #newCols").html('');
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'step': '2.1'
|
||||
}, function (data) {
|
||||
$('#page_content h3').html(PMA_messages.str2NFNormalization);
|
||||
$('#mainContent legend').html(data.legendText);
|
||||
$('#mainContent h4').html(data.headText);
|
||||
$('#mainContent p').html(data.subText);
|
||||
$('#mainContent #extra').html(data.extra);
|
||||
$('#mainContent #newCols').html('');
|
||||
if (data.subText !== '') {
|
||||
var doneButton = $('<input />')
|
||||
.attr({type: 'submit', value: PMA_messages.strDone, })
|
||||
.on('click', function() {
|
||||
.attr({ type: 'submit', value: PMA_messages.strDone, })
|
||||
.on('click', function () {
|
||||
processDependencies(data.primary_key);
|
||||
})
|
||||
.appendTo('.tblFooters');
|
||||
} else {
|
||||
if (normalizeto === '3nf') {
|
||||
$("#mainContent #newCols").html(PMA_messages.strToNextStep);
|
||||
setTimeout(function() {
|
||||
$('#mainContent #newCols').html(PMA_messages.strToNextStep);
|
||||
setTimeout(function () {
|
||||
goTo3NFStep1([PMA_commonParams.get('table')]);
|
||||
}, 3000);
|
||||
}
|
||||
@ -102,148 +100,142 @@ function goTo2NFStep1() {
|
||||
});
|
||||
}
|
||||
|
||||
function goToFinish1NF()
|
||||
{
|
||||
function goToFinish1NF () {
|
||||
if (normalizeto !== '1nf') {
|
||||
goTo2NFStep1();
|
||||
return true;
|
||||
}
|
||||
$("#mainContent legend").html(PMA_messages.strEndStep);
|
||||
$("#mainContent h4").html(
|
||||
"<h3>" + PMA_sprintf(PMA_messages.strFinishMsg, escapeHtml(PMA_commonParams.get('table'))) + "</h3>"
|
||||
$('#mainContent legend').html(PMA_messages.strEndStep);
|
||||
$('#mainContent h4').html(
|
||||
'<h3>' + PMA_sprintf(PMA_messages.strFinishMsg, escapeHtml(PMA_commonParams.get('table'))) + '</h3>'
|
||||
);
|
||||
$("#mainContent p").html('');
|
||||
$("#mainContent #extra").html('');
|
||||
$("#mainContent #newCols").html('');
|
||||
$('#mainContent p').html('');
|
||||
$('#mainContent #extra').html('');
|
||||
$('#mainContent #newCols').html('');
|
||||
$('.tblFooters').html('');
|
||||
}
|
||||
|
||||
function goToStep4()
|
||||
{
|
||||
function goToStep4 () {
|
||||
$.post(
|
||||
"normalization.php",
|
||||
'normalization.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"step4": true
|
||||
}, function(data) {
|
||||
$("#mainContent legend").html(data.legendText);
|
||||
$("#mainContent h4").html(data.headText);
|
||||
$("#mainContent p").html(data.subText);
|
||||
$("#mainContent #extra").html(data.extra);
|
||||
$("#mainContent #newCols").html('');
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'step4': true
|
||||
}, function (data) {
|
||||
$('#mainContent legend').html(data.legendText);
|
||||
$('#mainContent h4').html(data.headText);
|
||||
$('#mainContent p').html(data.subText);
|
||||
$('#mainContent #extra').html(data.extra);
|
||||
$('#mainContent #newCols').html('');
|
||||
$('.tblFooters').html('');
|
||||
for(var pk in primary_key) {
|
||||
$("#extra input[value='" + escapeJsString(primary_key[pk]) + "']").attr("disabled","disabled");
|
||||
for (var pk in primary_key) {
|
||||
$('#extra input[value=\'' + escapeJsString(primary_key[pk]) + '\']').attr('disabled','disabled');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function goToStep3()
|
||||
{
|
||||
function goToStep3 () {
|
||||
$.post(
|
||||
"normalization.php",
|
||||
'normalization.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"step3": true
|
||||
}, function(data) {
|
||||
$("#mainContent legend").html(data.legendText);
|
||||
$("#mainContent h4").html(data.headText);
|
||||
$("#mainContent p").html(data.subText);
|
||||
$("#mainContent #extra").html(data.extra);
|
||||
$("#mainContent #newCols").html('');
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'step3': true
|
||||
}, function (data) {
|
||||
$('#mainContent legend').html(data.legendText);
|
||||
$('#mainContent h4').html(data.headText);
|
||||
$('#mainContent p').html(data.subText);
|
||||
$('#mainContent #extra').html(data.extra);
|
||||
$('#mainContent #newCols').html('');
|
||||
$('.tblFooters').html('');
|
||||
primary_key = JSON.parse(data.primary_key);
|
||||
for(var pk in primary_key) {
|
||||
$("#extra input[value='" + escapeJsString(primary_key[pk]) + "']").attr("disabled","disabled");
|
||||
for (var pk in primary_key) {
|
||||
$('#extra input[value=\'' + escapeJsString(primary_key[pk]) + '\']').attr('disabled','disabled');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function goToStep2(extra)
|
||||
{
|
||||
function goToStep2 (extra) {
|
||||
$.post(
|
||||
"normalization.php",
|
||||
'normalization.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"step2": true
|
||||
}, function(data) {
|
||||
$("#mainContent legend").html(data.legendText);
|
||||
$("#mainContent h4").html(data.headText);
|
||||
$("#mainContent p").html(data.subText);
|
||||
$("#mainContent #extra,#mainContent #newCols").html('');
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'step2': true
|
||||
}, function (data) {
|
||||
$('#mainContent legend').html(data.legendText);
|
||||
$('#mainContent h4').html(data.headText);
|
||||
$('#mainContent p').html(data.subText);
|
||||
$('#mainContent #extra,#mainContent #newCols').html('');
|
||||
$('.tblFooters').html('');
|
||||
if (data.hasPrimaryKey === "1") {
|
||||
if(extra === 'goToStep3') {
|
||||
$("#mainContent h4").html(PMA_messages.strPrimaryKeyAdded);
|
||||
$("#mainContent p").html(PMA_messages.strToNextStep);
|
||||
if (data.hasPrimaryKey === '1') {
|
||||
if (extra === 'goToStep3') {
|
||||
$('#mainContent h4').html(PMA_messages.strPrimaryKeyAdded);
|
||||
$('#mainContent p').html(PMA_messages.strToNextStep);
|
||||
}
|
||||
if(extra === 'goToFinish1NF') {
|
||||
if (extra === 'goToFinish1NF') {
|
||||
goToFinish1NF();
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
goToStep3();
|
||||
}, 3000);
|
||||
}
|
||||
} else {
|
||||
//form to select columns to make primary
|
||||
$("#mainContent #extra").html(data.extra);
|
||||
// form to select columns to make primary
|
||||
$('#mainContent #extra').html(data.extra);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function goTo2NFFinish(pd)
|
||||
{
|
||||
function goTo2NFFinish (pd) {
|
||||
var tables = {};
|
||||
for (var dependson in pd) {
|
||||
tables[dependson] = $('#extra input[name="' + dependson + '"]').val();
|
||||
}
|
||||
datastring = {
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"pd": JSON.stringify(pd),
|
||||
"newTablesName":JSON.stringify(tables),
|
||||
"createNewTables2NF":1};
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'pd': JSON.stringify(pd),
|
||||
'newTablesName':JSON.stringify(tables),
|
||||
'createNewTables2NF':1 };
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "normalization.php",
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function(data) {
|
||||
if (data.success === true) {
|
||||
if(data.queryError === false) {
|
||||
if (normalizeto === '3nf') {
|
||||
$("#pma_navigation_reload").click();
|
||||
goTo3NFStep1(tables);
|
||||
return true;
|
||||
}
|
||||
$("#mainContent legend").html(data.legendText);
|
||||
$("#mainContent h4").html(data.headText);
|
||||
$("#mainContent p").html('');
|
||||
$("#mainContent #extra").html('');
|
||||
$('.tblFooters').html('');
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.extra, false);
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function (data) {
|
||||
if (data.success === true) {
|
||||
if (data.queryError === false) {
|
||||
if (normalizeto === '3nf') {
|
||||
$('#pma_navigation_reload').click();
|
||||
goTo3NFStep1(tables);
|
||||
return true;
|
||||
}
|
||||
$("#pma_navigation_reload").click();
|
||||
$('#mainContent legend').html(data.legendText);
|
||||
$('#mainContent h4').html(data.headText);
|
||||
$('#mainContent p').html('');
|
||||
$('#mainContent #extra').html('');
|
||||
$('.tblFooters').html('');
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
PMA_ajaxShowMessage(data.extra, false);
|
||||
}
|
||||
$('#pma_navigation_reload').click();
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function goTo3NFFinish(newTables)
|
||||
{
|
||||
function goTo3NFFinish (newTables) {
|
||||
for (var table in newTables) {
|
||||
for (var newtbl in newTables[table]) {
|
||||
var updatedname = $('#extra input[name="' + newtbl + '"]').val();
|
||||
@ -254,65 +246,64 @@ function goTo3NFFinish(newTables)
|
||||
}
|
||||
}
|
||||
datastring = {
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"newTables":JSON.stringify(newTables),
|
||||
"createNewTables3NF":1};
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'newTables':JSON.stringify(newTables),
|
||||
'createNewTables3NF':1 };
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "normalization.php",
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function(data) {
|
||||
if (data.success === true) {
|
||||
if(data.queryError === false) {
|
||||
$("#mainContent legend").html(data.legendText);
|
||||
$("#mainContent h4").html(data.headText);
|
||||
$("#mainContent p").html('');
|
||||
$("#mainContent #extra").html('');
|
||||
$('.tblFooters').html('');
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.extra, false);
|
||||
}
|
||||
$("#pma_navigation_reload").click();
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function (data) {
|
||||
if (data.success === true) {
|
||||
if (data.queryError === false) {
|
||||
$('#mainContent legend').html(data.legendText);
|
||||
$('#mainContent h4').html(data.headText);
|
||||
$('#mainContent p').html('');
|
||||
$('#mainContent #extra').html('');
|
||||
$('.tblFooters').html('');
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
PMA_ajaxShowMessage(data.extra, false);
|
||||
}
|
||||
$('#pma_navigation_reload').click();
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
var backup = '';
|
||||
function goTo2NFStep2(pd, primary_key)
|
||||
{
|
||||
$("#newCols").html('');
|
||||
$("#mainContent legend").html(PMA_messages.strStep + ' 2.2 ' + PMA_messages.strConfirmPd);
|
||||
$("#mainContent h4").html(PMA_messages.strSelectedPd);
|
||||
$("#mainContent p").html(PMA_messages.strPdHintNote);
|
||||
function goTo2NFStep2 (pd, primary_key) {
|
||||
$('#newCols').html('');
|
||||
$('#mainContent legend').html(PMA_messages.strStep + ' 2.2 ' + PMA_messages.strConfirmPd);
|
||||
$('#mainContent h4').html(PMA_messages.strSelectedPd);
|
||||
$('#mainContent p').html(PMA_messages.strPdHintNote);
|
||||
var extra = '<div class="dependencies_box">';
|
||||
var pdFound = false;
|
||||
for (var dependson in pd) {
|
||||
if (dependson !== primary_key) {
|
||||
pdFound = true;
|
||||
extra += '<p class="displayblock desc">' + escapeHtml(dependson) + " -> " + escapeHtml(pd[dependson].toString()) + '</p>';
|
||||
extra += '<p class="displayblock desc">' + escapeHtml(dependson) + ' -> ' + escapeHtml(pd[dependson].toString()) + '</p>';
|
||||
}
|
||||
}
|
||||
if(!pdFound) {
|
||||
if (!pdFound) {
|
||||
extra += '<p class="displayblock desc">' + PMA_messages.strNoPdSelected + '</p>';
|
||||
extra += '</div>';
|
||||
} else {
|
||||
extra += '</div>';
|
||||
datastring = {
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"pd": JSON.stringify(pd),
|
||||
"getNewTables2NF":1};
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'pd': JSON.stringify(pd),
|
||||
'getNewTables2NF':1 };
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "normalization.php",
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function(data) {
|
||||
success: function (data) {
|
||||
if (data.success === true) {
|
||||
extra += data.message;
|
||||
} else {
|
||||
@ -321,19 +312,18 @@ function goTo2NFStep2(pd, primary_key)
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#mainContent #extra").html(extra);
|
||||
$('#mainContent #extra').html(extra);
|
||||
$('.tblFooters').html('<input type="button" value="' + PMA_messages.strBack + '" id="backEditPd"/><input type="button" id="goTo2NFFinish" value="' + PMA_messages.strGo + '"/>');
|
||||
$("#goTo2NFFinish").click(function(){
|
||||
$('#goTo2NFFinish').click(function () {
|
||||
goTo2NFFinish(pd);
|
||||
});
|
||||
}
|
||||
|
||||
function goTo3NFStep2(pd, tablesTds)
|
||||
{
|
||||
$("#newCols").html('');
|
||||
$("#mainContent legend").html(PMA_messages.strStep + ' 3.2 ' + PMA_messages.strConfirmTd);
|
||||
$("#mainContent h4").html(PMA_messages.strSelectedTd);
|
||||
$("#mainContent p").html(PMA_messages.strPdHintNote);
|
||||
function goTo3NFStep2 (pd, tablesTds) {
|
||||
$('#newCols').html('');
|
||||
$('#mainContent legend').html(PMA_messages.strStep + ' 3.2 ' + PMA_messages.strConfirmTd);
|
||||
$('#mainContent h4').html(PMA_messages.strSelectedTd);
|
||||
$('#mainContent p').html(PMA_messages.strPdHintNote);
|
||||
var extra = '<div class="dependencies_box">';
|
||||
var pdFound = false;
|
||||
for (var table in tablesTds) {
|
||||
@ -341,27 +331,27 @@ function goTo3NFStep2(pd, tablesTds)
|
||||
dependson = tablesTds[table][i];
|
||||
if (dependson !== '' && dependson !== table) {
|
||||
pdFound = true;
|
||||
extra += '<p class="displayblock desc">' + escapeHtml(dependson) + " -> " + escapeHtml(pd[dependson].toString()) + '</p>';
|
||||
extra += '<p class="displayblock desc">' + escapeHtml(dependson) + ' -> ' + escapeHtml(pd[dependson].toString()) + '</p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!pdFound) {
|
||||
if (!pdFound) {
|
||||
extra += '<p class="displayblock desc">' + PMA_messages.strNoTdSelected + '</p>';
|
||||
extra += '</div>';
|
||||
} else {
|
||||
extra += '</div>';
|
||||
datastring = {
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"tables": JSON.stringify(tablesTds),
|
||||
"pd": JSON.stringify(pd),
|
||||
"getNewTables3NF":1};
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'tables': JSON.stringify(tablesTds),
|
||||
'pd': JSON.stringify(pd),
|
||||
'getNewTables3NF':1 };
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "normalization.php",
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function(data) {
|
||||
success: function (data) {
|
||||
data_parsed = data;
|
||||
if (data.success === true) {
|
||||
extra += data_parsed.html;
|
||||
@ -371,9 +361,9 @@ function goTo3NFStep2(pd, tablesTds)
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#mainContent #extra").html(extra);
|
||||
$('#mainContent #extra').html(extra);
|
||||
$('.tblFooters').html('<input type="button" value="' + PMA_messages.strBack + '" id="backEditPd"/><input type="button" id="goTo3NFFinish" value="' + PMA_messages.strGo + '"/>');
|
||||
$("#goTo3NFFinish").click(function(){
|
||||
$('#goTo3NFFinish').click(function () {
|
||||
if (!pdFound) {
|
||||
goTo3NFFinish([]);
|
||||
} else {
|
||||
@ -381,13 +371,12 @@ function goTo3NFStep2(pd, tablesTds)
|
||||
}
|
||||
});
|
||||
}
|
||||
function processDependencies(primary_key, isTransitive)
|
||||
{
|
||||
function processDependencies (primary_key, isTransitive) {
|
||||
var pd = {};
|
||||
var tablesTds = {};
|
||||
var dependsOn;
|
||||
pd[primary_key] = [];
|
||||
$("#extra form").each(function() {
|
||||
$('#extra form').each(function () {
|
||||
var tblname;
|
||||
if (isTransitive === true) {
|
||||
tblname = $(this).data('tablename');
|
||||
@ -400,9 +389,9 @@ function processDependencies(primary_key, isTransitive)
|
||||
var form_id = $(this).attr('id');
|
||||
$('#' + form_id + ' input[type=checkbox]:not(:checked)').prop('checked', false);
|
||||
dependsOn = '';
|
||||
$('#' + form_id + ' input[type=checkbox]:checked').each(function(){
|
||||
$('#' + form_id + ' input[type=checkbox]:checked').each(function () {
|
||||
dependsOn += $(this).val() + ', ';
|
||||
$(this).attr("checked","checked");
|
||||
$(this).attr('checked','checked');
|
||||
});
|
||||
if (dependsOn === '') {
|
||||
dependsOn = primary_key;
|
||||
@ -422,7 +411,7 @@ function processDependencies(primary_key, isTransitive)
|
||||
}
|
||||
}
|
||||
});
|
||||
backup = $("#mainContent").html();
|
||||
backup = $('#mainContent').html();
|
||||
if (isTransitive === true) {
|
||||
goTo3NFStep2(pd, tablesTds);
|
||||
} else {
|
||||
@ -431,38 +420,38 @@ function processDependencies(primary_key, isTransitive)
|
||||
return false;
|
||||
}
|
||||
|
||||
function moveRepeatingGroup(repeatingCols) {
|
||||
var newTable = $("input[name=repeatGroupTable]").val();
|
||||
var newColumn = $("input[name=repeatGroupColumn]").val();
|
||||
function moveRepeatingGroup (repeatingCols) {
|
||||
var newTable = $('input[name=repeatGroupTable]').val();
|
||||
var newColumn = $('input[name=repeatGroupColumn]').val();
|
||||
if (!newTable) {
|
||||
$("input[name=repeatGroupTable]").focus();
|
||||
$('input[name=repeatGroupTable]').focus();
|
||||
return false;
|
||||
}
|
||||
if (!newColumn) {
|
||||
$("input[name=repeatGroupColumn]").focus();
|
||||
$('input[name=repeatGroupColumn]').focus();
|
||||
return false;
|
||||
}
|
||||
datastring = {
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"repeatingColumns": repeatingCols,
|
||||
"newTable":newTable,
|
||||
"newColumn":newColumn,
|
||||
"primary_columns":primary_key.toString()
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'repeatingColumns': repeatingCols,
|
||||
'newTable':newTable,
|
||||
'newColumn':newColumn,
|
||||
'primary_columns':primary_key.toString()
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "normalization.php",
|
||||
type: 'POST',
|
||||
url: 'normalization.php',
|
||||
data: datastring,
|
||||
async:false,
|
||||
success: function(data) {
|
||||
success: function (data) {
|
||||
if (data.success === true) {
|
||||
if(data.queryError === false) {
|
||||
if (data.queryError === false) {
|
||||
goToStep3();
|
||||
}
|
||||
PMA_ajaxShowMessage(data.message, false);
|
||||
$("#pma_navigation_reload").click();
|
||||
$('#pma_navigation_reload').click();
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
@ -470,22 +459,22 @@ function moveRepeatingGroup(repeatingCols) {
|
||||
});
|
||||
}
|
||||
AJAX.registerTeardown('normalization.js', function () {
|
||||
$("#extra").off("click", "#selectNonAtomicCol");
|
||||
$("#splitGo").off('click');
|
||||
$('.tblFooters').off("click", "#saveSplit");
|
||||
$("#extra").off("click", "#addNewPrimary");
|
||||
$(".tblFooters").off("click", "#saveNewPrimary");
|
||||
$("#extra").off("click", "#removeRedundant");
|
||||
$("#mainContent p").off("click", "#createPrimaryKey");
|
||||
$("#mainContent").off("click", "#backEditPd");
|
||||
$("#mainContent").off("click", "#showPossiblePd");
|
||||
$("#mainContent").off("click", ".pickPd");
|
||||
$('#extra').off('click', '#selectNonAtomicCol');
|
||||
$('#splitGo').off('click');
|
||||
$('.tblFooters').off('click', '#saveSplit');
|
||||
$('#extra').off('click', '#addNewPrimary');
|
||||
$('.tblFooters').off('click', '#saveNewPrimary');
|
||||
$('#extra').off('click', '#removeRedundant');
|
||||
$('#mainContent p').off('click', '#createPrimaryKey');
|
||||
$('#mainContent').off('click', '#backEditPd');
|
||||
$('#mainContent').off('click', '#showPossiblePd');
|
||||
$('#mainContent').off('click', '.pickPd');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('normalization.js', function() {
|
||||
AJAX.registerOnload('normalization.js', function () {
|
||||
var selectedCol;
|
||||
normalizeto = $("#mainContent").data('normalizeto');
|
||||
$("#extra").on("click", "#selectNonAtomicCol", function() {
|
||||
normalizeto = $('#mainContent').data('normalizeto');
|
||||
$('#extra').on('click', '#selectNonAtomicCol', function () {
|
||||
if ($(this).val() === 'no_such_col') {
|
||||
goToStep2();
|
||||
} else {
|
||||
@ -493,33 +482,33 @@ AJAX.registerOnload('normalization.js', function() {
|
||||
}
|
||||
});
|
||||
|
||||
$("#splitGo").click(function() {
|
||||
if(!selectedCol || selectedCol === '') {
|
||||
$('#splitGo').click(function () {
|
||||
if (!selectedCol || selectedCol === '') {
|
||||
return false;
|
||||
}
|
||||
var numField = $("#numField").val();
|
||||
var numField = $('#numField').val();
|
||||
$.get(
|
||||
"normalization.php",
|
||||
'normalization.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"splitColumn": true,
|
||||
"numFields": numField
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'splitColumn': true,
|
||||
'numFields': numField
|
||||
},
|
||||
function(data) {
|
||||
function (data) {
|
||||
if (data.success === true) {
|
||||
$('#newCols').html(data.message);
|
||||
$('.default_value').hide();
|
||||
$('.enum_notice').hide();
|
||||
|
||||
$('<input />')
|
||||
.attr({type: 'submit', id: 'saveSplit', value: PMA_messages.strSave})
|
||||
.attr({ type: 'submit', id: 'saveSplit', value: PMA_messages.strSave })
|
||||
.appendTo('.tblFooters');
|
||||
|
||||
var cancelSplitButton = $('<input />')
|
||||
.attr({type: 'submit', id: 'cancelSplit', value: PMA_messages.strCancel})
|
||||
.on('click', function() {
|
||||
.attr({ type: 'submit', id: 'cancelSplit', value: PMA_messages.strCancel })
|
||||
.on('click', function () {
|
||||
$('#newCols').html('');
|
||||
$(this).parent().html('');
|
||||
})
|
||||
@ -529,28 +518,28 @@ AJAX.registerOnload('normalization.js', function() {
|
||||
);
|
||||
return false;
|
||||
});
|
||||
$('.tblFooters').on("click","#saveSplit", function() {
|
||||
$('.tblFooters').on('click','#saveSplit', function () {
|
||||
central_column_list = [];
|
||||
if ($("#newCols #field_0_1").val() === '') {
|
||||
$("#newCols #field_0_1").focus();
|
||||
if ($('#newCols #field_0_1').val() === '') {
|
||||
$('#newCols #field_0_1').focus();
|
||||
return false;
|
||||
}
|
||||
datastring = $('#newCols :input').serialize();
|
||||
datastring += "&ajax_request=1&do_save_data=1&field_where=last";
|
||||
$.post("tbl_addfield.php", datastring, function(data) {
|
||||
datastring += '&ajax_request=1&do_save_data=1&field_where=last';
|
||||
$.post('tbl_addfield.php', datastring, function (data) {
|
||||
if (data.success) {
|
||||
$.post(
|
||||
"sql.php",
|
||||
'sql.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"dropped_column": selectedCol,
|
||||
"purge" : 1,
|
||||
"sql_query": 'ALTER TABLE `' + PMA_commonParams.get('table') + '` DROP `' + selectedCol + '`;',
|
||||
"is_js_confirmed": 1
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'dropped_column': selectedCol,
|
||||
'purge' : 1,
|
||||
'sql_query': 'ALTER TABLE `' + PMA_commonParams.get('table') + '` DROP `' + selectedCol + '`;',
|
||||
'is_js_confirmed': 1
|
||||
},
|
||||
function(data) {
|
||||
function (data) {
|
||||
if (data.success === true) {
|
||||
appendHtmlColumnsList();
|
||||
$('#newCols').html('');
|
||||
@ -567,27 +556,27 @@ AJAX.registerOnload('normalization.js', function() {
|
||||
});
|
||||
});
|
||||
|
||||
$("#extra").on("click", "#addNewPrimary", function() {
|
||||
$('#extra').on('click', '#addNewPrimary', function () {
|
||||
$.get(
|
||||
"normalization.php",
|
||||
'normalization.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"addNewPrimary": true
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'addNewPrimary': true
|
||||
},
|
||||
function(data) {
|
||||
function (data) {
|
||||
if (data.success === true) {
|
||||
$('#newCols').html(data.message);
|
||||
$('.default_value').hide();
|
||||
$('.enum_notice').hide();
|
||||
|
||||
$('<input />')
|
||||
.attr({type: 'submit', id: 'saveNewPrimary', value: PMA_messages.strSave})
|
||||
.attr({ type: 'submit', id: 'saveNewPrimary', value: PMA_messages.strSave })
|
||||
.appendTo('.tblFooters');
|
||||
$('<input />')
|
||||
.attr({type: 'submit', id: 'cancelSplit', value: PMA_messages.strCancel})
|
||||
.on('click', function() {
|
||||
.attr({ type: 'submit', id: 'cancelSplit', value: PMA_messages.strCancel })
|
||||
.on('click', function () {
|
||||
$('#newCols').html('');
|
||||
$(this).parent().html('');
|
||||
})
|
||||
@ -599,17 +588,17 @@ AJAX.registerOnload('normalization.js', function() {
|
||||
);
|
||||
return false;
|
||||
});
|
||||
$(".tblFooters").on("click", "#saveNewPrimary", function() {
|
||||
$('.tblFooters').on('click', '#saveNewPrimary', function () {
|
||||
var datastring = $('#newCols :input').serialize();
|
||||
datastring += "&field_key[0]=primary_0&ajax_request=1&do_save_data=1&field_where=last";
|
||||
$.post("tbl_addfield.php", datastring, function(data) {
|
||||
datastring += '&field_key[0]=primary_0&ajax_request=1&do_save_data=1&field_where=last';
|
||||
$.post('tbl_addfield.php', datastring, function (data) {
|
||||
if (data.success === true) {
|
||||
$("#mainContent h4").html(PMA_messages.strPrimaryKeyAdded);
|
||||
$("#mainContent p").html(PMA_messages.strToNextStep);
|
||||
$("#mainContent #extra").html('');
|
||||
$("#mainContent #newCols").html('');
|
||||
$('#mainContent h4').html(PMA_messages.strPrimaryKeyAdded);
|
||||
$('#mainContent p').html(PMA_messages.strToNextStep);
|
||||
$('#mainContent #extra').html('');
|
||||
$('#mainContent #newCols').html('');
|
||||
$('.tblFooters').html('');
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
goToStep3();
|
||||
}, 2000);
|
||||
} else {
|
||||
@ -617,22 +606,22 @@ AJAX.registerOnload('normalization.js', function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#extra").on("click", "#removeRedundant", function() {
|
||||
$('#extra').on('click', '#removeRedundant', function () {
|
||||
var dropQuery = 'ALTER TABLE `' + PMA_commonParams.get('table') + '` ';
|
||||
$("#extra input[type=checkbox]:checked").each(function() {
|
||||
$('#extra input[type=checkbox]:checked').each(function () {
|
||||
dropQuery += 'DROP `' + $(this).val() + '`, ';
|
||||
});
|
||||
dropQuery = dropQuery.slice(0, -2);
|
||||
$.post(
|
||||
"sql.php",
|
||||
'sql.php',
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"sql_query": dropQuery,
|
||||
"is_js_confirmed": 1
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'sql_query': dropQuery,
|
||||
'is_js_confirmed': 1
|
||||
},
|
||||
function(data) {
|
||||
function (data) {
|
||||
if (data.success === true) {
|
||||
goToStep2('goToFinish1NF');
|
||||
} else {
|
||||
@ -641,37 +630,37 @@ AJAX.registerOnload('normalization.js', function() {
|
||||
}
|
||||
);
|
||||
});
|
||||
$("#extra").on("click", "#moveRepeatingGroup", function() {
|
||||
$('#extra').on('click', '#moveRepeatingGroup', function () {
|
||||
var repeatingCols = '';
|
||||
$("#extra input[type=checkbox]:checked").each(function() {
|
||||
$('#extra input[type=checkbox]:checked').each(function () {
|
||||
repeatingCols += $(this).val() + ', ';
|
||||
});
|
||||
|
||||
if (repeatingCols !== '') {
|
||||
var newColName = $("#extra input[type=checkbox]:checked:first").val();
|
||||
var newColName = $('#extra input[type=checkbox]:checked:first').val();
|
||||
repeatingCols = repeatingCols.slice(0, -2);
|
||||
var confirmStr = PMA_sprintf(PMA_messages.strMoveRepeatingGroup, escapeHtml(repeatingCols), escapeHtml(PMA_commonParams.get('table')));
|
||||
confirmStr += '<input type="text" name="repeatGroupTable" placeholder="' + PMA_messages.strNewTablePlaceholder + '"/>' +
|
||||
'( ' + escapeHtml(primary_key.toString()) + ', <input type="text" name="repeatGroupColumn" placeholder="' + PMA_messages.strNewColumnPlaceholder + '" value="' + escapeHtml(newColName) + '">)' +
|
||||
'</ol>';
|
||||
$("#newCols").html(confirmStr);
|
||||
$('#newCols').html(confirmStr);
|
||||
|
||||
$('<input />')
|
||||
.attr({type: 'submit', value: PMA_messages.strCancel})
|
||||
.on('click', function() {
|
||||
.attr({ type: 'submit', value: PMA_messages.strCancel })
|
||||
.on('click', function () {
|
||||
$('#newCols').html('');
|
||||
$('#extra input[type=checkbox]').prop('checked', false);
|
||||
})
|
||||
.appendTo('.tblFooters');
|
||||
$('<input />')
|
||||
.attr({type: 'submit', value: PMA_messages.strGo})
|
||||
.on('click', function() {
|
||||
.attr({ type: 'submit', value: PMA_messages.strGo })
|
||||
.on('click', function () {
|
||||
moveRepeatingGroup(repeatingCols);
|
||||
})
|
||||
.appendTo('.tblFooters');
|
||||
}
|
||||
});
|
||||
$("#mainContent p").on("click", "#createPrimaryKey", function(event) {
|
||||
$('#mainContent p').on('click', '#createPrimaryKey', function (event) {
|
||||
event.preventDefault();
|
||||
var url = { create_index: 1,
|
||||
server: PMA_commonParams.get('server'),
|
||||
@ -679,51 +668,51 @@ AJAX.registerOnload('normalization.js', function() {
|
||||
table: PMA_commonParams.get('table'),
|
||||
added_fields: 1,
|
||||
add_fields:1,
|
||||
index: {Key_name:'PRIMARY'},
|
||||
index: { Key_name:'PRIMARY' },
|
||||
ajax_request: true
|
||||
};
|
||||
var title = PMA_messages.strAddPrimaryKey;
|
||||
indexEditorDialog(url, title, function(){
|
||||
//on success
|
||||
$(".sqlqueryresults").remove();
|
||||
indexEditorDialog(url, title, function () {
|
||||
// on success
|
||||
$('.sqlqueryresults').remove();
|
||||
$('.result_query').remove();
|
||||
$('.tblFooters').html('');
|
||||
goToStep2('goToStep3');
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$("#mainContent").on("click", "#backEditPd", function(){
|
||||
$("#mainContent").html(backup);
|
||||
$('#mainContent').on('click', '#backEditPd', function () {
|
||||
$('#mainContent').html(backup);
|
||||
});
|
||||
$("#mainContent").on("click", "#showPossiblePd", function(){
|
||||
if($(this).hasClass('hideList')) {
|
||||
$('#mainContent').on('click', '#showPossiblePd', function () {
|
||||
if ($(this).hasClass('hideList')) {
|
||||
$(this).html('+ ' + PMA_messages.strShowPossiblePd);
|
||||
$(this).removeClass('hideList');
|
||||
$("#newCols").slideToggle("slow");
|
||||
$('#newCols').slideToggle('slow');
|
||||
return false;
|
||||
}
|
||||
if($("#newCols").html() !== '') {
|
||||
$("#showPossiblePd").html('- ' + PMA_messages.strHidePd);
|
||||
$("#showPossiblePd").addClass('hideList');
|
||||
$("#newCols").slideToggle("slow");
|
||||
if ($('#newCols').html() !== '') {
|
||||
$('#showPossiblePd').html('- ' + PMA_messages.strHidePd);
|
||||
$('#showPossiblePd').addClass('hideList');
|
||||
$('#newCols').slideToggle('slow');
|
||||
return false;
|
||||
}
|
||||
$("#newCols").insertAfter("#mainContent h4");
|
||||
$("#newCols").html('<div class="center">' + PMA_messages.strLoading + '<br/>' + PMA_messages.strWaitForPd + '</div>');
|
||||
$('#newCols').insertAfter('#mainContent h4');
|
||||
$('#newCols').html('<div class="center">' + PMA_messages.strLoading + '<br/>' + PMA_messages.strWaitForPd + '</div>');
|
||||
$.post(
|
||||
"normalization.php",
|
||||
{
|
||||
"ajax_request": true,
|
||||
"db": PMA_commonParams.get('db'),
|
||||
"table": PMA_commonParams.get('table'),
|
||||
"findPdl": true
|
||||
}, function(data) {
|
||||
$("#showPossiblePd").html('- ' + PMA_messages.strHidePd);
|
||||
$("#showPossiblePd").addClass('hideList');
|
||||
$("#newCols").html(data.message);
|
||||
});
|
||||
'normalization.php',
|
||||
{
|
||||
'ajax_request': true,
|
||||
'db': PMA_commonParams.get('db'),
|
||||
'table': PMA_commonParams.get('table'),
|
||||
'findPdl': true
|
||||
}, function (data) {
|
||||
$('#showPossiblePd').html('- ' + PMA_messages.strHidePd);
|
||||
$('#showPossiblePd').addClass('hideList');
|
||||
$('#newCols').html(data.message);
|
||||
});
|
||||
});
|
||||
$("#mainContent").on("click", ".pickPd", function(){
|
||||
$('#mainContent').on('click', '.pickPd', function () {
|
||||
var strColsLeft = $(this).next('.determinants').html();
|
||||
var colsLeft = strColsLeft.split(',');
|
||||
var strColsRight = $(this).next().next().html();
|
||||
|
||||
@ -8,9 +8,9 @@
|
||||
* @required js/functions.js
|
||||
*/
|
||||
|
||||
function showSettings(selector) {
|
||||
function showSettings (selector) {
|
||||
var buttons = {};
|
||||
buttons[PMA_messages.strApply] = function() {
|
||||
buttons[PMA_messages.strApply] = function () {
|
||||
$('.config-form').submit();
|
||||
};
|
||||
|
||||
@ -21,26 +21,26 @@ function showSettings(selector) {
|
||||
// Keeping a clone to restore in case the user cancels the operation
|
||||
var $clone = $(selector + ' .page_settings').clone(true);
|
||||
$(selector)
|
||||
.dialog({
|
||||
title: PMA_messages.strPageSettings,
|
||||
width: 700,
|
||||
minHeight: 250,
|
||||
modal: true,
|
||||
open: function() {
|
||||
$(this).dialog('option', 'maxHeight', $(window).height() - $(this).offset().top);
|
||||
},
|
||||
close: function() {
|
||||
$(selector + ' .page_settings').replaceWith($clone);
|
||||
},
|
||||
buttons: buttons
|
||||
});
|
||||
.dialog({
|
||||
title: PMA_messages.strPageSettings,
|
||||
width: 700,
|
||||
minHeight: 250,
|
||||
modal: true,
|
||||
open: function () {
|
||||
$(this).dialog('option', 'maxHeight', $(window).height() - $(this).offset().top);
|
||||
},
|
||||
close: function () {
|
||||
$(selector + ' .page_settings').replaceWith($clone);
|
||||
},
|
||||
buttons: buttons
|
||||
});
|
||||
}
|
||||
|
||||
function showPageSettings() {
|
||||
function showPageSettings () {
|
||||
showSettings('#page_settings_modal');
|
||||
}
|
||||
|
||||
function showNaviSettings() {
|
||||
function showNaviSettings () {
|
||||
showSettings('#pma_navigation_settings');
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
var designer_tables = [{name: "pdf_pages", key: "pg_nr", auto_inc: true},
|
||||
{name: "table_coords", key: "id", auto_inc: true}];
|
||||
var designer_tables = [{ name: 'pdf_pages', key: 'pg_nr', auto_inc: true },
|
||||
{ name: 'table_coords', key: 'id', auto_inc: true }];
|
||||
|
||||
var DesignerOfflineDB = (function () {
|
||||
var designerDB = {};
|
||||
@ -7,7 +7,7 @@ var DesignerOfflineDB = (function () {
|
||||
|
||||
designerDB.open = function (callback) {
|
||||
var version = 1;
|
||||
var request = window.indexedDB.open("pma_designer", version);
|
||||
var request = window.indexedDB.open('pma_designer', version);
|
||||
|
||||
request.onupgradeneeded = function (e) {
|
||||
var db = e.target.result;
|
||||
@ -74,7 +74,7 @@ var DesignerOfflineDB = (function () {
|
||||
cursorRequest.onerror = designerDB.onerror;
|
||||
};
|
||||
|
||||
designerDB.loadFirstObject = function(table, callback) {
|
||||
designerDB.loadFirstObject = function (table, callback) {
|
||||
var db = datastore;
|
||||
var transaction = db.transaction([table], 'readwrite');
|
||||
var objStore = transaction.objectStore(table);
|
||||
@ -82,11 +82,11 @@ var DesignerOfflineDB = (function () {
|
||||
var cursorRequest = objStore.openCursor(keyRange);
|
||||
var firstResult = null;
|
||||
|
||||
transaction.oncomplete = function(e) {
|
||||
transaction.oncomplete = function (e) {
|
||||
callback(firstResult);
|
||||
};
|
||||
|
||||
cursorRequest.onsuccess = function(e) {
|
||||
cursorRequest.onsuccess = function (e) {
|
||||
var result = e.target.result;
|
||||
if (Boolean(result) === false) {
|
||||
return;
|
||||
@ -97,13 +97,13 @@ var DesignerOfflineDB = (function () {
|
||||
cursorRequest.onerror = designerDB.onerror;
|
||||
};
|
||||
|
||||
designerDB.addObject = function(table, obj, callback) {
|
||||
designerDB.addObject = function (table, obj, callback) {
|
||||
var db = datastore;
|
||||
var transaction = db.transaction([table], 'readwrite');
|
||||
var objStore = transaction.objectStore(table);
|
||||
var request = objStore.put(obj);
|
||||
|
||||
request.onsuccess = function(e) {
|
||||
request.onsuccess = function (e) {
|
||||
if (typeof callback !== 'undefined' && callback !== null) {
|
||||
callback(e.currentTarget.result);
|
||||
}
|
||||
@ -112,13 +112,13 @@ var DesignerOfflineDB = (function () {
|
||||
request.onerror = designerDB.onerror;
|
||||
};
|
||||
|
||||
designerDB.deleteObject = function(table, id, callback) {
|
||||
designerDB.deleteObject = function (table, id, callback) {
|
||||
var db = datastore;
|
||||
var transaction = db.transaction([table], 'readwrite');
|
||||
var objStore = transaction.objectStore(table);
|
||||
var request = objStore.delete(parseInt(id));
|
||||
|
||||
request.onsuccess = function(e) {
|
||||
request.onsuccess = function (e) {
|
||||
if (typeof callback !== 'undefined' && callback !== null) {
|
||||
callback(true);
|
||||
}
|
||||
@ -127,7 +127,7 @@ var DesignerOfflineDB = (function () {
|
||||
request.onerror = designerDB.onerror;
|
||||
};
|
||||
|
||||
designerDB.onerror = function(e) {
|
||||
designerDB.onerror = function (e) {
|
||||
console.log(e);
|
||||
};
|
||||
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
function PDFPage(db_name, page_descr, tbl_cords)
|
||||
{
|
||||
function PDFPage (db_name, page_descr, tbl_cords) {
|
||||
this.pg_nr = null;
|
||||
this.db_name = db_name;
|
||||
this.page_descr = page_descr;
|
||||
this.tbl_cords = tbl_cords;
|
||||
}
|
||||
|
||||
function TableCoordinate(db_name, table_name, pdf_pg_nr, x, y)
|
||||
{
|
||||
function TableCoordinate (db_name, table_name, pdf_pg_nr, x, y) {
|
||||
this.id = null;
|
||||
this.db_name = db_name;
|
||||
this.table_name = table_name;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
function Show_tables_in_landing_page(db)
|
||||
{
|
||||
function Show_tables_in_landing_page (db) {
|
||||
Load_first_page(db, function (page) {
|
||||
if (page) {
|
||||
Load_HTML_for_page(page.pg_nr);
|
||||
@ -10,8 +9,7 @@ function Show_tables_in_landing_page(db)
|
||||
});
|
||||
}
|
||||
|
||||
function Save_to_new_page(db, page_name, table_positions, callback)
|
||||
{
|
||||
function Save_to_new_page (db, page_name, table_positions, callback) {
|
||||
Create_new_page(db, page_name, function (page) {
|
||||
if (page) {
|
||||
var tbl_cords = [];
|
||||
@ -32,8 +30,7 @@ function Save_to_new_page(db, page_name, table_positions, callback)
|
||||
});
|
||||
}
|
||||
|
||||
function Save_to_selected_page(db, page_id, page_name, table_positions, callback)
|
||||
{
|
||||
function Save_to_selected_page (db, page_id, page_name, table_positions, callback) {
|
||||
Delete_page(page_id);
|
||||
Save_to_new_page(db, page_name, table_positions, function (page) {
|
||||
if (typeof callback !== 'undefined') {
|
||||
@ -43,8 +40,7 @@ function Save_to_selected_page(db, page_id, page_name, table_positions, callback
|
||||
});
|
||||
}
|
||||
|
||||
function Create_new_page(db, page_name, callback)
|
||||
{
|
||||
function Create_new_page (db, page_name, callback) {
|
||||
var newPage = new PDFPage(db, page_name);
|
||||
DesignerOfflineDB.addObject('pdf_pages', newPage, function (pg_nr) {
|
||||
newPage.pg_nr = pg_nr;
|
||||
@ -54,15 +50,13 @@ function Create_new_page(db, page_name, callback)
|
||||
});
|
||||
}
|
||||
|
||||
function Save_table_positions(positions, callback)
|
||||
{
|
||||
function Save_table_positions (positions, callback) {
|
||||
DesignerOfflineDB.addObject('table_coords', positions, callback);
|
||||
}
|
||||
|
||||
function Create_page_list(db, callback)
|
||||
{
|
||||
function Create_page_list (db, callback) {
|
||||
DesignerOfflineDB.loadAllObjects('pdf_pages', function (pages) {
|
||||
var html = "";
|
||||
var html = '';
|
||||
for (var p = 0; p < pages.length; p++) {
|
||||
var page = pages[p];
|
||||
if (page.db_name == db) {
|
||||
@ -76,8 +70,7 @@ function Create_page_list(db, callback)
|
||||
});
|
||||
}
|
||||
|
||||
function Delete_page(page_id, callback)
|
||||
{
|
||||
function Delete_page (page_id, callback) {
|
||||
DesignerOfflineDB.loadObject('pdf_pages', page_id, function (page) {
|
||||
if (page) {
|
||||
for (var i = 0; i < page.tbl_cords.length; i++) {
|
||||
@ -88,8 +81,7 @@ function Delete_page(page_id, callback)
|
||||
});
|
||||
}
|
||||
|
||||
function Load_first_page(db, callback)
|
||||
{
|
||||
function Load_first_page (db, callback) {
|
||||
DesignerOfflineDB.loadAllObjects('pdf_pages', function (pages) {
|
||||
var firstPage = null;
|
||||
for (var i = 0; i < pages.length; i++) {
|
||||
@ -109,9 +101,8 @@ function Load_first_page(db, callback)
|
||||
});
|
||||
}
|
||||
|
||||
function Show_new_page_tables(check)
|
||||
{
|
||||
var all_tables = $("#id_scroll_tab").find("td input:checkbox");
|
||||
function Show_new_page_tables (check) {
|
||||
var all_tables = $('#id_scroll_tab').find('td input:checkbox');
|
||||
all_tables.prop('checked', check);
|
||||
for (var tab = 0; tab < all_tables.length; tab++) {
|
||||
var input = all_tables[tab];
|
||||
@ -123,15 +114,14 @@ function Show_new_page_tables(check)
|
||||
}
|
||||
}
|
||||
selected_page = -1;
|
||||
$("#page_name").text(PMA_messages.strUntitled);
|
||||
$('#page_name').text(PMA_messages.strUntitled);
|
||||
MarkUnsaved();
|
||||
}
|
||||
|
||||
function Load_HTML_for_page(page_id)
|
||||
{
|
||||
function Load_HTML_for_page (page_id) {
|
||||
Show_new_page_tables(false);
|
||||
Load_page_objects(page_id, function (page, tbl_cords) {
|
||||
$("#name-panel").find("#page_name").text(page.page_descr);
|
||||
$('#name-panel').find('#page_name').text(page.page_descr);
|
||||
MarkSaved();
|
||||
for (var t = 0; t < tbl_cords.length; t++) {
|
||||
var tb_id = db + '.' + tbl_cords[t].table_name;
|
||||
@ -139,7 +129,7 @@ function Load_HTML_for_page(page_id)
|
||||
table.style.top = tbl_cords[t].y + 'px';
|
||||
table.style.left = tbl_cords[t].x + 'px';
|
||||
|
||||
var checkbox = document.getElementById("check_vis_" + tb_id);
|
||||
var checkbox = document.getElementById('check_vis_' + tb_id);
|
||||
checkbox.checked = true;
|
||||
VisibleTab(checkbox, checkbox.value);
|
||||
}
|
||||
@ -147,8 +137,7 @@ function Load_HTML_for_page(page_id)
|
||||
});
|
||||
}
|
||||
|
||||
function Load_page_objects(page_id, callback)
|
||||
{
|
||||
function Load_page_objects (page_id, callback) {
|
||||
DesignerOfflineDB.loadObject('pdf_pages', page_id, function (page) {
|
||||
var tbl_cords = [];
|
||||
var count = page.tbl_cords.length;
|
||||
@ -165,8 +154,7 @@ function Load_page_objects(page_id, callback)
|
||||
});
|
||||
}
|
||||
|
||||
function Get_random(max, min)
|
||||
{
|
||||
function Get_random (max, min) {
|
||||
var val = Math.random() * (max - min) + min;
|
||||
return Math.floor(val);
|
||||
}
|
||||
|
||||
@ -19,26 +19,25 @@ var vqb_editor = null;
|
||||
*
|
||||
**/
|
||||
|
||||
function detail(index)
|
||||
{
|
||||
function detail (index) {
|
||||
var type = history_array[index].get_type();
|
||||
var str;
|
||||
if (type == "Where") {
|
||||
if (type == 'Where') {
|
||||
str = 'Where ' + history_array[index].get_column_name() + history_array[index].get_obj().getrelation_operator() + history_array[index].get_obj().getquery();
|
||||
}
|
||||
if (type == "Rename") {
|
||||
if (type == 'Rename') {
|
||||
str = 'Rename ' + history_array[index].get_column_name() + ' To ' + history_array[index].get_obj().getrename_to();
|
||||
}
|
||||
if (type == "Aggregate") {
|
||||
if (type == 'Aggregate') {
|
||||
str = 'Select ' + history_array[index].get_obj().get_operator() + '( ' + history_array[index].get_column_name() + ' )';
|
||||
}
|
||||
if (type == "GroupBy") {
|
||||
if (type == 'GroupBy') {
|
||||
str = 'GroupBy ' + history_array[index].get_column_name();
|
||||
}
|
||||
if (type == "OrderBy") {
|
||||
if (type == 'OrderBy') {
|
||||
str = 'OrderBy ' + history_array[index].get_column_name() + ' ' + history_array[index].get_obj().get_order();
|
||||
}
|
||||
if (type == "Having") {
|
||||
if (type == 'Having') {
|
||||
str = 'Having ';
|
||||
if (history_array[index].get_obj().get_operator() != 'None') {
|
||||
str += history_array[index].get_obj().get_operator() + '( ' + history_array[index].get_column_name() + ' )';
|
||||
@ -61,15 +60,14 @@ function detail(index)
|
||||
*
|
||||
**/
|
||||
|
||||
function display(init, finit)
|
||||
{
|
||||
function display (init, finit) {
|
||||
var str, i, j, k, sto, temp;
|
||||
// this part sorts the history array based on table name,this is needed for clubbing all object of same name together.
|
||||
for (i = init; i < finit; i++) {
|
||||
sto = history_array[i];
|
||||
temp = history_array[i].get_tab();//+ '.' + history_array[i].get_obj_no(); for Self JOINS
|
||||
temp = history_array[i].get_tab();// + '.' + history_array[i].get_obj_no(); for Self JOINS
|
||||
for (j = 0; j < i; j++) {
|
||||
if (temp > (history_array[j].get_tab())) {//+ '.' + history_array[j].get_obj_no())) { //for Self JOINS
|
||||
if (temp > (history_array[j].get_tab())) {// + '.' + history_array[j].get_obj_no())) { //for Self JOINS
|
||||
for (k = i; k > j; k--) {
|
||||
history_array[k] = history_array[k - 1];
|
||||
}
|
||||
@ -81,10 +79,10 @@ function display(init, finit)
|
||||
// this part generates HTML code for history tab.adds delete,edit,and/or and detail features with objects.
|
||||
str = ''; // string to store Html code for history tab
|
||||
for (i = 0; i < history_array.length; i++) {
|
||||
temp = history_array[i].get_tab(); //+ '.' + history_array[i].get_obj_no(); for Self JOIN
|
||||
temp = history_array[i].get_tab(); // + '.' + history_array[i].get_obj_no(); for Self JOIN
|
||||
str += '<h3 class="tiger"><a href="#">' + temp + '</a></h3>';
|
||||
str += '<div class="toggle_container">\n';
|
||||
while ((history_array[i].get_tab()) == temp) { //+ '.' + history_array[i].get_obj_no()) == temp) {
|
||||
while ((history_array[i].get_tab()) == temp) { // + '.' + history_array[i].get_obj_no()) == temp) {
|
||||
str += '<div class="block"> <table width ="250">';
|
||||
str += '<thead><tr><td>';
|
||||
if (history_array[i].get_and_or()) {
|
||||
@ -94,7 +92,7 @@ function display(init, finit)
|
||||
}
|
||||
str += '<td style="padding-left: 5px;" class="right">' + PMA_getImage('b_sbrowse.png', 'column name') + '</td>' +
|
||||
'<td width="175" style="padding-left: 5px">' + history_array[i].get_column_name() + '<td>';
|
||||
if (history_array[i].get_type() == "GroupBy" || history_array[i].get_type() == "OrderBy") {
|
||||
if (history_array[i].get_type() == 'GroupBy' || history_array[i].get_type() == 'OrderBy') {
|
||||
str += '<td class="center">' + PMA_getImage('s_info.png', detail(i)) + '</td>' +
|
||||
'<td title="' + detail(i) + '">' + history_array[i].get_type() + '</td>' +
|
||||
'<td onclick=history_delete(' + i + ')>' + PMA_getImage('b_drop.png', PMA_messages.strDelete) + '</td>';
|
||||
@ -125,8 +123,7 @@ function display(init, finit)
|
||||
*
|
||||
**/
|
||||
|
||||
function and_or(index)
|
||||
{
|
||||
function and_or (index) {
|
||||
if (history_array[index].get_and_or()) {
|
||||
history_array[index].set_and_or(0);
|
||||
} else {
|
||||
@ -134,7 +131,7 @@ function and_or(index)
|
||||
}
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = display(0, 0);
|
||||
$('#ab').accordion("refresh");
|
||||
$('#ab').accordion('refresh');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,8 +141,7 @@ function and_or(index)
|
||||
*
|
||||
**/
|
||||
|
||||
function history_delete(index)
|
||||
{
|
||||
function history_delete (index) {
|
||||
for (var k = 0; k < from_array.length; k++) {
|
||||
if (from_array[k] == history_array[index].get_tab()) {
|
||||
from_array.splice(k, 1);
|
||||
@ -155,7 +151,7 @@ function history_delete(index)
|
||||
history_array.splice(index, 1);
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = display(0, 0);
|
||||
$('#ab').accordion("refresh");
|
||||
$('#ab').accordion('refresh');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,11 +161,10 @@ function history_delete(index)
|
||||
*
|
||||
**/
|
||||
|
||||
function history_edit(index)
|
||||
{
|
||||
function history_edit (index) {
|
||||
g_index = index;
|
||||
var type = history_array[index].get_type();
|
||||
if (type == "Where") {
|
||||
if (type == 'Where') {
|
||||
document.getElementById('eQuery').value = history_array[index].get_obj().getquery();
|
||||
document.getElementById('erel_opt').value = history_array[index].get_obj().getrelation_operator();
|
||||
document.getElementById('query_where').style.left = '530px';
|
||||
@ -179,7 +174,7 @@ function history_edit(index)
|
||||
document.getElementById('query_where').style.visibility = 'visible';
|
||||
document.getElementById('query_where').style.display = 'block';
|
||||
}
|
||||
if (type == "Having") {
|
||||
if (type == 'Having') {
|
||||
document.getElementById('hQuery').value = history_array[index].get_obj().getquery();
|
||||
document.getElementById('hrel_opt').value = history_array[index].get_obj().getrelation_operator();
|
||||
document.getElementById('hoperator').value = history_array[index].get_obj().get_operator();
|
||||
@ -190,7 +185,7 @@ function history_edit(index)
|
||||
document.getElementById('query_having').style.visibility = 'visible';
|
||||
document.getElementById('query_having').style.display = 'block';
|
||||
}
|
||||
if (type == "Rename") {
|
||||
if (type == 'Rename') {
|
||||
document.getElementById('e_rename').value = history_array[index].get_obj().getrename_to();
|
||||
document.getElementById('query_rename_to').style.left = '530px';
|
||||
document.getElementById('query_rename_to').style.top = '130px';
|
||||
@ -199,7 +194,7 @@ function history_edit(index)
|
||||
document.getElementById('query_rename_to').style.visibility = 'visible';
|
||||
document.getElementById('query_rename_to').style.display = 'block';
|
||||
}
|
||||
if (type == "Aggregate") {
|
||||
if (type == 'Aggregate') {
|
||||
document.getElementById('e_operator').value = history_array[index].get_obj().get_operator();
|
||||
document.getElementById('query_Aggregate').style.left = '530px';
|
||||
document.getElementById('query_Aggregate').style.top = '130px';
|
||||
@ -217,31 +212,30 @@ function history_edit(index)
|
||||
* @param index index of history_array where change is to be made
|
||||
**/
|
||||
|
||||
function edit(type)
|
||||
{
|
||||
if (type == "Rename") {
|
||||
if (document.getElementById('e_rename').value !== "") {
|
||||
function edit (type) {
|
||||
if (type == 'Rename') {
|
||||
if (document.getElementById('e_rename').value !== '') {
|
||||
history_array[g_index].get_obj().setrename_to(document.getElementById('e_rename').value);
|
||||
document.getElementById('e_rename').value = "";
|
||||
document.getElementById('e_rename').value = '';
|
||||
}
|
||||
document.getElementById('query_rename_to').style.visibility = 'hidden';
|
||||
}
|
||||
if (type == "Aggregate") {
|
||||
if (type == 'Aggregate') {
|
||||
if (document.getElementById('e_operator').value != '---') {
|
||||
history_array[g_index].get_obj().set_operator(document.getElementById('e_operator').value);
|
||||
document.getElementById('e_operator').value = '---';
|
||||
}
|
||||
document.getElementById('query_Aggregate').style.visibility = 'hidden';
|
||||
}
|
||||
if (type == "Where") {
|
||||
if (document.getElementById('erel_opt').value != '--' && document.getElementById('eQuery').value !== "") {
|
||||
if (type == 'Where') {
|
||||
if (document.getElementById('erel_opt').value != '--' && document.getElementById('eQuery').value !== '') {
|
||||
history_array[g_index].get_obj().setquery(document.getElementById('eQuery').value);
|
||||
history_array[g_index].get_obj().setrelation_operator(document.getElementById('erel_opt').value);
|
||||
}
|
||||
document.getElementById('query_where').style.visibility = 'hidden';
|
||||
}
|
||||
if (type == "Having") {
|
||||
if (document.getElementById('hrel_opt').value != '--' && document.getElementById('hQuery').value !== "") {
|
||||
if (type == 'Having') {
|
||||
if (document.getElementById('hrel_opt').value != '--' && document.getElementById('hQuery').value !== '') {
|
||||
history_array[g_index].get_obj().setquery(document.getElementById('hQuery').value);
|
||||
history_array[g_index].get_obj().setrelation_operator(document.getElementById('hrel_opt').value);
|
||||
history_array[g_index].get_obj().set_operator(document.getElementById('hoperator').value);
|
||||
@ -250,7 +244,7 @@ function edit(type)
|
||||
}
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = display(0, 0);
|
||||
$('#ab').accordion("refresh");
|
||||
$('#ab').accordion('refresh');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -264,8 +258,7 @@ function edit(type)
|
||||
*
|
||||
**/
|
||||
|
||||
function history_obj(ncolumn_name, nobj, ntab, nobj_no, ntype)
|
||||
{
|
||||
function history_obj (ncolumn_name, nobj, ntab, nobj_no, ntype) {
|
||||
var and_or;
|
||||
var obj;
|
||||
var tab;
|
||||
@ -352,12 +345,12 @@ var where = function (nrelation_operator, nquery) {
|
||||
*
|
||||
* @param norder order, ASC or DESC
|
||||
*/
|
||||
var orderby = function(norder) {
|
||||
var orderby = function (norder) {
|
||||
var order;
|
||||
this.set_order = function(norder) {
|
||||
this.set_order = function (norder) {
|
||||
order = norder;
|
||||
};
|
||||
this.get_order = function() {
|
||||
this.get_order = function () {
|
||||
return order;
|
||||
};
|
||||
this.set_order(norder);
|
||||
@ -441,10 +434,9 @@ var aggregate = function (noperator) {
|
||||
* @return unique array
|
||||
*/
|
||||
|
||||
function unique(arrayName)
|
||||
{
|
||||
function unique (arrayName) {
|
||||
var newArray = [];
|
||||
uniquetop:
|
||||
uniquetop:
|
||||
for (var i = 0; i < arrayName.length; i++) {
|
||||
for (var j = 0; j < newArray.length; j++) {
|
||||
if (newArray[j] == arrayName[i]) {
|
||||
@ -464,8 +456,7 @@ uniquetop:
|
||||
* @param value value which is to be searched in the array
|
||||
*/
|
||||
|
||||
function found(arrayName, value)
|
||||
{
|
||||
function found (arrayName, value) {
|
||||
for (var i = 0; i < arrayName.length; i++) {
|
||||
if (arrayName[i] == value) {
|
||||
return 1;
|
||||
@ -480,8 +471,7 @@ function found(arrayName, value)
|
||||
* @params add array elements of which are pushed in
|
||||
* @params arr array in which elements are added
|
||||
*/
|
||||
function add_array(add, arr)
|
||||
{
|
||||
function add_array (add, arr) {
|
||||
for (var i = 0; i < add.length; i++) {
|
||||
arr.push(add[i]);
|
||||
}
|
||||
@ -494,8 +484,7 @@ function add_array(add, arr)
|
||||
* @params arr array from which elements are removed.
|
||||
*
|
||||
*/
|
||||
function remove_array(rem, arr)
|
||||
{
|
||||
function remove_array (rem, arr) {
|
||||
for (var i = 0; i < rem.length; i++) {
|
||||
for (var j = 0; j < arr.length; j++) {
|
||||
if (rem[i] == arr[j]) {
|
||||
@ -511,13 +500,12 @@ function remove_array(rem, arr)
|
||||
*
|
||||
*/
|
||||
|
||||
function query_groupby()
|
||||
{
|
||||
function query_groupby () {
|
||||
var i;
|
||||
var str = "";
|
||||
var str = '';
|
||||
for (i = 0; i < history_array.length;i++) {
|
||||
if (history_array[i].get_type() == "GroupBy") {
|
||||
str += '`' + history_array[i].get_column_name() + "`, ";
|
||||
if (history_array[i].get_type() == 'GroupBy') {
|
||||
str += '`' + history_array[i].get_column_name() + '`, ';
|
||||
}
|
||||
}
|
||||
str = str.substr(0, str.length - 2);
|
||||
@ -529,24 +517,23 @@ function query_groupby()
|
||||
*
|
||||
*/
|
||||
|
||||
function query_having()
|
||||
{
|
||||
function query_having () {
|
||||
var i;
|
||||
var and = "(";
|
||||
var and = '(';
|
||||
for (i = 0; i < history_array.length;i++) {
|
||||
if (history_array[i].get_type() == "Having") {
|
||||
if (history_array[i].get_type() == 'Having') {
|
||||
if (history_array[i].get_obj().get_operator() != 'None') {
|
||||
and += history_array[i].get_obj().get_operator() + "(`" + history_array[i].get_column_name() + "`) " + history_array[i].get_obj().getrelation_operator();
|
||||
and += " " + history_array[i].get_obj().getquery() + ", ";
|
||||
and += history_array[i].get_obj().get_operator() + '(`' + history_array[i].get_column_name() + '`) ' + history_array[i].get_obj().getrelation_operator();
|
||||
and += ' ' + history_array[i].get_obj().getquery() + ', ';
|
||||
} else {
|
||||
and += "`" + history_array[i].get_column_name() + "` " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() + ", ";
|
||||
and += '`' + history_array[i].get_column_name() + '` ' + history_array[i].get_obj().getrelation_operator() + ' ' + history_array[i].get_obj().getquery() + ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (and == "(") {
|
||||
and = "";
|
||||
if (and == '(') {
|
||||
and = '';
|
||||
} else {
|
||||
and = and.substr(0, and.length - 2) + ")";
|
||||
and = and.substr(0, and.length - 2) + ')';
|
||||
}
|
||||
return and;
|
||||
}
|
||||
@ -557,14 +544,13 @@ function query_having()
|
||||
*
|
||||
*/
|
||||
|
||||
function query_orderby()
|
||||
{
|
||||
function query_orderby () {
|
||||
var i;
|
||||
var str = "";
|
||||
var str = '';
|
||||
for (i = 0; i < history_array.length;i++) {
|
||||
if (history_array[i].get_type() == "OrderBy") {
|
||||
str += "`" + history_array[i].get_column_name() + "` " +
|
||||
history_array[i].get_obj().get_order() + ", ";
|
||||
if (history_array[i].get_type() == 'OrderBy') {
|
||||
str += '`' + history_array[i].get_column_name() + '` ' +
|
||||
history_array[i].get_obj().get_order() + ', ';
|
||||
}
|
||||
}
|
||||
str = str.substr(0, str.length - 2);
|
||||
@ -577,78 +563,74 @@ function query_orderby()
|
||||
*
|
||||
*/
|
||||
|
||||
function query_where()
|
||||
{
|
||||
function query_where () {
|
||||
var i;
|
||||
var and = "(";
|
||||
var or = "(";
|
||||
var and = '(';
|
||||
var or = '(';
|
||||
for (i = 0; i < history_array.length;i++) {
|
||||
if (history_array[i].get_type() == "Where") {
|
||||
if (history_array[i].get_type() == 'Where') {
|
||||
if (history_array[i].get_and_or() === 0) {
|
||||
and += "( `" + history_array[i].get_column_name() + "` " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() + ")";
|
||||
and += " AND ";
|
||||
and += '( `' + history_array[i].get_column_name() + '` ' + history_array[i].get_obj().getrelation_operator() + ' ' + history_array[i].get_obj().getquery() + ')';
|
||||
and += ' AND ';
|
||||
} else {
|
||||
or += "( `" + history_array[i].get_column_name() + "` " + history_array[i].get_obj().getrelation_operator() + " " + history_array[i].get_obj().getquery() + ")";
|
||||
or += " OR ";
|
||||
or += '( `' + history_array[i].get_column_name() + '` ' + history_array[i].get_obj().getrelation_operator() + ' ' + history_array[i].get_obj().getquery() + ')';
|
||||
or += ' OR ';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (or != "(") {
|
||||
or = or.substring(0, (or.length - 4)) + ")";
|
||||
if (or != '(') {
|
||||
or = or.substring(0, (or.length - 4)) + ')';
|
||||
} else {
|
||||
or = "";
|
||||
or = '';
|
||||
}
|
||||
if (and != "(") {
|
||||
and = and.substring(0, (and.length - 5)) + ")";
|
||||
if (and != '(') {
|
||||
and = and.substring(0, (and.length - 5)) + ')';
|
||||
} else {
|
||||
and = "";
|
||||
and = '';
|
||||
}
|
||||
if (or !== "") {
|
||||
and = and + " OR " + or + " )";
|
||||
if (or !== '') {
|
||||
and = and + ' OR ' + or + ' )';
|
||||
}
|
||||
return and;
|
||||
}
|
||||
|
||||
function check_aggregate(id_this)
|
||||
{
|
||||
function check_aggregate (id_this) {
|
||||
var i;
|
||||
for (i = 0; i < history_array.length; i++) {
|
||||
var temp = '`' + history_array[i].get_tab() + '`.`' + history_array[i].get_column_name() + '`';
|
||||
if (temp == id_this && history_array[i].get_type() == "Aggregate") {
|
||||
if (temp == id_this && history_array[i].get_type() == 'Aggregate') {
|
||||
return history_array[i].get_obj().get_operator() + '(' + id_this + ')';
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
}
|
||||
|
||||
function check_rename(id_this)
|
||||
{
|
||||
function check_rename (id_this) {
|
||||
var i;
|
||||
for (i = 0; i < history_array.length; i++) {
|
||||
var temp = '`' + history_array[i].get_tab() + '`.`' + history_array[i].get_column_name() + '`';
|
||||
if (temp == id_this && history_array[i].get_type() == "Rename") {
|
||||
return " AS `" + history_array[i].get_obj().getrename_to() + "`";
|
||||
if (temp == id_this && history_array[i].get_type() == 'Rename') {
|
||||
return ' AS `' + history_array[i].get_obj().getrename_to() + '`';
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* This function builds from clause of query
|
||||
* makes automatic joins.
|
||||
*
|
||||
*
|
||||
*/
|
||||
function query_from()
|
||||
{
|
||||
function query_from () {
|
||||
var i;
|
||||
var tab_left = [];
|
||||
var tab_used = [];
|
||||
var t_tab_used = [];
|
||||
var t_tab_left = [];
|
||||
var temp;
|
||||
var query = "";
|
||||
var quer = "";
|
||||
var query = '';
|
||||
var quer = '';
|
||||
var parts = [];
|
||||
var t_array = [];
|
||||
t_array = from_array;
|
||||
@ -677,16 +659,16 @@ function query_from()
|
||||
for (K in contr) {
|
||||
for (key in contr[K]) {// contr name
|
||||
for (key2 in contr[K][key]) {// table name
|
||||
parts = key2.split(".");
|
||||
parts = key2.split('.');
|
||||
if (found(tab_used, parts[1]) > 0) {
|
||||
for (key3 in contr[K][key][key2]) {
|
||||
parts1 = contr[K][key][key2][key3][0].split(".");
|
||||
parts1 = contr[K][key][key2][key3][0].split('.');
|
||||
if (found(tab_left, parts1[1]) > 0) {
|
||||
if (found(constraints_added, key) > 0) {
|
||||
query += ' AND ' + '`' + parts[1] + '`.`' + key3 + '` = ';
|
||||
query += '`' + parts1[1] + '`.`' + contr[K][key][key2][key3][1] + '` ';
|
||||
} else {
|
||||
query += "\n" + 'LEFT JOIN ';
|
||||
query += '\n' + 'LEFT JOIN ';
|
||||
query += '`' + parts[1] + '` ON ';
|
||||
query += '`' + parts1[1] + '`.`' + contr[K][key][key2][key3][1] + '` = ';
|
||||
query += '`' + parts[1] + '`.`' + key3 + '` ';
|
||||
@ -708,16 +690,16 @@ function query_from()
|
||||
for (K in contr) {
|
||||
for (key in contr[K]) {
|
||||
for (key2 in contr[K][key]) {// table name
|
||||
parts = key2.split(".");
|
||||
parts = key2.split('.');
|
||||
if (found(tab_left, parts[1]) > 0) {
|
||||
for (key3 in contr[K][key][key2]) {
|
||||
parts1 = contr[K][key][key2][key3][0].split(".");
|
||||
parts1 = contr[K][key][key2][key3][0].split('.');
|
||||
if (found(tab_used, parts1[1]) > 0) {
|
||||
if (found(constraints_added, key) > 0) {
|
||||
query += ' AND ' + '`' + parts[1] + '`.`' + key3 + '` = ';
|
||||
query += '`' + parts1[1] + '`.`' + contr[K][key][key2][key3][1] + '` ';
|
||||
} else {
|
||||
query += "\n" + 'LEFT JOIN ';
|
||||
query += '\n' + 'LEFT JOIN ';
|
||||
query += '`' + parts[1] + '` ON ';
|
||||
query += '`' + parts1[1] + '`.`' + contr[K][key][key2][key3][1] + '` = ';
|
||||
query += '`' + parts[1] + '`.`' + key3 + '` ';
|
||||
@ -737,7 +719,7 @@ function query_from()
|
||||
t_tab_left = [];
|
||||
}
|
||||
for (k in tab_left) {
|
||||
quer += " , `" + tab_left[k] + "`";
|
||||
quer += ' , `' + tab_left[k] + '`';
|
||||
}
|
||||
query = quer + query;
|
||||
from_array = t_array;
|
||||
@ -757,47 +739,46 @@ function query_from()
|
||||
* @param fadin
|
||||
*/
|
||||
|
||||
function build_query(formtitle, fadin)
|
||||
{
|
||||
var q_select = "SELECT ";
|
||||
function build_query (formtitle, fadin) {
|
||||
var q_select = 'SELECT ';
|
||||
var temp;
|
||||
if (select_field.length > 0) {
|
||||
for (var i = 0; i < select_field.length; i++) {
|
||||
temp = check_aggregate(select_field[i]);
|
||||
if (temp !== "") {
|
||||
if (temp !== '') {
|
||||
q_select += temp;
|
||||
temp = check_rename(select_field[i]);
|
||||
q_select += temp + ", ";
|
||||
q_select += temp + ', ';
|
||||
} else {
|
||||
temp = check_rename(select_field[i]);
|
||||
q_select += select_field[i] + temp + ", ";
|
||||
q_select += select_field[i] + temp + ', ';
|
||||
}
|
||||
}
|
||||
q_select = q_select.substring(0, q_select.length - 2);
|
||||
} else {
|
||||
q_select += "* ";
|
||||
q_select += '* ';
|
||||
}
|
||||
|
||||
q_select += "\nFROM " + query_from();
|
||||
q_select += '\nFROM ' + query_from();
|
||||
|
||||
var q_where = query_where();
|
||||
if (q_where !== "") {
|
||||
q_select += "\nWHERE " + q_where;
|
||||
if (q_where !== '') {
|
||||
q_select += '\nWHERE ' + q_where;
|
||||
}
|
||||
|
||||
var q_groupby = query_groupby();
|
||||
if (q_groupby !== "") {
|
||||
q_select += "\nGROUP BY " + q_groupby;
|
||||
if (q_groupby !== '') {
|
||||
q_select += '\nGROUP BY ' + q_groupby;
|
||||
}
|
||||
|
||||
var q_having = query_having();
|
||||
if (q_having !== "") {
|
||||
q_select += "\nHAVING " + q_having;
|
||||
if (q_having !== '') {
|
||||
q_select += '\nHAVING ' + q_having;
|
||||
}
|
||||
|
||||
var q_orderby = query_orderby();
|
||||
if (q_orderby !== "") {
|
||||
q_select += "\nORDER BY " + q_orderby;
|
||||
if (q_orderby !== '') {
|
||||
q_select += '\nORDER BY ' + q_orderby;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -806,7 +787,7 @@ function build_query(formtitle, fadin)
|
||||
*/
|
||||
var button_options = {};
|
||||
button_options[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
button_options[PMA_messages.strSubmit] = function () {
|
||||
if (vqb_editor) {
|
||||
@ -846,24 +827,24 @@ AJAX.registerTeardown('pmd/history.js', function () {
|
||||
vqb_editor = null;
|
||||
history_array = [];
|
||||
select_field = [];
|
||||
$("#ok_edit_rename").off('click');
|
||||
$("#ok_edit_having").off('click');
|
||||
$("#ok_edit_Aggr").off('click');
|
||||
$("#ok_edit_where").off('click');
|
||||
$('#ok_edit_rename').off('click');
|
||||
$('#ok_edit_having').off('click');
|
||||
$('#ok_edit_Aggr').off('click');
|
||||
$('#ok_edit_where').off('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('pmd/history.js', function () {
|
||||
$("#ok_edit_rename").click(function() {
|
||||
$('#ok_edit_rename').click(function () {
|
||||
edit('Rename');
|
||||
});
|
||||
$("#ok_edit_having").click(function() {
|
||||
$('#ok_edit_having').click(function () {
|
||||
edit('Having');
|
||||
});
|
||||
$("#ok_edit_Aggr").click(function() {
|
||||
$('#ok_edit_Aggr').click(function () {
|
||||
edit('Aggregate');
|
||||
});
|
||||
$("#ok_edit_where").click(function() {
|
||||
$('#ok_edit_where').click(function () {
|
||||
edit('Where');
|
||||
});
|
||||
$('#ab').accordion({collapsible : true, active : 'none'});
|
||||
$('#ab').accordion({ collapsible : true, active : 'none' });
|
||||
});
|
||||
|
||||
@ -6,55 +6,55 @@
|
||||
var j_tabs, h_tabs, contr, display_field, server, db, selected_page, pmd_tables_enabled;
|
||||
|
||||
AJAX.registerTeardown('pmd/init.js', function () {
|
||||
$(".trigger").off('click');
|
||||
$('.trigger').off('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('pmd/init.js', function () {
|
||||
$(".trigger").click(function () {
|
||||
$(".panel").toggle("fast");
|
||||
$(this).toggleClass("active");
|
||||
$('#ab').accordion("refresh");
|
||||
$('.trigger').click(function () {
|
||||
$('.panel').toggle('fast');
|
||||
$(this).toggleClass('active');
|
||||
$('#ab').accordion('refresh');
|
||||
return false;
|
||||
});
|
||||
var tables_data = JSON.parse($("#script_tables").html());
|
||||
var tables_data = JSON.parse($('#script_tables').html());
|
||||
|
||||
j_tabs = tables_data.j_tabs;
|
||||
h_tabs = tables_data.h_tabs;
|
||||
contr = JSON.parse($("#script_contr").html());
|
||||
display_field = JSON.parse($("#script_display_field").html());
|
||||
contr = JSON.parse($('#script_contr').html());
|
||||
display_field = JSON.parse($('#script_display_field').html());
|
||||
|
||||
server = $("#script_server").html();
|
||||
db = $("#script_db").html();
|
||||
selected_page = $("#script_display_page").html() === "" ? "-1" : $("#script_display_page").html();
|
||||
pmd_tables_enabled = $("#pmd_tables_enabled").html() === "1";
|
||||
server = $('#script_server').html();
|
||||
db = $('#script_db').html();
|
||||
selected_page = $('#script_display_page').html() === '' ? '-1' : $('#script_display_page').html();
|
||||
pmd_tables_enabled = $('#pmd_tables_enabled').html() === '1';
|
||||
|
||||
Main();
|
||||
|
||||
if (! pmd_tables_enabled) {
|
||||
DesignerOfflineDB.open(function(success) {
|
||||
DesignerOfflineDB.open(function (success) {
|
||||
if (success) {
|
||||
Show_tables_in_landing_page(db);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#query_Aggregate_Button').click(function(){
|
||||
$('#query_Aggregate_Button').click(function () {
|
||||
document.getElementById('query_Aggregate').style.display = 'none';
|
||||
});
|
||||
|
||||
$('#query_having_button').click(function(){
|
||||
$('#query_having_button').click(function () {
|
||||
document.getElementById('query_having').style.display = 'none';
|
||||
});
|
||||
|
||||
$('#query_rename_to_button').click(function(){
|
||||
$('#query_rename_to_button').click(function () {
|
||||
document.getElementById('query_rename_to').style.display = 'none';
|
||||
});
|
||||
|
||||
$('#build_query_button').click(function(){
|
||||
build_query('SQL Query on Database', 0)
|
||||
$('#build_query_button').click(function () {
|
||||
build_query('SQL Query on Database', 0);
|
||||
});
|
||||
|
||||
$('#query_where_button').click(function(){
|
||||
$('#query_where_button').click(function () {
|
||||
document.getElementById('query_where').style.display = 'none';
|
||||
});
|
||||
});
|
||||
|
||||
671
js/pmd/move.js
671
js/pmd/move.js
File diff suppressed because it is too large
Load Diff
@ -5,24 +5,23 @@
|
||||
*/
|
||||
|
||||
var random_server_id = Math.floor(Math.random() * 10000000);
|
||||
var conf_prefix = "server-id=" + random_server_id + "\nlog_bin=mysql-bin\nlog_error=mysql-bin.err\n";
|
||||
var conf_prefix = 'server-id=' + random_server_id + '\nlog_bin=mysql-bin\nlog_error=mysql-bin.err\n';
|
||||
|
||||
function update_config()
|
||||
{
|
||||
var conf_ignore = "binlog_ignore_db=";
|
||||
var conf_do = "binlog_do_db=";
|
||||
function update_config () {
|
||||
var conf_ignore = 'binlog_ignore_db=';
|
||||
var conf_do = 'binlog_do_db=';
|
||||
var database_list = '';
|
||||
|
||||
if ($('#db_select option:selected').size() === 0) {
|
||||
$('#rep').text(conf_prefix);
|
||||
} else if ($('#db_type option:selected').val() == 'all') {
|
||||
$('#db_select option:selected').each(function () {
|
||||
database_list += conf_ignore + $(this).val() + "\n";
|
||||
database_list += conf_ignore + $(this).val() + '\n';
|
||||
});
|
||||
$('#rep').text(conf_prefix + database_list);
|
||||
} else {
|
||||
$('#db_select option:selected').each(function () {
|
||||
database_list += conf_do + $(this).val() + "\n";
|
||||
database_list += conf_do + $(this).val() + '\n';
|
||||
});
|
||||
$('#rep').text(conf_prefix + database_list);
|
||||
}
|
||||
|
||||
73
js/rte.js
73
js/rte.js
@ -85,8 +85,7 @@ RTE.COMMON = {
|
||||
if ($elm.val() === '') {
|
||||
if (this.syntaxHiglighter !== null) {
|
||||
this.syntaxHiglighter.focus();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('textarea[name=item_definition]').last().focus();
|
||||
}
|
||||
alert(PMA_messages.strFormEmpty);
|
||||
@ -134,17 +133,17 @@ RTE.COMMON = {
|
||||
}
|
||||
|
||||
export_anchors.each(function () {
|
||||
$.get($(this).attr('href'), {'ajax_request': true}, function (data) {
|
||||
$.get($(this).attr('href'), { 'ajax_request': true }, function (data) {
|
||||
returnCount++;
|
||||
if (data.success === true) {
|
||||
combined.message += "\n" + data.message + "\n";
|
||||
combined.message += '\n' + data.message + '\n';
|
||||
if (returnCount == count) {
|
||||
showExport(combined);
|
||||
}
|
||||
} else {
|
||||
// complain even if one export is failing
|
||||
combined.success = false;
|
||||
combined.error += "\n" + data.error + "\n";
|
||||
combined.error += '\n' + data.error + '\n';
|
||||
if (returnCount == count) {
|
||||
showExport(combined);
|
||||
}
|
||||
@ -152,11 +151,11 @@ RTE.COMMON = {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$.get($this.attr('href'), {'ajax_request': true}, showExport);
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, showExport);
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
|
||||
function showExport(data) {
|
||||
function showExport (data) {
|
||||
if (data.success === true) {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
/**
|
||||
@ -165,7 +164,7 @@ RTE.COMMON = {
|
||||
*/
|
||||
var button_options = {};
|
||||
button_options[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close").remove();
|
||||
$(this).dialog('close').remove();
|
||||
};
|
||||
/**
|
||||
* Display the dialog to the user
|
||||
@ -207,7 +206,7 @@ RTE.COMMON = {
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
$.get($this.attr('href'), {'ajax_request': true}, function (data) {
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, function (data) {
|
||||
if (data.success === true) {
|
||||
// We have successfully fetched the editor form
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
@ -216,7 +215,7 @@ RTE.COMMON = {
|
||||
that.buttonOptions[PMA_messages.strGo] = function () {
|
||||
// Move the data from the codemirror editor back to the
|
||||
// textarea, where it can be used in the form submission.
|
||||
if (typeof CodeMirror != 'undefined') {
|
||||
if (typeof CodeMirror !== 'undefined') {
|
||||
that.syntaxHiglighter.save();
|
||||
}
|
||||
// Validate editor and submit request, if passed.
|
||||
@ -237,7 +236,7 @@ RTE.COMMON = {
|
||||
that.$ajaxDialog.dialog('close');
|
||||
// If we are in 'edit' mode, we must
|
||||
// remove the reference to the old row.
|
||||
if (mode === 'edit' && $edit_row !== null ) {
|
||||
if (mode === 'edit' && $edit_row !== null) {
|
||||
$edit_row.remove();
|
||||
}
|
||||
// Sometimes, like when moving a trigger from
|
||||
@ -261,11 +260,11 @@ RTE.COMMON = {
|
||||
var inserted = false;
|
||||
$('table.data').find('tr').each(function () {
|
||||
text = $(this)
|
||||
.children('td')
|
||||
.eq(0)
|
||||
.find('strong')
|
||||
.text()
|
||||
.toUpperCase();
|
||||
.children('td')
|
||||
.eq(0)
|
||||
.find('strong')
|
||||
.text()
|
||||
.toUpperCase();
|
||||
text = $.trim(text);
|
||||
if (text !== '' && text > data.name) {
|
||||
$(this).before(data.new_row);
|
||||
@ -290,8 +289,8 @@ RTE.COMMON = {
|
||||
// we were editing the only item in the list,
|
||||
// which we removed and will not be inserting
|
||||
// something else in its place.
|
||||
$('table.data').hide("slow", function () {
|
||||
$('#nothing2display').show("slow");
|
||||
$('table.data').hide('slow', function () {
|
||||
$('#nothing2display').show('slow');
|
||||
});
|
||||
}
|
||||
// Now we have inserted the row at the correct
|
||||
@ -316,9 +315,9 @@ RTE.COMMON = {
|
||||
// the "No items" message and show the list.
|
||||
if ($('table.data').find('tr').has('td').length > 0 &&
|
||||
$('#nothing2display').is(':visible')
|
||||
) {
|
||||
$('#nothing2display').hide("slow", function () {
|
||||
$('table.data').show("slow");
|
||||
) {
|
||||
$('#nothing2display').hide('slow', function () {
|
||||
$('table.data').show('slow');
|
||||
});
|
||||
}
|
||||
PMA_reloadNavigation();
|
||||
@ -329,7 +328,7 @@ RTE.COMMON = {
|
||||
} // end "if (that.validate())"
|
||||
}; // end of function that handles the submission of the Editor
|
||||
that.buttonOptions[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
/**
|
||||
* Display the dialog to the user
|
||||
@ -343,7 +342,7 @@ RTE.COMMON = {
|
||||
modal: true,
|
||||
open: function () {
|
||||
if ($('#rteDialog').parents('.ui-dialog').height() > $(window).height()) {
|
||||
$('#rteDialog').dialog("option", "height", $(window).height());
|
||||
$('#rteDialog').dialog('option', 'height', $(window).height());
|
||||
}
|
||||
$(this).find('input[name=item_name]').focus();
|
||||
$(this).find('input.datefield').each(function () {
|
||||
@ -420,13 +419,13 @@ RTE.COMMON = {
|
||||
// the header of the table and the rows that we are
|
||||
// about to remove, so after the removal there will be
|
||||
// nothing to show in the table, so we hide it.
|
||||
$table.hide("slow", function () {
|
||||
$table.hide('slow', function () {
|
||||
$(this).find('tr.even, tr.odd').remove();
|
||||
$('.withSelected').remove();
|
||||
$('#nothing2display').show("slow");
|
||||
$('#nothing2display').show('slow');
|
||||
});
|
||||
} else {
|
||||
$curr_row.hide("slow", function () {
|
||||
$curr_row.hide('slow', function () {
|
||||
$(this).remove();
|
||||
// Now we have removed the row from the list, but maybe
|
||||
// some row classes are wrong now. So we will itirate
|
||||
@ -499,13 +498,13 @@ RTE.COMMON = {
|
||||
// the header of the table and the rows that we are
|
||||
// about to remove, so after the removal there will be
|
||||
// nothing to show in the table, so we hide it.
|
||||
$table.hide("slow", function () {
|
||||
$table.hide('slow', function () {
|
||||
$(this).find('tr.even, tr.odd').remove();
|
||||
$('.withSelected').remove();
|
||||
$('#nothing2display').show("slow");
|
||||
$('#nothing2display').show('slow');
|
||||
});
|
||||
} else {
|
||||
$curr_row.hide("fast", function () {
|
||||
$curr_row.hide('fast', function () {
|
||||
$(this).remove();
|
||||
// Now we have removed the row from the list, but maybe
|
||||
// some row classes are wrong now. So we will itirate
|
||||
@ -530,7 +529,7 @@ RTE.COMMON = {
|
||||
if (success) {
|
||||
// Get rid of the "Loading" message
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
$('#rteListForm_checkall').prop({checked: false, indeterminate: false});
|
||||
$('#rteListForm_checkall').prop({ checked: false, indeterminate: false });
|
||||
}
|
||||
PMA_reloadNavigation();
|
||||
}
|
||||
@ -617,7 +616,7 @@ RTE.ROUTINE = {
|
||||
$('.routine_params_table tbody').sortable({
|
||||
containment: '.routine_params_table tbody',
|
||||
handle: '.dragHandle',
|
||||
stop: function(event, ui) {
|
||||
stop: function (event, ui) {
|
||||
that.reindexParameters();
|
||||
},
|
||||
});
|
||||
@ -700,7 +699,7 @@ RTE.ROUTINE = {
|
||||
if ($inputtyp.length && $inputlen.length) {
|
||||
if (($inputtyp.val() === 'ENUM' || $inputtyp.val() === 'SET' || $inputtyp.val().substr(0, 3) === 'VAR') &&
|
||||
$inputlen.val() === ''
|
||||
) {
|
||||
) {
|
||||
$inputlen.focus();
|
||||
isSuccess = false;
|
||||
return false;
|
||||
@ -718,7 +717,7 @@ RTE.ROUTINE = {
|
||||
var $returnlen = this.$ajaxDialog.find('input[name=item_returnlength]');
|
||||
if (($returntyp.val() === 'ENUM' || $returntyp.val() === 'SET' || $returntyp.val().substr(0, 3) === 'VAR') &&
|
||||
$returnlen.val() === ''
|
||||
) {
|
||||
) {
|
||||
$returnlen.focus();
|
||||
alert(PMA_messages.strFormEmpty);
|
||||
return false;
|
||||
@ -862,7 +861,7 @@ RTE.ROUTINE = {
|
||||
});
|
||||
};
|
||||
that.buttonOptions[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
/**
|
||||
* Display the dialog to the user
|
||||
@ -991,9 +990,9 @@ $(function () {
|
||||
*/
|
||||
$(document).on('change', 'select[name=item_type]', function () {
|
||||
$(this)
|
||||
.closest('table')
|
||||
.find('tr.recurring_event_row, tr.onetime_event_row, tr.routine_return_row, .routine_direction_cell')
|
||||
.toggle();
|
||||
.closest('table')
|
||||
.find('tr.recurring_event_row, tr.onetime_event_row, tr.routine_return_row, .routine_direction_cell')
|
||||
.toggle();
|
||||
}); // end $(document).on()
|
||||
|
||||
/**
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_databases.js', function () {
|
||||
$(document).off('submit', "#dbStatsForm");
|
||||
$(document).off('submit', '#dbStatsForm');
|
||||
$(document).off('submit', '#create_database_form.ajax');
|
||||
$('#filterText').off('keyup');
|
||||
});
|
||||
@ -28,7 +28,7 @@ AJAX.registerOnload('server_databases.js', function () {
|
||||
/**
|
||||
* Attach Event Handler for 'Drop Databases'
|
||||
*/
|
||||
$(document).on('submit', "#dbStatsForm", function (event) {
|
||||
$(document).on('submit', '#dbStatsForm', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $form = $(this);
|
||||
@ -89,7 +89,7 @@ AJAX.registerOnload('server_databases.js', function () {
|
||||
}); // end $.post()
|
||||
}
|
||||
); // end $.PMA_confirm()
|
||||
}); //end of Drop Database action
|
||||
}); // end of Drop Database action
|
||||
|
||||
/**
|
||||
* Attach Ajax event handlers for 'Create Database'.
|
||||
@ -136,26 +136,26 @@ AJAX.registerOnload('server_databases.js', function () {
|
||||
|
||||
/* Don't show filter if number of databases are very few */
|
||||
var databasesCount = $('#databases_count').html();
|
||||
if(databasesCount <= 10) {
|
||||
if (databasesCount <= 10) {
|
||||
$('#tableFilter').hide();
|
||||
}
|
||||
|
||||
var $filterField = $('#filterText');
|
||||
/* Event handler for database filter */
|
||||
$filterField.keyup(function (){
|
||||
var textFilter = null, val = $(this).val();
|
||||
if(val.length != 0) {
|
||||
try {
|
||||
textFilter = new RegExp(val.replace(/_/g, ' '), 'i');
|
||||
$(this).removeClass('error');
|
||||
} catch(e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
$(this).addClass('error');
|
||||
textFilter = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
filterVariables(textFilter);
|
||||
$filterField.keyup(function () {
|
||||
var textFilter = null, val = $(this).val();
|
||||
if (val.length != 0) {
|
||||
try {
|
||||
textFilter = new RegExp(val.replace(/_/g, ' '), 'i');
|
||||
$(this).removeClass('error');
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
$(this).addClass('error');
|
||||
textFilter = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
filterVariables(textFilter);
|
||||
});
|
||||
|
||||
/* Trigger filtering of the list based on incoming database name */
|
||||
@ -164,25 +164,25 @@ AJAX.registerOnload('server_databases.js', function () {
|
||||
}
|
||||
|
||||
/* Filters the rows by the user given regexp */
|
||||
function filterVariables(textFilter) {
|
||||
function filterVariables (textFilter) {
|
||||
var $row, databasesCount = 0;
|
||||
$('#tabledatabases').find('.db-row').each(function () {
|
||||
$row = $(this);
|
||||
if (textFilter === null ||
|
||||
textFilter.exec($row.find('.name').text())
|
||||
) {
|
||||
$row.css('display', '');
|
||||
databasesCount += 1;
|
||||
} else {
|
||||
$row.css('display', 'none');
|
||||
}
|
||||
) {
|
||||
$row.css('display', '');
|
||||
databasesCount += 1;
|
||||
} else {
|
||||
$row.css('display', 'none');
|
||||
}
|
||||
$('#databases_count').html(databasesCount);
|
||||
});
|
||||
}
|
||||
|
||||
var tableRows = $('.server_databases');
|
||||
$.each(tableRows, function(index, item) {
|
||||
$(this).click(function(){
|
||||
$.each(tableRows, function (index, item) {
|
||||
$(this).click(function () {
|
||||
PMA_commonActions.setDb($(this).attr('data'));
|
||||
});
|
||||
});
|
||||
|
||||
@ -3,12 +3,12 @@
|
||||
* Functions used in server plugins pages
|
||||
*/
|
||||
AJAX.registerOnload('server_plugins.js', function () {
|
||||
// Make columns sortable, but only for tables with more than 1 data row
|
||||
// Make columns sortable, but only for tables with more than 1 data row
|
||||
var $tables = $('#plugins_plugins table:has(tbody tr + tr)');
|
||||
$tables.tablesorter({
|
||||
sortList: [[0, 0]],
|
||||
headers: {
|
||||
1: {sorter: false}
|
||||
1: { sorter: false }
|
||||
}
|
||||
});
|
||||
$tables.find('thead th')
|
||||
|
||||
@ -14,8 +14,7 @@
|
||||
*
|
||||
* @return boolean whether the form is validated or not
|
||||
*/
|
||||
function checkAddUser(the_form)
|
||||
{
|
||||
function checkAddUser (the_form) {
|
||||
if (the_form.elements.pred_hostname.value == 'userdefined' && the_form.elements.hostname.value === '') {
|
||||
alert(PMA_messages.strHostEmpty);
|
||||
the_form.elements.hostname.focus();
|
||||
@ -31,7 +30,7 @@ function checkAddUser(the_form)
|
||||
return PMA_checkPassword($(the_form));
|
||||
} // end of the 'checkAddUser()' function
|
||||
|
||||
function checkPasswordStrength(value, meter_obj, meter_object_label, username) {
|
||||
function checkPasswordStrength (value, meter_obj, meter_object_label, username) {
|
||||
// List of words we don't want to appear in the password
|
||||
customDict = [
|
||||
'phpmyadmin',
|
||||
@ -42,22 +41,22 @@ function checkPasswordStrength(value, meter_obj, meter_object_label, username) {
|
||||
'admin',
|
||||
];
|
||||
if (username != null) {
|
||||
customDict.push(username)
|
||||
customDict.push(username);
|
||||
}
|
||||
var zxcvbn_obj = zxcvbn(value, customDict);
|
||||
var strength = zxcvbn_obj.score;
|
||||
strength = parseInt(strength);
|
||||
meter_obj.val(strength);
|
||||
switch(strength){
|
||||
case 0: meter_obj_label.html(PMA_messages.strExtrWeak);
|
||||
break;
|
||||
case 1: meter_obj_label.html(PMA_messages.strVeryWeak);
|
||||
break;
|
||||
case 2: meter_obj_label.html(PMA_messages.strWeak);
|
||||
break;
|
||||
case 3: meter_obj_label.html(PMA_messages.strGood);
|
||||
break;
|
||||
case 4: meter_obj_label.html(PMA_messages.strStrong);
|
||||
switch (strength) {
|
||||
case 0: meter_obj_label.html(PMA_messages.strExtrWeak);
|
||||
break;
|
||||
case 1: meter_obj_label.html(PMA_messages.strVeryWeak);
|
||||
break;
|
||||
case 2: meter_obj_label.html(PMA_messages.strWeak);
|
||||
break;
|
||||
case 3: meter_obj_label.html(PMA_messages.strGood);
|
||||
break;
|
||||
case 4: meter_obj_label.html(PMA_messages.strStrong);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,14 +80,14 @@ function checkPasswordStrength(value, meter_obj, meter_object_label, username) {
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_privileges.js', function () {
|
||||
$("#fieldset_add_user_login").off('change', "input[name='username']");
|
||||
$(document).off('click', "#fieldset_delete_user_footer #buttonGo.ajax");
|
||||
$(document).off('click', "a.edit_user_group_anchor.ajax");
|
||||
$(document).off('click', "button.mult_submit[value=export]");
|
||||
$(document).off('click', "a.export_user_anchor.ajax");
|
||||
$(document).off('click', "#initials_table a.ajax");
|
||||
$('#fieldset_add_user_login').off('change', 'input[name=\'username\']');
|
||||
$(document).off('click', '#fieldset_delete_user_footer #buttonGo.ajax');
|
||||
$(document).off('click', 'a.edit_user_group_anchor.ajax');
|
||||
$(document).off('click', 'button.mult_submit[value=export]');
|
||||
$(document).off('click', 'a.export_user_anchor.ajax');
|
||||
$(document).off('click', '#initials_table a.ajax');
|
||||
$('#checkbox_drop_users_db').off('click');
|
||||
$(document).off("click", ".checkall_box");
|
||||
$(document).off('click', '.checkall_box');
|
||||
$(document).off('change', '#checkbox_SSL_priv');
|
||||
$(document).off('change', 'input[name="ssl_type"]');
|
||||
$(document).off('change', '#select_authentication_plugin');
|
||||
@ -98,11 +97,11 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
/**
|
||||
* Display a warning if there is already a user by the name entered as the username.
|
||||
*/
|
||||
$("#fieldset_add_user_login").on('change', "input[name='username']", function () {
|
||||
$('#fieldset_add_user_login').on('change', 'input[name=\'username\']', function () {
|
||||
var username = $(this).val();
|
||||
var $warning = $("#user_exists_warning");
|
||||
if ($("#select_pred_username").val() == 'userdefined' && username !== '') {
|
||||
var href = $("form[name='usersForm']").attr('action');
|
||||
var $warning = $('#user_exists_warning');
|
||||
if ($('#select_pred_username').val() == 'userdefined' && username !== '') {
|
||||
var href = $('form[name=\'usersForm\']').attr('action');
|
||||
var params = {
|
||||
'ajax_request' : true,
|
||||
'server' : PMA_commonParams.get('server'),
|
||||
@ -141,7 +140,7 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
/**
|
||||
* Display a notice if sha256_password is selected
|
||||
*/
|
||||
$(document).on("change", "#select_authentication_plugin", function () {
|
||||
$(document).on('change', '#select_authentication_plugin', function () {
|
||||
var selected_plugin = $(this).val();
|
||||
if (selected_plugin === 'sha256_password') {
|
||||
$('#ssl_reqd_warning').show();
|
||||
@ -157,15 +156,14 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
* @memberOf jQuery
|
||||
* @name revoke_user_click
|
||||
*/
|
||||
$(document).on('click', "#fieldset_delete_user_footer #buttonGo.ajax", function (event) {
|
||||
$(document).on('click', '#fieldset_delete_user_footer #buttonGo.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $thisButton = $(this);
|
||||
var $form = $("#usersForm");
|
||||
var $form = $('#usersForm');
|
||||
|
||||
$thisButton.PMA_confirm(PMA_messages.strDropUserWarning, $form.attr('action'), function (url) {
|
||||
|
||||
var $drop_users_db_checkbox = $("#checkbox_drop_users_db");
|
||||
var $drop_users_db_checkbox = $('#checkbox_drop_users_db');
|
||||
if ($drop_users_db_checkbox.is(':checked')) {
|
||||
var is_confirmed = confirm(PMA_messages.strDropDatabaseStrongWarning + '\n' + PMA_sprintf(PMA_messages.strDoYouReally, 'DROP DATABASE'));
|
||||
if (! is_confirmed) {
|
||||
@ -176,7 +174,7 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages.strRemovingSelectedUsers);
|
||||
|
||||
$.post(url, $form.serialize() + "&delete=" + $thisButton.val() + "&ajax_request=true", function (data) {
|
||||
$.post(url, $form.serialize() + '&delete=' + $thisButton.val() + '&ajax_request=true', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
// Refresh navigation, if we droppped some databases with the name
|
||||
@ -184,37 +182,35 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
if ($('#checkbox_drop_users_db:checked').length) {
|
||||
PMA_reloadNavigation();
|
||||
}
|
||||
//Remove the revoked user from the users list
|
||||
$form.find("input:checkbox:checked").parents("tr").slideUp("medium", function () {
|
||||
// Remove the revoked user from the users list
|
||||
$form.find('input:checkbox:checked').parents('tr').slideUp('medium', function () {
|
||||
var this_user_initial = $(this).find('input:checkbox').val().charAt(0).toUpperCase();
|
||||
$(this).remove();
|
||||
|
||||
//If this is the last user with this_user_initial, remove the link from #initials_table
|
||||
if ($("#tableuserrights").find('input:checkbox[value^="' + this_user_initial + '"], input:checkbox[value^="' + this_user_initial.toLowerCase() + '"]').length === 0) {
|
||||
$("#initials_table").find('td > a:contains(' + this_user_initial + ')').parent('td').html(this_user_initial);
|
||||
// If this is the last user with this_user_initial, remove the link from #initials_table
|
||||
if ($('#tableuserrights').find('input:checkbox[value^="' + this_user_initial + '"], input:checkbox[value^="' + this_user_initial.toLowerCase() + '"]').length === 0) {
|
||||
$('#initials_table').find('td > a:contains(' + this_user_initial + ')').parent('td').html(this_user_initial);
|
||||
}
|
||||
|
||||
//Re-check the classes of each row
|
||||
// Re-check the classes of each row
|
||||
$form
|
||||
.find('tbody').find('tr:odd')
|
||||
.removeClass('even').addClass('odd')
|
||||
.end()
|
||||
.find('tr:even')
|
||||
.removeClass('odd').addClass('even');
|
||||
.find('tbody').find('tr:odd')
|
||||
.removeClass('even').addClass('odd')
|
||||
.end()
|
||||
.find('tr:even')
|
||||
.removeClass('odd').addClass('even');
|
||||
|
||||
//update the checkall checkbox
|
||||
$(checkboxes_sel).trigger("change");
|
||||
// update the checkall checkbox
|
||||
$(checkboxes_sel).trigger('change');
|
||||
});
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
|
||||
});
|
||||
|
||||
}); // end Revoke User
|
||||
|
||||
$(document).on('click', "a.edit_user_group_anchor.ajax", function (event) {
|
||||
$(document).on('click', 'a.edit_user_group_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
$(this).parents('tr').addClass('current_row');
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
@ -239,23 +235,23 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
function (data) {
|
||||
PMA_ajaxRemoveMessage($message);
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$("#usersForm")
|
||||
$('#usersForm')
|
||||
.find('.current_row')
|
||||
.removeClass('current_row')
|
||||
.find('.usrGroup')
|
||||
.text(usrGroup);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
$("#usersForm")
|
||||
$('#usersForm')
|
||||
.find('.current_row')
|
||||
.removeClass('current_row');
|
||||
}
|
||||
}
|
||||
);
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
buttonOptions[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
var $dialog = $('<div/>')
|
||||
.attr('id', 'changeUserGroupDialog')
|
||||
@ -273,7 +269,7 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
$dialog.find('legend').remove();
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
$("#usersForm")
|
||||
$('#usersForm')
|
||||
.find('.current_row')
|
||||
.removeClass('current_row');
|
||||
}
|
||||
@ -288,17 +284,17 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
* @memberOf jQuery
|
||||
* @name export_user_click
|
||||
*/
|
||||
$(document).on('click', "button.mult_submit[value=export]", function (event) {
|
||||
$(document).on('click', 'button.mult_submit[value=export]', function (event) {
|
||||
event.preventDefault();
|
||||
// can't export if no users checked
|
||||
if ($(this.form).find("input:checked").length === 0) {
|
||||
if ($(this.form).find('input:checked').length === 0) {
|
||||
PMA_ajaxShowMessage(PMA_messages.strNoAccountSelected, 2000, 'success');
|
||||
return;
|
||||
}
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
var button_options = {};
|
||||
button_options[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
$.post(
|
||||
$(this.form).prop('action'),
|
||||
@ -306,6 +302,40 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
var $ajaxDialog = $('<div />')
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: data.title,
|
||||
width: 500,
|
||||
buttons: button_options,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
// Attach syntax highlighted editor to export dialog
|
||||
PMA_getSQLEditor($ajaxDialog.find('textarea'));
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
); // end $.post
|
||||
});
|
||||
// if exporting non-ajax, highlight anyways
|
||||
PMA_getSQLEditor($('textarea.export'));
|
||||
|
||||
$(document).on('click', 'a.export_user_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
/**
|
||||
* @var button_options Object containing options for jQueryUI dialog buttons
|
||||
*/
|
||||
var button_options = {};
|
||||
button_options[PMA_messages.strClose] = function () {
|
||||
$(this).dialog('close');
|
||||
};
|
||||
$.get($(this).attr('href'), { 'ajax_request': true }, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
var $ajaxDialog = $('<div />')
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: data.title,
|
||||
@ -315,48 +345,14 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
// Attach syntax highlighted editor to export dialog
|
||||
PMA_getSQLEditor($ajaxDialog.find('textarea'));
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
); //end $.post
|
||||
});
|
||||
// if exporting non-ajax, highlight anyways
|
||||
PMA_getSQLEditor($('textarea.export'));
|
||||
|
||||
$(document).on('click', "a.export_user_anchor.ajax", function (event) {
|
||||
event.preventDefault();
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
/**
|
||||
* @var button_options Object containing options for jQueryUI dialog buttons
|
||||
*/
|
||||
var button_options = {};
|
||||
button_options[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close");
|
||||
};
|
||||
$.get($(this).attr('href'), {'ajax_request': true}, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
var $ajaxDialog = $('<div />')
|
||||
.append(data.message)
|
||||
.dialog({
|
||||
title: data.title,
|
||||
width: 500,
|
||||
buttons: button_options,
|
||||
close: function () {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
// Attach syntax highlighted editor to export dialog
|
||||
PMA_getSQLEditor($ajaxDialog.find('textarea'));
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); //end $.get
|
||||
}); //end export privileges
|
||||
}); // end $.get
|
||||
}); // end export privileges
|
||||
|
||||
/**
|
||||
* AJAX handler to Paginate the Users Table
|
||||
@ -365,23 +361,23 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
* @name paginate_users_table_click
|
||||
* @memberOf jQuery
|
||||
*/
|
||||
$(document).on('click', "#initials_table a.ajax", function (event) {
|
||||
$(document).on('click', '#initials_table a.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
$.get($(this).attr('href'), {'ajax_request' : true}, function (data) {
|
||||
$.get($(this).attr('href'), { 'ajax_request' : true }, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
// This form is not on screen when first entering Privileges
|
||||
// if there are more than 50 users
|
||||
$("div.notice").remove();
|
||||
$("#usersForm").hide("medium").remove();
|
||||
$("#fieldset_add_user").hide("medium").remove();
|
||||
$("#initials_table")
|
||||
.prop("id", "initials_table_old")
|
||||
.after(data.message).show("medium")
|
||||
.siblings("h2").not(":first").remove();
|
||||
$('div.notice').remove();
|
||||
$('#usersForm').hide('medium').remove();
|
||||
$('#fieldset_add_user').hide('medium').remove();
|
||||
$('#initials_table')
|
||||
.prop('id', 'initials_table_old')
|
||||
.after(data.message).show('medium')
|
||||
.siblings('h2').not(':first').remove();
|
||||
// prevent double initials table
|
||||
$("#initials_table_old").remove();
|
||||
$('#initials_table_old').remove();
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
@ -413,8 +409,8 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
* Create submenu for simpler interface
|
||||
*/
|
||||
var addOrUpdateSubmenu = function () {
|
||||
var $topmenu2 = $("#topmenu2"),
|
||||
$edit_user_dialog = $("#edit_user_dialog"),
|
||||
var $topmenu2 = $('#topmenu2'),
|
||||
$edit_user_dialog = $('#edit_user_dialog'),
|
||||
submenu_label,
|
||||
submenu_link,
|
||||
link_number;
|
||||
@ -425,55 +421,55 @@ AJAX.registerOnload('server_privileges.js', function () {
|
||||
}
|
||||
|
||||
// construct a submenu from the existing fieldsets
|
||||
$topmenu2 = $("<ul/>").prop("id", "topmenu2");
|
||||
$topmenu2 = $('<ul/>').prop('id', 'topmenu2');
|
||||
|
||||
$("#edit_user_dialog .submenu-item").each(function () {
|
||||
submenu_label = $(this).find("legend[data-submenu-label]").data("submenu-label");
|
||||
$('#edit_user_dialog .submenu-item').each(function () {
|
||||
submenu_label = $(this).find('legend[data-submenu-label]').data('submenu-label');
|
||||
|
||||
submenu_link = $("<a/>")
|
||||
.prop("href", "#")
|
||||
.html(submenu_label);
|
||||
submenu_link = $('<a/>')
|
||||
.prop('href', '#')
|
||||
.html(submenu_label);
|
||||
|
||||
$("<li/>")
|
||||
.append(submenu_link)
|
||||
.appendTo($topmenu2);
|
||||
$('<li/>')
|
||||
.append(submenu_link)
|
||||
.appendTo($topmenu2);
|
||||
});
|
||||
|
||||
// click handlers for submenu
|
||||
$topmenu2.find("a").click(function (e) {
|
||||
$topmenu2.find('a').click(function (e) {
|
||||
e.preventDefault();
|
||||
// if already active, ignore click
|
||||
if ($(this).hasClass("tabactive")) {
|
||||
if ($(this).hasClass('tabactive')) {
|
||||
return;
|
||||
}
|
||||
$topmenu2.find("a").removeClass("tabactive");
|
||||
$(this).addClass("tabactive");
|
||||
$topmenu2.find('a').removeClass('tabactive');
|
||||
$(this).addClass('tabactive');
|
||||
|
||||
// which section to show now?
|
||||
link_number = $topmenu2.find("a").index($(this));
|
||||
link_number = $topmenu2.find('a').index($(this));
|
||||
// hide all sections but the one to show
|
||||
$("#edit_user_dialog .submenu-item").hide().eq(link_number).show();
|
||||
$('#edit_user_dialog .submenu-item').hide().eq(link_number).show();
|
||||
});
|
||||
|
||||
// make first menu item active
|
||||
// TODO: support URL hash history
|
||||
$topmenu2.find("> :first-child a").addClass("tabactive");
|
||||
$topmenu2.find('> :first-child a').addClass('tabactive');
|
||||
$edit_user_dialog.prepend($topmenu2);
|
||||
|
||||
// hide all sections but the first
|
||||
$("#edit_user_dialog .submenu-item").hide().eq(0).show();
|
||||
$('#edit_user_dialog .submenu-item').hide().eq(0).show();
|
||||
|
||||
// scroll to the top
|
||||
$('html, body').animate({scrollTop: 0}, 'fast');
|
||||
$('html, body').animate({ scrollTop: 0 }, 'fast');
|
||||
};
|
||||
|
||||
$("input.autofocus").focus();
|
||||
$(checkboxes_sel).trigger("change");
|
||||
$('input.autofocus').focus();
|
||||
$(checkboxes_sel).trigger('change');
|
||||
displayPasswordGenerateButton();
|
||||
if ($("#edit_user_dialog").length > 0) {
|
||||
if ($('#edit_user_dialog').length > 0) {
|
||||
addOrUpdateSubmenu();
|
||||
}
|
||||
|
||||
var windowwidth = $(window).width();
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 35 ) + 'px');
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 35) + 'px');
|
||||
});
|
||||
|
||||
@ -16,13 +16,12 @@ AJAX.registerTeardown('server_status_advisor.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('server_status_advisor.js', function () {
|
||||
// if no advisor is loaded
|
||||
if ($('#advisorData').length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if no advisor is loaded
|
||||
if ($('#advisorData').length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**** Server config advisor ****/
|
||||
/** ** Server config advisor ****/
|
||||
var $dialog = $('<div />').attr('id', 'advisorDialog');
|
||||
var $instructionsDialog = $('<div />')
|
||||
.attr('id', 'instructionsDialog')
|
||||
@ -78,14 +77,14 @@ AJAX.registerOnload('server_status_advisor.js', function () {
|
||||
$tr.click(function () {
|
||||
var rule = $(this).data('rule');
|
||||
$dialog
|
||||
.dialog({title: PMA_messages.strRuleDetails})
|
||||
.html(
|
||||
'<p><b>' + PMA_messages.strIssuse + ':</b><br />' + rule.issue + '</p>' +
|
||||
.dialog({ title: PMA_messages.strRuleDetails })
|
||||
.html(
|
||||
'<p><b>' + PMA_messages.strIssuse + ':</b><br />' + rule.issue + '</p>' +
|
||||
'<p><b>' + PMA_messages.strRecommendation + ':</b><br />' + rule.recommendation + '</p>' +
|
||||
'<p><b>' + PMA_messages.strJustification + ':</b><br />' + rule.justification + '</p>' +
|
||||
'<p><b>' + PMA_messages.strFormula + ':</b><br />' + rule.formula + '</p>' +
|
||||
'<p><b>' + PMA_messages.strTest + ':</b><br />' + rule.test + '</p>'
|
||||
);
|
||||
);
|
||||
|
||||
var dlgBtns = {};
|
||||
dlgBtns[PMA_messages.strClose] = function () {
|
||||
|
||||
@ -7,10 +7,10 @@ var runtime = {},
|
||||
chartSize;
|
||||
AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
var $js_data_form = $('#js_data');
|
||||
server_time_diff = new Date().getTime() - $js_data_form.find("input[name=server_time]").val();
|
||||
server_os = $js_data_form.find("input[name=server_os]").val();
|
||||
is_superuser = $js_data_form.find("input[name=is_superuser]").val();
|
||||
server_db_isLocal = $js_data_form.find("input[name=server_db_isLocal]").val();
|
||||
server_time_diff = new Date().getTime() - $js_data_form.find('input[name=server_time]').val();
|
||||
server_os = $js_data_form.find('input[name=server_os]').val();
|
||||
is_superuser = $js_data_form.find('input[name=is_superuser]').val();
|
||||
server_db_isLocal = $js_data_form.find('input[name=server_db_isLocal]').val();
|
||||
});
|
||||
|
||||
/**
|
||||
@ -88,14 +88,14 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
// Codemirror is loaded on demand so we might need to initialize it
|
||||
if (! codemirror_editor) {
|
||||
var $elm = $('#sqlquery');
|
||||
if ($elm.length > 0 && typeof CodeMirror != 'undefined') {
|
||||
if ($elm.length > 0 && typeof CodeMirror !== 'undefined') {
|
||||
codemirror_editor = CodeMirror.fromTextArea(
|
||||
$elm[0],
|
||||
{
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
indentUnit: 4,
|
||||
mode: "text/x-mysql",
|
||||
mode: 'text/x-mysql',
|
||||
lineWrapping: true
|
||||
}
|
||||
);
|
||||
@ -107,7 +107,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
PMA_addDatepicker($(this));
|
||||
});
|
||||
|
||||
/**** Monitor charting implementation ****/
|
||||
/** ** Monitor charting implementation ****/
|
||||
/* Saves the previous ajax response for differential values */
|
||||
var oldChartData = null;
|
||||
// Holds about to be created chart
|
||||
@ -161,25 +161,25 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
// Query cache efficiency
|
||||
'qce': {
|
||||
title: PMA_messages.strQueryCacheEfficiency,
|
||||
series: [ {
|
||||
series: [{
|
||||
label: PMA_messages.strQueryCacheEfficiency
|
||||
} ],
|
||||
nodes: [ {
|
||||
dataPoints: [{type: 'statusvar', name: 'Qcache_hits'}, {type: 'statusvar', name: 'Com_select'}],
|
||||
}],
|
||||
nodes: [{
|
||||
dataPoints: [{ type: 'statusvar', name: 'Qcache_hits' }, { type: 'statusvar', name: 'Com_select' }],
|
||||
transformFn: 'qce'
|
||||
} ],
|
||||
}],
|
||||
maxYLabel: 0
|
||||
},
|
||||
// Query cache usage
|
||||
'qcu': {
|
||||
title: PMA_messages.strQueryCacheUsage,
|
||||
series: [ {
|
||||
series: [{
|
||||
label: PMA_messages.strQueryCacheUsed
|
||||
} ],
|
||||
nodes: [ {
|
||||
dataPoints: [{type: 'statusvar', name: 'Qcache_free_memory'}, {type: 'servervar', name: 'query_cache_size'}],
|
||||
}],
|
||||
nodes: [{
|
||||
dataPoints: [{ type: 'statusvar', name: 'Qcache_free_memory' }, { type: 'servervar', name: 'query_cache_size' }],
|
||||
transformFn: 'qcu'
|
||||
} ],
|
||||
}],
|
||||
maxYLabel: 0
|
||||
}
|
||||
};
|
||||
@ -198,42 +198,42 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
$.extend(presetCharts, {
|
||||
'cpu': {
|
||||
title: PMA_messages.strSystemCPUUsage,
|
||||
series: [ {
|
||||
series: [{
|
||||
label: PMA_messages.strAverageLoad
|
||||
} ],
|
||||
nodes: [ {
|
||||
dataPoints: [{ type: 'cpu', name: 'loadavg'}]
|
||||
} ],
|
||||
}],
|
||||
nodes: [{
|
||||
dataPoints: [{ type: 'cpu', name: 'loadavg' }]
|
||||
}],
|
||||
maxYLabel: 100
|
||||
},
|
||||
|
||||
'memory': {
|
||||
title: PMA_messages.strSystemMemory,
|
||||
series: [ {
|
||||
series: [{
|
||||
label: PMA_messages.strTotalMemory,
|
||||
fill: true
|
||||
}, {
|
||||
dataType: 'memory',
|
||||
label: PMA_messages.strUsedMemory,
|
||||
fill: true
|
||||
} ],
|
||||
}],
|
||||
nodes: [{ dataPoints: [{ type: 'memory', name: 'MemTotal' }], valueDivisor: 1024 },
|
||||
{ dataPoints: [{ type: 'memory', name: 'MemUsed' }], valueDivisor: 1024 }
|
||||
{ dataPoints: [{ type: 'memory', name: 'MemUsed' }], valueDivisor: 1024 }
|
||||
],
|
||||
maxYLabel: 0
|
||||
},
|
||||
|
||||
'swap': {
|
||||
title: PMA_messages.strSystemSwap,
|
||||
series: [ {
|
||||
series: [{
|
||||
label: PMA_messages.strTotalSwap,
|
||||
fill: true
|
||||
}, {
|
||||
label: PMA_messages.strUsedSwap,
|
||||
fill: true
|
||||
} ],
|
||||
nodes: [{ dataPoints: [{ type: 'memory', name: 'SwapTotal' }]},
|
||||
{ dataPoints: [{ type: 'memory', name: 'SwapUsed' }]}
|
||||
}],
|
||||
nodes: [{ dataPoints: [{ type: 'memory', name: 'SwapTotal' }] },
|
||||
{ dataPoints: [{ type: 'memory', name: 'SwapUsed' }] }
|
||||
],
|
||||
maxYLabel: 0
|
||||
}
|
||||
@ -244,19 +244,19 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
$.extend(presetCharts, {
|
||||
'cpu': {
|
||||
title: PMA_messages.strSystemCPUUsage,
|
||||
series: [ {
|
||||
series: [{
|
||||
label: PMA_messages.strAverageLoad
|
||||
} ],
|
||||
nodes: [{ dataPoints: [{ type: 'cpu', name: 'irrelevant' }], transformFn: 'cpu-linux'}],
|
||||
}],
|
||||
nodes: [{ dataPoints: [{ type: 'cpu', name: 'irrelevant' }], transformFn: 'cpu-linux' }],
|
||||
maxYLabel: 0
|
||||
},
|
||||
'memory': {
|
||||
title: PMA_messages.strSystemMemory,
|
||||
series: [
|
||||
{ label: PMA_messages.strBufferedMemory, fill: true},
|
||||
{ label: PMA_messages.strUsedMemory, fill: true},
|
||||
{ label: PMA_messages.strCachedMemory, fill: true},
|
||||
{ label: PMA_messages.strFreeMemory, fill: true}
|
||||
{ label: PMA_messages.strBufferedMemory, fill: true },
|
||||
{ label: PMA_messages.strUsedMemory, fill: true },
|
||||
{ label: PMA_messages.strCachedMemory, fill: true },
|
||||
{ label: PMA_messages.strFreeMemory, fill: true }
|
||||
],
|
||||
nodes: [
|
||||
{ dataPoints: [{ type: 'memory', name: 'Buffers' }], valueDivisor: 1024 },
|
||||
@ -269,9 +269,9 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
'swap': {
|
||||
title: PMA_messages.strSystemSwap,
|
||||
series: [
|
||||
{ label: PMA_messages.strCachedSwap, fill: true},
|
||||
{ label: PMA_messages.strUsedSwap, fill: true},
|
||||
{ label: PMA_messages.strFreeSwap, fill: true}
|
||||
{ label: PMA_messages.strCachedSwap, fill: true },
|
||||
{ label: PMA_messages.strUsedSwap, fill: true },
|
||||
{ label: PMA_messages.strFreeSwap, fill: true }
|
||||
],
|
||||
nodes: [
|
||||
{ dataPoints: [{ type: 'memory', name: 'SwapCached' }], valueDivisor: 1024 },
|
||||
@ -287,12 +287,12 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
$.extend(presetCharts, {
|
||||
'cpu': {
|
||||
title: PMA_messages.strSystemCPUUsage,
|
||||
series: [ {
|
||||
series: [{
|
||||
label: PMA_messages.strAverageLoad
|
||||
} ],
|
||||
nodes: [ {
|
||||
dataPoints: [{ type: 'cpu', name: 'loadavg'}]
|
||||
} ],
|
||||
}],
|
||||
nodes: [{
|
||||
dataPoints: [{ type: 'cpu', name: 'loadavg' }]
|
||||
}],
|
||||
maxYLabel: 0
|
||||
},
|
||||
'memory': {
|
||||
@ -328,34 +328,34 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
'c0': {
|
||||
title: PMA_messages.strQuestions,
|
||||
series: [
|
||||
{label: PMA_messages.strQuestions}
|
||||
{ label: PMA_messages.strQuestions }
|
||||
],
|
||||
nodes: [
|
||||
{dataPoints: [{ type: 'statusvar', name: 'Questions' }], display: 'differential' }
|
||||
{ dataPoints: [{ type: 'statusvar', name: 'Questions' }], display: 'differential' }
|
||||
],
|
||||
maxYLabel: 0
|
||||
},
|
||||
'c1': {
|
||||
title: PMA_messages.strChartConnectionsTitle,
|
||||
series: [
|
||||
{label: PMA_messages.strConnections},
|
||||
{label: PMA_messages.strProcesses}
|
||||
{ label: PMA_messages.strConnections },
|
||||
{ label: PMA_messages.strProcesses }
|
||||
],
|
||||
nodes: [
|
||||
{dataPoints: [{ type: 'statusvar', name: 'Connections' }], display: 'differential' },
|
||||
{dataPoints: [{ type: 'proc', name: 'processes' }] }
|
||||
{ dataPoints: [{ type: 'statusvar', name: 'Connections' }], display: 'differential' },
|
||||
{ dataPoints: [{ type: 'proc', name: 'processes' }] }
|
||||
],
|
||||
maxYLabel: 0
|
||||
},
|
||||
'c2': {
|
||||
title: PMA_messages.strTraffic,
|
||||
series: [
|
||||
{label: PMA_messages.strBytesSent},
|
||||
{label: PMA_messages.strBytesReceived}
|
||||
{ label: PMA_messages.strBytesSent },
|
||||
{ label: PMA_messages.strBytesReceived }
|
||||
],
|
||||
nodes: [
|
||||
{dataPoints: [{ type: 'statusvar', name: 'Bytes_sent' }], display: 'differential', valueDivisor: 1024 },
|
||||
{dataPoints: [{ type: 'statusvar', name: 'Bytes_received' }], display: 'differential', valueDivisor: 1024 }
|
||||
{ dataPoints: [{ type: 'statusvar', name: 'Bytes_sent' }], display: 'differential', valueDivisor: 1024 },
|
||||
{ dataPoints: [{ type: 'statusvar', name: 'Bytes_received' }], display: 'differential', valueDivisor: 1024 }
|
||||
],
|
||||
maxYLabel: 0
|
||||
}
|
||||
@ -381,7 +381,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
// Close the settings popup
|
||||
$('div.popupContent').hide().removeClass('openedPopup');
|
||||
|
||||
$("#chartGrid").sortableTable({
|
||||
$('#chartGrid').sortableTable({
|
||||
ignoreRect: {
|
||||
top: 8,
|
||||
left: chartSize.width - 63,
|
||||
@ -389,9 +389,8 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
height: 24
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
$("#chartGrid").sortableTable('destroy');
|
||||
$('#chartGrid').sortableTable('destroy');
|
||||
}
|
||||
saveMonitor(); // Save settings
|
||||
return false;
|
||||
@ -457,7 +456,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
runtime.xmax = new Date().getTime() - server_time_diff + monitorSettings.gridRefresh;
|
||||
|
||||
if (editMode) {
|
||||
$("#chartGrid").sortableTable('refresh');
|
||||
$('#chartGrid').sortableTable('refresh');
|
||||
}
|
||||
|
||||
refreshChartGrid();
|
||||
@ -474,7 +473,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
|
||||
runtime.xmin = new Date().getTime() - server_time_diff - runtime.gridMaxPoints * monitorSettings.gridRefresh;
|
||||
// fixing chart shift towards left on refresh rate change
|
||||
//runtime.xmax = new Date().getTime() - server_time_diff + monitorSettings.gridRefresh;
|
||||
// runtime.xmax = new Date().getTime() - server_time_diff + monitorSettings.gridRefresh;
|
||||
runtime.refreshTimeout = setTimeout(refreshChartGrid, monitorSettings.gridRefresh);
|
||||
|
||||
saveMonitor(); // Save settings
|
||||
@ -507,14 +506,14 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
|
||||
saveMonitor(); // Save settings
|
||||
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
dlgButtons[PMA_messages.strClose] = function () {
|
||||
newChart = null;
|
||||
$('span#clearSeriesLink').hide();
|
||||
$('#seriesPreview').html('');
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
var $presetList = $('#addChartDialog').find('select[name="presetCharts"]');
|
||||
@ -535,12 +534,12 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
});
|
||||
$('#chartStatusVar').click(function () {
|
||||
$('input[name="chartTitle"]').val(
|
||||
$('#chartSeries').find(':selected').text().replace(/_/g, " ")
|
||||
$('#chartSeries').find(':selected').text().replace(/_/g, ' ')
|
||||
);
|
||||
});
|
||||
$('#chartSeries').change(function () {
|
||||
$('input[name="chartTitle"]').val(
|
||||
$('#chartSeries').find(':selected').text().replace(/_/g, " ")
|
||||
$('#chartSeries').find(':selected').text().replace(/_/g, ' ')
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -570,7 +569,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
monitorSettings: monitorSettings
|
||||
};
|
||||
|
||||
var blob = new Blob([JSON.stringify(exportData)], {type: "application/octet-stream"});
|
||||
var blob = new Blob([JSON.stringify(exportData)], { type: 'application/octet-stream' });
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
window.location.href = url;
|
||||
window.URL.revokeObjectURL(url);
|
||||
@ -578,7 +577,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
|
||||
$('a[href="#importMonitorConfig"]').click(function (event) {
|
||||
event.preventDefault();
|
||||
$('#emptyDialog').dialog({title: PMA_messages.strImportDialogTitle});
|
||||
$('#emptyDialog').dialog({ title: PMA_messages.strImportDialogTitle });
|
||||
$('#emptyDialog').html(PMA_messages.strImportDialogMessage + ':<br/><form>' +
|
||||
'<input type="file" name="file" id="import_file"> </form>');
|
||||
|
||||
@ -588,11 +587,10 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
var input = $('#emptyDialog').find('#import_file')[0];
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onerror = function(event) {
|
||||
alert(PMA_messages.strFailedParsingConfig + "\n" + event.target.error.code);
|
||||
reader.onerror = function (event) {
|
||||
alert(PMA_messages.strFailedParsingConfig + '\n' + event.target.error.code);
|
||||
};
|
||||
reader.onload = function(e) {
|
||||
|
||||
reader.onload = function (e) {
|
||||
var data = e.target.result;
|
||||
|
||||
// Try loading config
|
||||
@ -779,7 +777,6 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
str += '- <a class="set" href="#long_query_time-' + varValue + '">';
|
||||
str += PMA_sprintf(PMA_messages.setSetLongQueryTime, varValue);
|
||||
str += ' </a><br />';
|
||||
|
||||
} else {
|
||||
str += PMA_messages.strNoSuperUser + '<br/>';
|
||||
}
|
||||
@ -794,7 +791,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
$dialog.find('img.ajaxIcon').hide();
|
||||
$dialog.find('a.set').click(function () {
|
||||
var nameValue = $(this).attr('href').split('-');
|
||||
loadLogVars({ varName: nameValue[0].substr(1), varValue: nameValue[1]});
|
||||
loadLogVars({ varName: nameValue[0].substr(1), varValue: nameValue[1] });
|
||||
$dialog.find('img.ajaxIcon').show();
|
||||
});
|
||||
}
|
||||
@ -817,7 +814,6 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
.data('lastRadio', $(this).attr('id'))
|
||||
.val($('label[for="' + $(this).attr('id') + '"]').text());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('input[name="useDivisor"]').change(function () {
|
||||
@ -861,7 +857,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
|
||||
$('a[href="#submitAddSeries"]').click(function (event) {
|
||||
event.preventDefault();
|
||||
if ($('#variableInput').val() === "") {
|
||||
if ($('#variableInput').val() === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -898,7 +894,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
str += serie.unit ? (', ' + PMA_messages.strUnit + ': ' + serie.unit) : '';
|
||||
|
||||
var newSeries = {
|
||||
label: $('#variableInput').val().replace(/_/g, " ")
|
||||
label: $('#variableInput').val().replace(/_/g, ' ')
|
||||
};
|
||||
newChart.series.push(newSeries);
|
||||
$('#seriesPreview').append('- ' + escapeHtml(newSeries.label + str) + '<br/>');
|
||||
@ -916,13 +912,12 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#variableInput").autocomplete({
|
||||
$('#variableInput').autocomplete({
|
||||
source: variableNames
|
||||
});
|
||||
|
||||
/* Initializes the monitor, called only once */
|
||||
function initGrid() {
|
||||
|
||||
function initGrid () {
|
||||
var i;
|
||||
|
||||
/* Apply default values & config */
|
||||
@ -940,11 +935,13 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
&& typeof window.localStorage.monitorVersion !== 'undefined'
|
||||
&& monitorProtocolVersion != window.localStorage.monitorVersion
|
||||
) {
|
||||
$('#emptyDialog').dialog({title: PMA_messages.strIncompatibleMonitorConfig});
|
||||
$('#emptyDialog').dialog({ title: PMA_messages.strIncompatibleMonitorConfig });
|
||||
$('#emptyDialog').html(PMA_messages.strIncompatibleMonitorConfigDescription);
|
||||
|
||||
var dlgBtns = {};
|
||||
dlgBtns[PMA_messages.strClose] = function () { $(this).dialog('close'); };
|
||||
dlgBtns[PMA_messages.strClose] = function () {
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
$('#emptyDialog').dialog({
|
||||
width: 400,
|
||||
@ -1009,7 +1006,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
|
||||
/* Calls destroyGrid() and initGrid(), but before doing so it saves the chart
|
||||
* data from each chart and restores it after the monitor is initialized again */
|
||||
function rebuildGrid() {
|
||||
function rebuildGrid () {
|
||||
var oldData = null;
|
||||
if (runtime.charts) {
|
||||
oldData = {};
|
||||
@ -1028,9 +1025,9 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Calculactes the dynamic chart size that depends on the column width */
|
||||
function calculateChartSize() {
|
||||
function calculateChartSize () {
|
||||
var panelWidth;
|
||||
if ($("body").height() > $(window).height()) { // has vertical scroll bar
|
||||
if ($('body').height() > $(window).height()) { // has vertical scroll bar
|
||||
panelWidth = $('#logTable').innerWidth();
|
||||
} else {
|
||||
panelWidth = $('#logTable').innerWidth() - 10; // leave some space for vertical scroll bar
|
||||
@ -1050,8 +1047,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Adds a chart to the chart grid */
|
||||
function addChart(chartObj, initialize) {
|
||||
|
||||
function addChart (chartObj, initialize) {
|
||||
var i;
|
||||
var settings = {
|
||||
title: escapeHtml(chartObj.title),
|
||||
@ -1095,7 +1091,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
settings.title === PMA_messages.strQueryCacheEfficiency
|
||||
) {
|
||||
settings.axes.yaxis.tickOptions = {
|
||||
formatString: "%d %%"
|
||||
formatString: '%d %%'
|
||||
};
|
||||
} else if (settings.title === PMA_messages.strSystemMemory ||
|
||||
settings.title === PMA_messages.strSystemSwap
|
||||
@ -1114,11 +1110,11 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
settings.axes.yaxis.tickOptions = {
|
||||
formatter: function (format, val) {
|
||||
if (Math.abs(val) >= 1000000) {
|
||||
return $.jqplot.sprintf("%.3g M", val / 1000000);
|
||||
return $.jqplot.sprintf('%.3g M', val / 1000000);
|
||||
} else if (Math.abs(val) >= 1000) {
|
||||
return $.jqplot.sprintf("%.3g k", val / 1000);
|
||||
return $.jqplot.sprintf('%.3g k', val / 1000);
|
||||
} else {
|
||||
return $.jqplot.sprintf("%d", val);
|
||||
return $.jqplot.sprintf('%d', val);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1158,7 +1154,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
var tooltipHtml = '<div style="font-size:12px;background-color:#FFFFFF;' +
|
||||
'opacity:0.95;filter:alpha(opacity=95);padding:5px;">';
|
||||
// x value i.e. time
|
||||
var timeValue = str.split(",")[0];
|
||||
var timeValue = str.split(',')[0];
|
||||
var seriesValue;
|
||||
tooltipHtml += 'Time: ' + timeValue;
|
||||
tooltipHtml += '<span style="font-weight:bold;">';
|
||||
@ -1240,7 +1236,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
selectionStartX = ev.pageX;
|
||||
selectionStartY = ev.pageY;
|
||||
selectionBox
|
||||
.attr({id: 'selection_box'})
|
||||
.attr({ id: 'selection_box' })
|
||||
.css({
|
||||
top: selectionStartY - gridpos.y,
|
||||
left: selectionStartX
|
||||
@ -1259,7 +1255,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
selectionTimeDiff = [];
|
||||
return;
|
||||
}
|
||||
//get date from timestamp
|
||||
// get date from timestamp
|
||||
var min = new Date(Math.ceil(selectionTimeDiff[0]));
|
||||
var max = new Date(Math.ceil(selectionTimeDiff[1]));
|
||||
PMA_getLogAnalyseDialog(min, max);
|
||||
@ -1296,23 +1292,23 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
runtime.chartAI++;
|
||||
}
|
||||
|
||||
function PMA_getLogAnalyseDialog(min, max) {
|
||||
function PMA_getLogAnalyseDialog (min, max) {
|
||||
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);
|
||||
$dateStart.prop('readonly', true);
|
||||
$dateEnd.prop('readonly', true);
|
||||
|
||||
var dlgBtns = { };
|
||||
|
||||
dlgBtns[PMA_messages.strFromSlowLog] = function () {
|
||||
loadLog('slow', min, max);
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
dlgBtns[PMA_messages.strFromGeneralLog] = function () {
|
||||
loadLog('general', min, max);
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
$logAnalyseDialog.dialog({
|
||||
@ -1335,7 +1331,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
$dateEnd.datepicker('setDate', max);
|
||||
}
|
||||
|
||||
function loadLog(type, min, max) {
|
||||
function loadLog (type, min, 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;
|
||||
|
||||
@ -1349,7 +1345,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Called in regular intervals, this function updates the values of each chart in the grid */
|
||||
function refreshChartGrid() {
|
||||
function refreshChartGrid () {
|
||||
/* Send to server */
|
||||
runtime.refreshRequest = $.post('server_status_monitor.php' + PMA_commonParams.get('common_query'), {
|
||||
ajax_request: true,
|
||||
@ -1390,7 +1386,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
runtime.xmax += diff;
|
||||
}
|
||||
|
||||
//elem.chart.xAxis[0].setExtremes(runtime.xmin, runtime.xmax, false);
|
||||
// elem.chart.xAxis[0].setExtremes(runtime.xmin, runtime.xmax, false);
|
||||
/* Calculate y value */
|
||||
|
||||
// If transform function given, use it
|
||||
@ -1490,7 +1486,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
/* Function to get highest plotted point's y label, to scale the chart,
|
||||
* TODO: make jqplot's autoscale:true work here
|
||||
*/
|
||||
function getMaxYLabel(dataValues) {
|
||||
function getMaxYLabel (dataValues) {
|
||||
var maxY = dataValues[0][1];
|
||||
$.each(dataValues, function (k, v) {
|
||||
maxY = (v[1] > maxY) ? v[1] : maxY;
|
||||
@ -1499,7 +1495,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Function that supplies special value transform functions for chart values */
|
||||
function chartValueTransform(name, cur, prev) {
|
||||
function chartValueTransform (name, cur, prev) {
|
||||
switch (name) {
|
||||
case 'cpu-linux':
|
||||
if (prev === null) {
|
||||
@ -1535,7 +1531,6 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
// cur[0].value is Qcache_free_memory, cur[1].value is query_cache_size
|
||||
return 100 - cur[0].value / cur[1].value * 100;
|
||||
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@ -1543,7 +1538,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
/* Build list of nodes that need to be retrieved from server.
|
||||
* It creates something like a stripped down version of the runtime.charts object.
|
||||
*/
|
||||
function buildRequiredDataList() {
|
||||
function buildRequiredDataList () {
|
||||
runtime.dataList = {};
|
||||
// Store an own id, because the property name is subject of reordering,
|
||||
// thus destroying our mapping with runtime.charts <=> runtime.dataList
|
||||
@ -1559,7 +1554,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Loads the log table data, generates the table and handles the filters */
|
||||
function loadLogStatistics(opts) {
|
||||
function loadLogStatistics (opts) {
|
||||
var tableStr = '';
|
||||
var logRequest = null;
|
||||
|
||||
@ -1570,7 +1565,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
opts.limitTypes = false;
|
||||
}
|
||||
|
||||
$('#emptyDialog').dialog({title: PMA_messages.strAnalysingLogsTitle});
|
||||
$('#emptyDialog').dialog({ title: PMA_messages.strAnalysingLogsTitle });
|
||||
$('#emptyDialog').html(PMA_messages.strAnalysingLogs +
|
||||
' <img class="ajaxIcon" src="' + pmaThemeImage +
|
||||
'ajax_clock_small.gif" alt="">');
|
||||
@ -1581,7 +1576,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
logRequest.abort();
|
||||
}
|
||||
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
$('#emptyDialog').dialog({
|
||||
@ -1610,21 +1605,21 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
if (logData.rows.length === 0) {
|
||||
$('#emptyDialog').dialog({title: PMA_messages.strNoDataFoundTitle});
|
||||
$('#emptyDialog').dialog({ title: PMA_messages.strNoDataFoundTitle });
|
||||
$('#emptyDialog').html('<p>' + PMA_messages.strNoDataFound + '</p>');
|
||||
|
||||
dlgBtns[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
$('#emptyDialog').dialog("option", "buttons", dlgBtns);
|
||||
$('#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').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();
|
||||
@ -1660,15 +1655,14 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
} else {
|
||||
$('#filterQueryText').keyup(filterQueries);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dlgBtns[PMA_messages.strJumpToTable] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
$(document).scrollTop($('#logTable').offset().top);
|
||||
};
|
||||
|
||||
$('#emptyDialog').dialog("option", "buttons", dlgBtns);
|
||||
$('#emptyDialog').dialog('option', 'buttons', dlgBtns);
|
||||
}
|
||||
);
|
||||
|
||||
@ -1679,7 +1673,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
* @param boolean Should be true when the users enabled or disabled
|
||||
* to group queries ignoring data in WHERE clauses
|
||||
*/
|
||||
function filterQueries(varFilterChange) {
|
||||
function filterQueries (varFilterChange) {
|
||||
var cell, textFilter;
|
||||
var val = $('#filterQueryText').val();
|
||||
|
||||
@ -1689,7 +1683,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
try {
|
||||
textFilter = new RegExp(val, 'i');
|
||||
$('#filterQueryText').removeClass('error');
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
$('#filterQueryText').addClass('error');
|
||||
textFilter = null;
|
||||
@ -1750,7 +1744,6 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
if (isSlowLog) {
|
||||
countRow(q, $t.parent().html());
|
||||
}
|
||||
|
||||
} else {
|
||||
// Group off: Restore original columns
|
||||
|
||||
@ -1810,7 +1803,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
});
|
||||
}
|
||||
|
||||
$('#logTable').find('table').trigger("update");
|
||||
$('#logTable').find('table').trigger('update');
|
||||
setTimeout(function () {
|
||||
$('#logTable').find('table').trigger('sorton', [[[runtime.logDataCols.length - 1, 1]]]);
|
||||
}, 0);
|
||||
@ -1825,13 +1818,13 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Turns a timespan (12:12:12) into a number */
|
||||
function timeToSec(timeStr) {
|
||||
function timeToSec (timeStr) {
|
||||
var time = timeStr.split(':');
|
||||
return (parseInt(time[0], 10) * 3600) + (parseInt(time[1], 10) * 60) + parseInt(time[2], 10);
|
||||
}
|
||||
|
||||
/* Turns a number into a timespan (100 into 00:01:40) */
|
||||
function secToTime(timeInt) {
|
||||
function secToTime (timeInt) {
|
||||
var hours = Math.floor(timeInt / 3600);
|
||||
timeInt -= hours * 3600;
|
||||
var minutes = Math.floor(timeInt / 60);
|
||||
@ -1851,7 +1844,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Constructs the log table out of the retrieved server data */
|
||||
function buildLogTable(data, groupInserts) {
|
||||
function buildLogTable (data, groupInserts) {
|
||||
var rows = data.rows;
|
||||
var cols = [];
|
||||
var $table = $('<table class="sortable"></table>');
|
||||
@ -1902,8 +1895,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').find('tr:first th:last').text().indexOf("#") > -1) {
|
||||
$('#logTable').find('tr:first th:last').append(' ' + PMA_getImage('b_help.png', '', {'class': 'qroupedQueryInfoIcon'}));
|
||||
if ($('#logTable').find('tr:first th:last').text().indexOf('#') > -1) {
|
||||
$('#logTable').find('tr:first th:last').append(' ' + PMA_getImage('b_help.png', '', { 'class': 'qroupedQueryInfoIcon' }));
|
||||
|
||||
var tooltipContent = PMA_messages.strCountColumnExplanation;
|
||||
if (groupInserts) {
|
||||
@ -1929,21 +1922,20 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Opens the query analyzer dialog */
|
||||
function openQueryAnalyzer() {
|
||||
function openQueryAnalyzer () {
|
||||
var rowData = $(this).parent().data('query');
|
||||
var query = rowData.argument || rowData.sql_text;
|
||||
|
||||
if (codemirror_editor) {
|
||||
//TODO: somehow PMA_SQLPrettyPrint messes up the query, needs be fixed
|
||||
//query = PMA_SQLPrettyPrint(query);
|
||||
// TODO: somehow PMA_SQLPrettyPrint messes up the query, needs be fixed
|
||||
// query = PMA_SQLPrettyPrint(query);
|
||||
codemirror_editor.setValue(query);
|
||||
// Codemirror is bugged, it doesn't refresh properly sometimes.
|
||||
// Following lines seem to fix that
|
||||
setTimeout(function () {
|
||||
codemirror_editor.refresh();
|
||||
}, 50);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('#sqlquery').val(query);
|
||||
}
|
||||
|
||||
@ -1977,7 +1969,7 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Loads and displays the analyzed query data */
|
||||
function loadQueryAnalysis(rowData) {
|
||||
function loadQueryAnalysis (rowData) {
|
||||
var db = rowData.db || '';
|
||||
|
||||
$('#queryAnalyzerDialog').find('div.placeHolder').html(
|
||||
@ -2102,13 +2094,13 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
chartData
|
||||
);
|
||||
|
||||
//$('#queryProfiling').resizable();
|
||||
// $('#queryProfiling').resizable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Saves the monitor to localstorage */
|
||||
function saveMonitor() {
|
||||
function saveMonitor () {
|
||||
var gridCopy = {};
|
||||
|
||||
$.each(runtime.charts, function (key, elem) {
|
||||
@ -2135,12 +2127,12 @@ AJAX.registerOnload('server_status_monitor.js', function () {
|
||||
$('a[href="#pauseCharts"]').trigger('click');
|
||||
});
|
||||
|
||||
function serverResponseError() {
|
||||
function serverResponseError () {
|
||||
var btns = {};
|
||||
btns[PMA_messages.strReloadPage] = function () {
|
||||
window.location.reload();
|
||||
};
|
||||
$('#emptyDialog').dialog({title: PMA_messages.strRefreshFailed});
|
||||
$('#emptyDialog').dialog({ title: PMA_messages.strRefreshFailed });
|
||||
$('#emptyDialog').html(
|
||||
PMA_getImage('s_attention.png') +
|
||||
PMA_messages.strInvalidResponseExplanation
|
||||
@ -2149,7 +2141,7 @@ function serverResponseError() {
|
||||
}
|
||||
|
||||
/* Destroys all monitor related resources */
|
||||
function destroyGrid() {
|
||||
function destroyGrid () {
|
||||
if (runtime.charts) {
|
||||
$.each(runtime.charts, function (key, value) {
|
||||
try {
|
||||
@ -2167,5 +2159,5 @@ function destroyGrid() {
|
||||
$('#chartGrid').html('');
|
||||
runtime.charts = null;
|
||||
runtime.chartAI = 0;
|
||||
monitorSettings = null; //TODO:this not global variable
|
||||
monitorSettings = null; // TODO:this not global variable
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ var processList = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
init: function() {
|
||||
init: function () {
|
||||
processList.setRefreshLabel();
|
||||
if (processList.refreshUrl === null) {
|
||||
processList.refreshUrl = 'server_status_processes.php' +
|
||||
@ -45,12 +45,12 @@ var processList = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
killProcessHandler: function(event) {
|
||||
killProcessHandler: function (event) {
|
||||
event.preventDefault();
|
||||
var url = $(this).attr('href');
|
||||
// Get row element of the process to be killed.
|
||||
var $tr = $(this).closest('tr');
|
||||
$.getJSON(url, function(data) {
|
||||
$.getJSON(url, function (data) {
|
||||
// Check if process was killed or not.
|
||||
if (data.hasOwnProperty('success') && data.success) {
|
||||
// remove the row of killed process.
|
||||
@ -76,7 +76,7 @@ var processList = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
refresh: function(event) {
|
||||
refresh: function (event) {
|
||||
// abort any previous pending requests
|
||||
// this is necessary, it may go into
|
||||
// multiple loops causing unnecessary
|
||||
@ -88,7 +88,7 @@ var processList = {
|
||||
var urlParams = processList.getUrlParams();
|
||||
processList.refreshRequest = $.get(processList.refreshUrl,
|
||||
urlParams,
|
||||
function(data) {
|
||||
function (data) {
|
||||
if (data.hasOwnProperty('success') && data.success) {
|
||||
$newTable = $(data.message);
|
||||
$('#tableprocesslist').html($newTable.html());
|
||||
@ -107,7 +107,7 @@ var processList = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abortRefresh: function() {
|
||||
abortRefresh: function () {
|
||||
if (processList.refreshRequest !== null) {
|
||||
processList.refreshRequest.abort();
|
||||
processList.refreshRequest = null;
|
||||
@ -121,7 +121,7 @@ var processList = {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
setRefreshLabel: function() {
|
||||
setRefreshLabel: function () {
|
||||
var img = 'play.png';
|
||||
var label = PMA_messages.strStartRefresh;
|
||||
if (processList.autoRefresh) {
|
||||
@ -139,9 +139,9 @@ var processList = {
|
||||
*
|
||||
* @return urlParams - url parameters with autoRefresh request
|
||||
*/
|
||||
getUrlParams: function() {
|
||||
getUrlParams: function () {
|
||||
var urlParams = { 'ajax_request': true, 'refresh': true };
|
||||
if ($('#showExecuting').is(":checked")) {
|
||||
if ($('#showExecuting').is(':checked')) {
|
||||
urlParams.showExecuting = true;
|
||||
return urlParams;
|
||||
}
|
||||
@ -149,8 +149,7 @@ var processList = {
|
||||
}
|
||||
};
|
||||
|
||||
AJAX.registerOnload('server_status_processes.js', function() {
|
||||
|
||||
AJAX.registerOnload('server_status_processes.js', function () {
|
||||
processList.init();
|
||||
// Bind event handler for kill_process
|
||||
$('#tableprocesslist').on(
|
||||
@ -159,18 +158,18 @@ AJAX.registerOnload('server_status_processes.js', function() {
|
||||
processList.killProcessHandler
|
||||
);
|
||||
// Bind event handler for toggling refresh of process list
|
||||
$('a#toggleRefresh').on('click', function(event) {
|
||||
$('a#toggleRefresh').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
processList.autoRefresh = !processList.autoRefresh;
|
||||
processList.setRefreshLabel();
|
||||
});
|
||||
// Bind event handler for change in refresh rate
|
||||
$('#id_refreshRate').on('change', function(event) {
|
||||
$('#id_refreshRate').on('change', function (event) {
|
||||
processList.refreshInterval = $(this).val();
|
||||
processList.refresh();
|
||||
});
|
||||
// Bind event handler for table header links
|
||||
$('#tableprocesslist').on('click', 'thead a', function() {
|
||||
$('#tableprocesslist').on('click', 'thead a', function () {
|
||||
processList.refreshUrl = $(this).attr('href');
|
||||
});
|
||||
});
|
||||
@ -178,7 +177,7 @@ AJAX.registerOnload('server_status_processes.js', function() {
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_status_processes.js', function() {
|
||||
AJAX.registerTeardown('server_status_processes.js', function () {
|
||||
$('#tableprocesslist').off('click', 'a.kill_process');
|
||||
$('a#toggleRefresh').off('click');
|
||||
$('#id_refreshRate').off('change');
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// TODO: tablesorter shouldn't sort already sorted columns
|
||||
function initTableSorter(tabid) {
|
||||
function initTableSorter (tabid) {
|
||||
var $table, opts;
|
||||
switch (tabid) {
|
||||
case 'statustabs_queries':
|
||||
@ -20,14 +20,14 @@ function initTableSorter(tabid) {
|
||||
|
||||
$(function () {
|
||||
$.tablesorter.addParser({
|
||||
id: "fancyNumber",
|
||||
id: 'fancyNumber',
|
||||
is: function (s) {
|
||||
return (/^[0-9]?[0-9,\.]*\s?(k|M|G|T|%)?$/).test(s);
|
||||
},
|
||||
format: function (s) {
|
||||
var num = jQuery.tablesorter.formatFloat(
|
||||
s.replace(PMA_messages.strThousandsSeparator, '')
|
||||
.replace(PMA_messages.strDecimalSeparator, '.')
|
||||
.replace(PMA_messages.strDecimalSeparator, '.')
|
||||
);
|
||||
|
||||
var factor = 1;
|
||||
@ -52,11 +52,11 @@ $(function () {
|
||||
|
||||
return num * Math.pow(10, factor);
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "withinSpanNumber",
|
||||
id: 'withinSpanNumber',
|
||||
is: function (s) {
|
||||
return (/<span class="original"/).test(s);
|
||||
},
|
||||
@ -64,6 +64,6 @@ $(function () {
|
||||
var res = html.innerHTML.match(/<span(\s*style="display:none;"\s*)?\s*class="original">(.*)?<\/span>/);
|
||||
return (res && res.length >= 3) ? res[2] : 0;
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
});
|
||||
|
||||
@ -16,7 +16,6 @@ AJAX.registerTeardown('server_status_variables.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('server_status_variables.js', function () {
|
||||
|
||||
// Filters for status variables
|
||||
var textFilter = null;
|
||||
var alertFilter = $('#filterAlert').prop('checked');
|
||||
@ -48,9 +47,9 @@ AJAX.registerOnload('server_status_variables.js', function () {
|
||||
textFilter = null;
|
||||
} else {
|
||||
try {
|
||||
textFilter = new RegExp("(^| )" + word, 'i');
|
||||
textFilter = new RegExp('(^| )' + word, 'i');
|
||||
$(this).removeClass('error');
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
$(this).addClass('error');
|
||||
textFilter = null;
|
||||
@ -62,7 +61,7 @@ AJAX.registerOnload('server_status_variables.js', function () {
|
||||
}).trigger('keyup');
|
||||
|
||||
/* Filters the status variables by name/category/alert in the variables tab */
|
||||
function filterVariables() {
|
||||
function filterVariables () {
|
||||
var useful_links = 0;
|
||||
var section = text;
|
||||
|
||||
|
||||
@ -2,28 +2,27 @@
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('server_user_groups.js', function () {
|
||||
$(document).off('click', "a.deleteUserGroup.ajax");
|
||||
$(document).off('click', 'a.deleteUserGroup.ajax');
|
||||
});
|
||||
|
||||
/**
|
||||
* Bind event handlers
|
||||
*/
|
||||
AJAX.registerOnload('server_user_groups.js', function () {
|
||||
|
||||
// update the checkall checkbox on Edit user group page
|
||||
$(checkboxes_sel).trigger("change");
|
||||
$(checkboxes_sel).trigger('change');
|
||||
|
||||
$(document).on('click', "a.deleteUserGroup.ajax", function (event) {
|
||||
$(document).on('click', 'a.deleteUserGroup.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $link = $(this);
|
||||
var groupName = $link.parents('tr').find('td:first').text();
|
||||
var buttonOptions = {};
|
||||
buttonOptions[PMA_messages.strGo] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
$link.removeClass('ajax').trigger('click');
|
||||
};
|
||||
buttonOptions[PMA_messages.strClose] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
$('<div/>')
|
||||
.attr('id', 'confirmUserGroupDeleteDialog')
|
||||
|
||||
@ -31,9 +31,9 @@ AJAX.registerOnload('server_variables.js', function () {
|
||||
var textFilter = null, val = $(this).val();
|
||||
if (val.length !== 0) {
|
||||
try {
|
||||
textFilter = new RegExp("(^| )" + val.replace(/_/g, ' '), 'i');
|
||||
textFilter = new RegExp('(^| )' + val.replace(/_/g, ' '), 'i');
|
||||
$(this).removeClass('error');
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
$(this).addClass('error');
|
||||
textFilter = null;
|
||||
@ -49,7 +49,7 @@ AJAX.registerOnload('server_variables.js', function () {
|
||||
}
|
||||
|
||||
/* Filters the rows by the user given regexp */
|
||||
function filterVariables(textFilter) {
|
||||
function filterVariables (textFilter) {
|
||||
var mark_next = false, $row;
|
||||
$('#serverVariables').find('.var-row').not('.var-header').each(function () {
|
||||
$row = $(this);
|
||||
@ -67,7 +67,7 @@ AJAX.registerOnload('server_variables.js', function () {
|
||||
}
|
||||
|
||||
/* Allows the user to edit a server variable */
|
||||
function editVariable(link) {
|
||||
function editVariable (link) {
|
||||
var $link = $(link);
|
||||
var $cell = $link.parent();
|
||||
var $valueCell = $link.parents('.var-row').find('.var-value');
|
||||
@ -83,26 +83,26 @@ AJAX.registerOnload('server_variables.js', function () {
|
||||
$mySaveLink.click(function () {
|
||||
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
$.post($(this).attr('href'), {
|
||||
ajax_request: true,
|
||||
type: 'setval',
|
||||
varName: varName,
|
||||
varValue: $valueCell.find('input').val()
|
||||
}, function (data) {
|
||||
if (data.success) {
|
||||
$valueCell
|
||||
.html(data.variable)
|
||||
.data('content', data.variable);
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
ajax_request: true,
|
||||
type: 'setval',
|
||||
varName: varName,
|
||||
varValue: $valueCell.find('input').val()
|
||||
}, function (data) {
|
||||
if (data.success) {
|
||||
$valueCell
|
||||
.html(data.variable)
|
||||
.data('content', data.variable);
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
} else {
|
||||
if (data.error == '') {
|
||||
PMA_ajaxShowMessage(PMA_messages.strRequestFailed, false);
|
||||
} else {
|
||||
if (data.error == '') {
|
||||
PMA_ajaxShowMessage(PMA_messages.strRequestFailed, false);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
$valueCell.html($valueCell.data('content'));
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
$cell.removeClass('edit').html($myEditLink);
|
||||
});
|
||||
$valueCell.html($valueCell.data('content'));
|
||||
}
|
||||
$cell.removeClass('edit').html($myEditLink);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
@ -113,25 +113,25 @@ AJAX.registerOnload('server_variables.js', function () {
|
||||
});
|
||||
|
||||
$.get($mySaveLink.attr('href'), {
|
||||
ajax_request: true,
|
||||
type: 'getval',
|
||||
varName: varName
|
||||
}, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
var $links = $('<div />')
|
||||
.append($myCancelLink)
|
||||
.append(' ')
|
||||
.append($mySaveLink);
|
||||
var $editor = $('<div />', {'class': 'serverVariableEditor'})
|
||||
.append(
|
||||
$('<div/>').append(
|
||||
$('<input />', {type: 'text'}).val(data.message)
|
||||
)
|
||||
);
|
||||
ajax_request: true,
|
||||
type: 'getval',
|
||||
varName: varName
|
||||
}, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
var $links = $('<div />')
|
||||
.append($myCancelLink)
|
||||
.append(' ')
|
||||
.append($mySaveLink);
|
||||
var $editor = $('<div />', { 'class': 'serverVariableEditor' })
|
||||
.append(
|
||||
$('<div/>').append(
|
||||
$('<input />', { type: 'text' }).val(data.message)
|
||||
)
|
||||
);
|
||||
// Save and replace content
|
||||
$cell
|
||||
$cell
|
||||
.html($links);
|
||||
$valueCell
|
||||
$valueCell
|
||||
.data('content', $valueCell.html())
|
||||
.html($editor)
|
||||
.find('input')
|
||||
@ -143,11 +143,11 @@ AJAX.registerOnload('server_variables.js', function () {
|
||||
$myCancelLink.trigger('click');
|
||||
}
|
||||
});
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
} else {
|
||||
$cell.removeClass('edit').html($myEditLink);
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
} else {
|
||||
$cell.removeClass('edit').html($myEditLink);
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
/**
|
||||
* Register key events on load
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
var databaseOp = false;
|
||||
var tableOp = false;
|
||||
var keyD = 68;
|
||||
@ -22,90 +22,79 @@ $(document).ready(function() {
|
||||
var keyH = 72;
|
||||
var keyC = 67;
|
||||
var keyBackSpace = 8;
|
||||
$(document).keyup(function(e) {
|
||||
if( e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'SELECT' ) {
|
||||
$(document).keyup(function (e) {
|
||||
if (e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'SELECT') {
|
||||
return;
|
||||
}
|
||||
|
||||
if(e.keyCode === keyD) {
|
||||
setTimeout(function() {
|
||||
if (e.keyCode === keyD) {
|
||||
setTimeout(function () {
|
||||
databaseOp = false;
|
||||
}, 2000);
|
||||
}
|
||||
else if(e.keyCode === keyT) {
|
||||
setTimeout(function() {
|
||||
} else if (e.keyCode === keyT) {
|
||||
setTimeout(function () {
|
||||
tableOp = false;
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
$(document).keydown(function(e) {
|
||||
if ( e.ctrlKey && e.altKey && e.keyCode === keyC ) {
|
||||
$(document).keydown(function (e) {
|
||||
if (e.ctrlKey && e.altKey && e.keyCode === keyC) {
|
||||
PMA_console.toggle();
|
||||
}
|
||||
|
||||
if( e.ctrlKey && e.keyCode == keyK ) {
|
||||
if (e.ctrlKey && e.keyCode == keyK) {
|
||||
e.preventDefault();
|
||||
PMA_console.toggle();
|
||||
}
|
||||
|
||||
if( e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'SELECT' ) {
|
||||
if (e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'SELECT') {
|
||||
return;
|
||||
}
|
||||
|
||||
var isTable;
|
||||
var isDb;
|
||||
if(e.keyCode === keyD) {
|
||||
if (e.keyCode === keyD) {
|
||||
databaseOp = true;
|
||||
}
|
||||
else if(e.keyCode === keyK) {
|
||||
} else if (e.keyCode === keyK) {
|
||||
e.preventDefault();
|
||||
PMA_console.toggle();
|
||||
}
|
||||
else if(e.keyCode === keyS) {
|
||||
if(databaseOp === true) {
|
||||
} else if (e.keyCode === keyS) {
|
||||
if (databaseOp === true) {
|
||||
isTable = PMA_commonParams.get('table');
|
||||
isDb = PMA_commonParams.get('db');
|
||||
if(isDb && ! isTable) {
|
||||
if (isDb && ! isTable) {
|
||||
$('.tab .ic_b_props').first().trigger('click');
|
||||
}
|
||||
}
|
||||
else if(tableOp === true) {
|
||||
} else if (tableOp === true) {
|
||||
isTable = PMA_commonParams.get('table');
|
||||
isDb = PMA_commonParams.get('db');
|
||||
if(isDb && isTable) {
|
||||
if (isDb && isTable) {
|
||||
$('.tab .ic_b_props').first().trigger('click');
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$('#pma_navigation_settings_icon').trigger('click');
|
||||
}
|
||||
}
|
||||
else if(e.keyCode === keyF) {
|
||||
if(databaseOp === true) {
|
||||
} else if (e.keyCode === keyF) {
|
||||
if (databaseOp === true) {
|
||||
isTable = PMA_commonParams.get('table');
|
||||
isDb = PMA_commonParams.get('db');
|
||||
if(isDb && ! isTable) {
|
||||
if (isDb && ! isTable) {
|
||||
$('.tab .ic_b_search').first().trigger('click');
|
||||
}
|
||||
} else if (tableOp === true) {
|
||||
isTable = PMA_commonParams.get('table');
|
||||
isDb = PMA_commonParams.get('db');
|
||||
if (isDb && isTable) {
|
||||
$('.tab .ic_b_search').first().trigger('click');
|
||||
}
|
||||
}
|
||||
else if(tableOp === true) {
|
||||
isTable = PMA_commonParams.get('table');
|
||||
isDb = PMA_commonParams.get('db');
|
||||
if(isDb && isTable) {
|
||||
$('.tab .ic_b_search').first().trigger('click');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(e.keyCode === keyT) {
|
||||
} else if (e.keyCode === keyT) {
|
||||
tableOp = true;
|
||||
}
|
||||
else if(e.keyCode === keyE) {
|
||||
} else if (e.keyCode === keyE) {
|
||||
$('.ic_b_export').first().trigger('click');
|
||||
}
|
||||
else if(e.keyCode === keyBackSpace) {
|
||||
} else if (e.keyCode === keyBackSpace) {
|
||||
window.history.back();
|
||||
}
|
||||
else if(e.keyCode === keyH) {
|
||||
} else if (e.keyCode === keyH) {
|
||||
$('.ic_b_home').first().trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
231
js/sql.js
231
js/sql.js
@ -16,8 +16,7 @@ var prevScrollX = 0;
|
||||
* @param string str
|
||||
* @return string the URL-decoded string
|
||||
*/
|
||||
function PMA_urldecode(str)
|
||||
{
|
||||
function PMA_urldecode (str) {
|
||||
if (typeof str !== 'undefined') {
|
||||
return decodeURIComponent(str.replace(/\+/g, '%20'));
|
||||
}
|
||||
@ -29,8 +28,7 @@ function PMA_urldecode(str)
|
||||
* @param string str
|
||||
* @return string the URL-encoded string
|
||||
*/
|
||||
function PMA_urlencode(str)
|
||||
{
|
||||
function PMA_urlencode (str) {
|
||||
if (typeof str !== 'undefined') {
|
||||
return encodeURIComponent(str).replace(/\%20/g, '+');
|
||||
}
|
||||
@ -42,8 +40,7 @@ function PMA_urlencode(str)
|
||||
* @param string SQL query
|
||||
* @return void
|
||||
*/
|
||||
function PMA_autosaveSQL(query)
|
||||
{
|
||||
function PMA_autosaveSQL (query) {
|
||||
if (query) {
|
||||
if (isStorageSupported('localStorage')) {
|
||||
window.localStorage.auto_saved_sql = query;
|
||||
@ -59,8 +56,7 @@ function PMA_autosaveSQL(query)
|
||||
* @param string SQL query
|
||||
* @return void
|
||||
*/
|
||||
function PMA_autosaveSQLSort(query)
|
||||
{
|
||||
function PMA_autosaveSQLSort (query) {
|
||||
if (query) {
|
||||
if (isStorageSupported('localStorage')) {
|
||||
window.localStorage.auto_saved_sql_sort = query;
|
||||
@ -77,9 +73,7 @@ function PMA_autosaveSQLSort(query)
|
||||
* @param $table_results enclosing results table
|
||||
* @param $this_field jQuery object that points to the current field's tr
|
||||
*/
|
||||
function getFieldName($table_results, $this_field)
|
||||
{
|
||||
|
||||
function getFieldName ($table_results, $this_field) {
|
||||
var this_field_index = $this_field.index();
|
||||
// ltr or rtl direction does not impact how the DOM was generated
|
||||
// check if the action column in the left exist
|
||||
@ -121,21 +115,21 @@ AJAX.registerTeardown('sql.js', function () {
|
||||
$(document).off('click', 'a.delete_row.ajax');
|
||||
$(document).off('submit', '.bookmarkQueryForm');
|
||||
$('input#bkm_label').off('keyup');
|
||||
$(document).off('makegrid', ".sqlqueryresults");
|
||||
$(document).off('stickycolumns', ".sqlqueryresults");
|
||||
$("#togglequerybox").off('click');
|
||||
$(document).off('click', "#button_submit_query");
|
||||
$(document).off('makegrid', '.sqlqueryresults');
|
||||
$(document).off('stickycolumns', '.sqlqueryresults');
|
||||
$('#togglequerybox').off('click');
|
||||
$(document).off('click', '#button_submit_query');
|
||||
$(document).off('change', '#id_bookmark');
|
||||
$("input[name='bookmark_variable']").off("keypress");
|
||||
$(document).off('submit', "#sqlqueryform.ajax");
|
||||
$(document).off('click', "input[name=navig].ajax");
|
||||
$(document).off('submit', "form[name='displayOptionsForm'].ajax");
|
||||
$('input[name=\'bookmark_variable\']').off('keypress');
|
||||
$(document).off('submit', '#sqlqueryform.ajax');
|
||||
$(document).off('click', 'input[name=navig].ajax');
|
||||
$(document).off('submit', 'form[name=\'displayOptionsForm\'].ajax');
|
||||
$(document).off('mouseenter', 'th.column_heading.pointer');
|
||||
$(document).off('mouseleave', 'th.column_heading.pointer');
|
||||
$(document).off('click', 'th.column_heading.marker');
|
||||
$(window).off('scroll');
|
||||
$(document).off("keyup", ".filter_rows");
|
||||
$(document).off('click', "#printView");
|
||||
$(document).off('keyup', '.filter_rows');
|
||||
$(document).off('click', '#printView');
|
||||
if (codemirror_editor) {
|
||||
codemirror_editor.off('change');
|
||||
} else {
|
||||
@ -165,7 +159,6 @@ AJAX.registerTeardown('sql.js', function () {
|
||||
* @memberOf jQuery
|
||||
*/
|
||||
AJAX.registerOnload('sql.js', function () {
|
||||
|
||||
$(function () {
|
||||
if (codemirror_editor) {
|
||||
codemirror_editor.on('change', function () {
|
||||
@ -175,13 +168,13 @@ AJAX.registerOnload('sql.js', function () {
|
||||
$('#sqlquery').on('input propertychange', function () {
|
||||
PMA_autosaveSQL($('#sqlquery').val());
|
||||
});
|
||||
//Save sql query with sort
|
||||
// Save sql query with sort
|
||||
$('select[name="sql_query"]').on('change', function () {
|
||||
PMA_autosaveSQLSort($('select[name="sql_query"]').val());
|
||||
});
|
||||
//If sql query with sort for current table is stored, change sort by key select value
|
||||
// If sql query with sort for current table is stored, change sort by key select value
|
||||
var sortStoredQuery = (isStorageSupported('localStorage') && typeof window.localStorage.auto_saved_sql_sort !== 'undefined') ? window.localStorage.auto_saved_sql_sort : Cookies.get('auto_saved_sql_sort');
|
||||
if (typeof sortStoredQuery !== 'undefined' && sortStoredQuery !== $('select[name="sql_query"]').val() && $('select[name="sql_query"] option[value="'+sortStoredQuery+'"]').length !== 0) {
|
||||
if (typeof sortStoredQuery !== 'undefined' && sortStoredQuery !== $('select[name="sql_query"]').val() && $('select[name="sql_query"] option[value="' + sortStoredQuery + '"]').length !== 0) {
|
||||
$('select[name="sql_query"]').val(sortStoredQuery).change();
|
||||
}
|
||||
}
|
||||
@ -236,10 +229,10 @@ AJAX.registerOnload('sql.js', function () {
|
||||
/**
|
||||
* Attach Event Handler for 'Copy to clipbpard
|
||||
*/
|
||||
$(document).on('click', "#copyToClipBoard", function (event) {
|
||||
$(document).on('click', '#copyToClipBoard', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var textArea = document.createElement("textarea");
|
||||
var textArea = document.createElement('textarea');
|
||||
|
||||
//
|
||||
// *** This styling is an extra step which is likely not required. ***
|
||||
@ -279,26 +272,26 @@ AJAX.registerOnload('sql.js', function () {
|
||||
|
||||
textArea.value = '';
|
||||
|
||||
$('#serverinfo a').each(function(){
|
||||
$('#serverinfo a').each(function () {
|
||||
textArea.value += $(this).text().split(':')[1].trim() + '/';
|
||||
});
|
||||
textArea.value += '\t\t' + window.location.href;
|
||||
textArea.value += '\n';
|
||||
$('.success').each(function(){
|
||||
$('.success').each(function () {
|
||||
textArea.value += $(this).text() + '\n\n';
|
||||
});
|
||||
|
||||
$('.sql pre').each(function() {
|
||||
$('.sql pre').each(function () {
|
||||
textArea.value += $(this).text() + '\n\n';
|
||||
});
|
||||
|
||||
$('.table_results .column_heading a').each(function() {
|
||||
$('.table_results .column_heading a').each(function () {
|
||||
textArea.value += $(this).text() + '\t';
|
||||
});
|
||||
|
||||
textArea.value += '\n';
|
||||
$('.table_results tbody tr').each(function() {
|
||||
$(this).find('.data span').each(function(){
|
||||
$('.table_results tbody tr').each(function () {
|
||||
$(this).find('.data span').each(function () {
|
||||
textArea.value += $(this).text() + '\t';
|
||||
});
|
||||
textArea.value += '\n';
|
||||
@ -315,25 +308,24 @@ AJAX.registerOnload('sql.js', function () {
|
||||
}
|
||||
|
||||
document.body.removeChild(textArea);
|
||||
|
||||
}); //end of Copy to Clipboard action
|
||||
}); // end of Copy to Clipboard action
|
||||
|
||||
/**
|
||||
* Attach Event Handler for 'Print' link
|
||||
*/
|
||||
$(document).on('click', "#printView", function (event) {
|
||||
$(document).on('click', '#printView', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Take to preview mode
|
||||
printPreview();
|
||||
}); //end of 'Print' action
|
||||
}); // end of 'Print' action
|
||||
|
||||
/**
|
||||
* Attach the {@link makegrid} function to a custom event, which will be
|
||||
* triggered manually everytime the table of results is reloaded
|
||||
* @memberOf jQuery
|
||||
*/
|
||||
$(document).on('makegrid', ".sqlqueryresults", function () {
|
||||
$(document).on('makegrid', '.sqlqueryresults', function () {
|
||||
$('.table_results').each(function () {
|
||||
PMA_makegrid(this);
|
||||
});
|
||||
@ -344,15 +336,15 @@ AJAX.registerOnload('sql.js', function () {
|
||||
* triggered manually everytime the table of results is reloaded
|
||||
* @memberOf jQuery
|
||||
*/
|
||||
$(document).on('stickycolumns', ".sqlqueryresults", function () {
|
||||
$(".sticky_columns").remove();
|
||||
$(".table_results").each(function () {
|
||||
$(document).on('stickycolumns', '.sqlqueryresults', function () {
|
||||
$('.sticky_columns').remove();
|
||||
$('.table_results').each(function () {
|
||||
var $table_results = $(this);
|
||||
//add sticky columns div
|
||||
// add sticky columns div
|
||||
var $stick_columns = initStickyColumns($table_results);
|
||||
rearrangeStickyColumns($stick_columns, $table_results);
|
||||
//adjust sticky columns on scroll
|
||||
$(window).on('scroll', function() {
|
||||
// adjust sticky columns on scroll
|
||||
$(window).on('scroll', function () {
|
||||
handleStickyColumns($stick_columns, $table_results);
|
||||
});
|
||||
});
|
||||
@ -367,16 +359,16 @@ AJAX.registerOnload('sql.js', function () {
|
||||
// do not add this link more than once
|
||||
if (! $('#sqlqueryform').find('a').is('#togglequerybox')) {
|
||||
$('<a id="togglequerybox"></a>')
|
||||
.html(PMA_messages.strHideQueryBox)
|
||||
.appendTo("#sqlqueryform")
|
||||
.html(PMA_messages.strHideQueryBox)
|
||||
.appendTo('#sqlqueryform')
|
||||
// initially hidden because at this point, nothing else
|
||||
// appears under the link
|
||||
.hide();
|
||||
.hide();
|
||||
|
||||
// Attach the toggling of the query box visibility to a click
|
||||
$("#togglequerybox").bind('click', function () {
|
||||
$('#togglequerybox').bind('click', function () {
|
||||
var $link = $(this);
|
||||
$link.siblings().slideToggle("fast");
|
||||
$link.siblings().slideToggle('fast');
|
||||
if ($link.text() == PMA_messages.strHideQueryBox) {
|
||||
$link.text(PMA_messages.strShowQueryBox);
|
||||
// cheap trick to add a spacer between the menu tabs
|
||||
@ -397,15 +389,15 @@ AJAX.registerOnload('sql.js', function () {
|
||||
*
|
||||
* @memberOf jQuery
|
||||
*/
|
||||
$(document).on('click', "#button_submit_query", function (event) {
|
||||
$(".success,.error").hide();
|
||||
//hide already existing error or success message
|
||||
var $form = $(this).closest("form");
|
||||
$(document).on('click', '#button_submit_query', function (event) {
|
||||
$('.success,.error').hide();
|
||||
// hide already existing error or success message
|
||||
var $form = $(this).closest('form');
|
||||
// the Go button related to query submission was clicked,
|
||||
// instead of the one related to Bookmarks, so empty the
|
||||
// id_bookmark selector to avoid misinterpretation in
|
||||
// import.php about what needs to be done
|
||||
$form.find("select[name=id_bookmark]").val("");
|
||||
$form.find('select[name=id_bookmark]').val('');
|
||||
// let normal event propagation happen
|
||||
});
|
||||
|
||||
@ -414,9 +406,8 @@ AJAX.registerOnload('sql.js', function () {
|
||||
* based on the bookmarked query
|
||||
*/
|
||||
$(document).on('change', '#id_bookmark', function (event) {
|
||||
|
||||
var varCount = $(this).find('option:selected').data('varcount');
|
||||
if (typeof varCount == 'undefined') {
|
||||
if (typeof varCount === 'undefined') {
|
||||
varCount = 0;
|
||||
}
|
||||
|
||||
@ -440,7 +431,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
*
|
||||
* @memberOf jQuery
|
||||
*/
|
||||
$("input[name=bookmark_variable]").on("keypress", function (event) {
|
||||
$('input[name=bookmark_variable]').on('keypress', function (event) {
|
||||
// force the 'Enter Key' to implicitly click the #button_submit_bookmark
|
||||
var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
|
||||
if (keycode == 13) { // keycode for enter key
|
||||
@ -452,7 +443,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
// because when you are in the Bookmarked SQL query
|
||||
// section and hit enter, you expect it to do the
|
||||
// same action as the Go button in that section.
|
||||
$("#button_submit_bookmark").click();
|
||||
$('#button_submit_bookmark').click();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@ -466,7 +457,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
* @memberOf jQuery
|
||||
* @name sqlqueryform_submit
|
||||
*/
|
||||
$(document).on('submit', "#sqlqueryform.ajax", function (event) {
|
||||
$(document).on('submit', '#sqlqueryform.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $form = $(this);
|
||||
@ -490,7 +481,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
// success happens if the query returns rows or not
|
||||
|
||||
// show a message that stays on screen
|
||||
if (typeof data.action_bookmark != 'undefined') {
|
||||
if (typeof data.action_bookmark !== 'undefined') {
|
||||
// view only
|
||||
if ('1' == data.action_bookmark) {
|
||||
$('#sqlquery').text(data.sql_query);
|
||||
@ -499,7 +490,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
}
|
||||
// delete
|
||||
if ('2' == data.action_bookmark) {
|
||||
$("#id_bookmark option[value='" + data.id_bookmark + "']").remove();
|
||||
$('#id_bookmark option[value=\'' + data.id_bookmark + '\']').remove();
|
||||
// if there are no bookmarked queries now (only the empty option),
|
||||
// remove the bookmark section
|
||||
if ($('#id_bookmark option').length == 1) {
|
||||
@ -516,9 +507,9 @@ AJAX.registerOnload('sql.js', function () {
|
||||
if (data._menu) {
|
||||
if (history && history.pushState) {
|
||||
history.replaceState({
|
||||
menu : data._menu
|
||||
},
|
||||
null
|
||||
menu : data._menu
|
||||
},
|
||||
null
|
||||
);
|
||||
AJAX.handleMenu.replace(data._menu);
|
||||
} else {
|
||||
@ -535,7 +526,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
PMA_commonParams.setAll(data._params);
|
||||
}
|
||||
|
||||
if (typeof data.ajax_reload != 'undefined') {
|
||||
if (typeof data.ajax_reload !== 'undefined') {
|
||||
if (data.ajax_reload.reload) {
|
||||
if (data.ajax_reload.table_name) {
|
||||
PMA_commonParams.set('table', data.ajax_reload.table_name);
|
||||
@ -544,7 +535,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
PMA_reloadNavigation();
|
||||
}
|
||||
}
|
||||
} else if (typeof data.reload != 'undefined') {
|
||||
} else if (typeof data.reload !== 'undefined') {
|
||||
// this happens if a USE or DROP command was typed
|
||||
PMA_commonActions.setDb(data.db);
|
||||
var url;
|
||||
@ -569,10 +560,10 @@ AJAX.registerOnload('sql.js', function () {
|
||||
$('#togglequerybox').show();
|
||||
PMA_init_slider();
|
||||
|
||||
if (typeof data.action_bookmark == 'undefined') {
|
||||
if (typeof data.action_bookmark === 'undefined') {
|
||||
if ($('#sqlqueryform input[name="retain_query_box"]').is(':checked') !== true) {
|
||||
if ($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
$("#togglequerybox").trigger('click');
|
||||
if ($('#togglequerybox').siblings(':visible').length > 0) {
|
||||
$('#togglequerybox').trigger('click');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -591,7 +582,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
* @memberOf jQuery
|
||||
* @name displayOptionsForm_submit
|
||||
*/
|
||||
$(document).on('submit', "form[name='displayOptionsForm'].ajax", function (event) {
|
||||
$(document).on('submit', 'form[name=\'displayOptionsForm\'].ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
$form = $(this);
|
||||
@ -599,24 +590,24 @@ AJAX.registerOnload('sql.js', function () {
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
$.post($form.attr('action'), $form.serialize() + '&ajax_request=true', function (data) {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
var $sqlqueryresults = $form.parents(".sqlqueryresults");
|
||||
var $sqlqueryresults = $form.parents('.sqlqueryresults');
|
||||
$sqlqueryresults
|
||||
.html(data.message)
|
||||
.trigger('makegrid')
|
||||
.trigger('stickycolumns');
|
||||
.html(data.message)
|
||||
.trigger('makegrid')
|
||||
.trigger('stickycolumns');
|
||||
PMA_init_slider();
|
||||
PMA_highlightSQL($sqlqueryresults);
|
||||
}); // end $.post()
|
||||
}); //end displayOptionsForm handler
|
||||
}); // end displayOptionsForm handler
|
||||
|
||||
// Filter row handling. --STARTS--
|
||||
$(document).on("keyup", ".filter_rows", function () {
|
||||
var unique_id = $(this).data("for");
|
||||
var $target_table = $(".table_results[data-uniqueId='" + unique_id + "']");
|
||||
var $header_cells = $target_table.find("th[data-column]");
|
||||
$(document).on('keyup', '.filter_rows', function () {
|
||||
var unique_id = $(this).data('for');
|
||||
var $target_table = $('.table_results[data-uniqueId=\'' + unique_id + '\']');
|
||||
var $header_cells = $target_table.find('th[data-column]');
|
||||
var target_columns = Array();
|
||||
// To handle colspan=4, in case of edit,copy etc options.
|
||||
var dummy_th = ($(".edit_row_anchor").length !== 0 ?
|
||||
var dummy_th = ($('.edit_row_anchor').length !== 0 ?
|
||||
'<th class="hide dummy_th"></th><th class="hide dummy_th"></th><th class="hide dummy_th"></th>'
|
||||
: '');
|
||||
// Selecting columns that will be considered for filtering and searching.
|
||||
@ -626,11 +617,11 @@ AJAX.registerOnload('sql.js', function () {
|
||||
|
||||
var phrase = $(this).val();
|
||||
// Set same value to both Filter rows fields.
|
||||
$(".filter_rows[data-for='" + unique_id + "']").not(this).val(phrase);
|
||||
$('.filter_rows[data-for=\'' + unique_id + '\']').not(this).val(phrase);
|
||||
// Handle colspan.
|
||||
$target_table.find("thead > tr").prepend(dummy_th);
|
||||
$target_table.find('thead > tr').prepend(dummy_th);
|
||||
$.uiTableFilter($target_table, phrase, target_columns);
|
||||
$target_table.find("th.dummy_th").remove();
|
||||
$target_table.find('th.dummy_th').remove();
|
||||
});
|
||||
// Filter row handling. --ENDS--
|
||||
|
||||
@ -647,7 +638,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
});
|
||||
}
|
||||
|
||||
function submitShowAllForm() {
|
||||
function submitShowAllForm () {
|
||||
var submitData = $form.serialize() + '&ajax_request=true&ajax_page_request=true';
|
||||
PMA_ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
@ -698,13 +689,13 @@ AJAX.registerOnload('sql.js', function () {
|
||||
var dialog_content = '<div class="preview_sql">';
|
||||
if (response.sql_data) {
|
||||
var len = response.sql_data.length;
|
||||
for (var i=0; i<len; i++) {
|
||||
for (var i = 0; i < len; i++) {
|
||||
dialog_content += '<strong>' + PMA_messages.strSQLQuery +
|
||||
'</strong>' + response.sql_data[i].sql_query +
|
||||
PMA_messages.strMatchedRows +
|
||||
' <a href="' + response.sql_data[i].matched_rows_url +
|
||||
'">' + response.sql_data[i].matched_rows + '</a><br>';
|
||||
if (i<len-1) {
|
||||
if (i < len - 1) {
|
||||
dialog_content += '<hr>';
|
||||
}
|
||||
}
|
||||
@ -758,8 +749,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
* Starting from some th, change the class of all td under it.
|
||||
* If isAddClass is specified, it will be used to determine whether to add or remove the class.
|
||||
*/
|
||||
function PMA_changeClassForColumn($this_th, newclass, isAddClass)
|
||||
{
|
||||
function PMA_changeClassForColumn ($this_th, newclass, isAddClass) {
|
||||
// index 0 is the th containing the big T
|
||||
var th_index = $this_th.index();
|
||||
var has_big_t = $this_th.closest('tr').children(':first').hasClass('column_action');
|
||||
@ -784,14 +774,13 @@ function PMA_changeClassForColumn($this_th, newclass, isAddClass)
|
||||
*
|
||||
* @param object $this_a reference to the browse foreign value link
|
||||
*/
|
||||
function browseForeignDialog($this_a)
|
||||
{
|
||||
function browseForeignDialog ($this_a) {
|
||||
var formId = '#browse_foreign_form';
|
||||
var showAllId = '#foreign_showAll';
|
||||
var tableId = '#browse_foreign_table';
|
||||
var filterId = '#input_foreign_filter';
|
||||
var $dialog = null;
|
||||
$.get($this_a.attr('href'), {'ajax_request': true}, function (data) {
|
||||
$.get($this_a.attr('href'), { 'ajax_request': true }, function (data) {
|
||||
// Creates browse foreign value dialog
|
||||
$dialog = $('<div>').append(data.message).dialog({
|
||||
title: PMA_messages.strBrowseForeignValues,
|
||||
@ -814,7 +803,7 @@ function browseForeignDialog($this_a)
|
||||
e.preventDefault();
|
||||
var $input = $this_a.prev('input[type=text]');
|
||||
// Check if input exists or get CEdit edit_box
|
||||
if ($input.length === 0 ) {
|
||||
if ($input.length === 0) {
|
||||
$input = $this_a.closest('.edit_area').prev('.edit_box');
|
||||
}
|
||||
// Set selected value as input value
|
||||
@ -877,14 +866,13 @@ AJAX.registerOnload('sql.js', function () {
|
||||
/**
|
||||
* create resizable table
|
||||
*/
|
||||
$(".sqlqueryresults").trigger('makegrid').trigger('stickycolumns');
|
||||
$('.sqlqueryresults').trigger('makegrid').trigger('stickycolumns');
|
||||
});
|
||||
|
||||
/*
|
||||
* Profiling Chart
|
||||
*/
|
||||
function makeProfilingChart()
|
||||
{
|
||||
function makeProfilingChart () {
|
||||
if ($('#profilingchart').length === 0 ||
|
||||
$('#profilingchart').html().length !== 0 ||
|
||||
!$.jqplot || !$.jqplot.Highlighter || !$.jqplot.PieRenderer
|
||||
@ -907,8 +895,7 @@ function makeProfilingChart()
|
||||
/*
|
||||
* initialize profiling data tables
|
||||
*/
|
||||
function initProfilingTables()
|
||||
{
|
||||
function initProfilingTables () {
|
||||
if (!$.tablesorter) {
|
||||
return;
|
||||
}
|
||||
@ -941,38 +928,38 @@ function initProfilingTables()
|
||||
/*
|
||||
* Set position, left, top, width of sticky_columns div
|
||||
*/
|
||||
function setStickyColumnsPosition($sticky_columns, $table_results, position, top, left, margin_left) {
|
||||
function setStickyColumnsPosition ($sticky_columns, $table_results, position, top, left, margin_left) {
|
||||
$sticky_columns
|
||||
.css("position", position)
|
||||
.css("top", top)
|
||||
.css("left", left ? left : "auto")
|
||||
.css("margin-left", margin_left ? margin_left : "0px")
|
||||
.css("width", $table_results.width());
|
||||
.css('position', position)
|
||||
.css('top', top)
|
||||
.css('left', left ? left : 'auto')
|
||||
.css('margin-left', margin_left ? margin_left : '0px')
|
||||
.css('width', $table_results.width());
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize sticky columns
|
||||
*/
|
||||
function initStickyColumns($table_results) {
|
||||
function initStickyColumns ($table_results) {
|
||||
return $('<table class="sticky_columns"></table>')
|
||||
.insertBefore($table_results)
|
||||
.css("position", "fixed")
|
||||
.css("z-index", "99")
|
||||
.css("width", $table_results.width())
|
||||
.css("margin-left", $('#page_content').css("margin-left"))
|
||||
.css("top", $('#floating_menubar').height())
|
||||
.css("display", "none");
|
||||
.insertBefore($table_results)
|
||||
.css('position', 'fixed')
|
||||
.css('z-index', '99')
|
||||
.css('width', $table_results.width())
|
||||
.css('margin-left', $('#page_content').css('margin-left'))
|
||||
.css('top', $('#floating_menubar').height())
|
||||
.css('display', 'none');
|
||||
}
|
||||
|
||||
/*
|
||||
* Arrange/Rearrange columns in sticky header
|
||||
*/
|
||||
function rearrangeStickyColumns($sticky_columns, $table_results) {
|
||||
var $originalHeader = $table_results.find("thead");
|
||||
var $originalColumns = $originalHeader.find("tr:first").children();
|
||||
function rearrangeStickyColumns ($sticky_columns, $table_results) {
|
||||
var $originalHeader = $table_results.find('thead');
|
||||
var $originalColumns = $originalHeader.find('tr:first').children();
|
||||
var $clonedHeader = $originalHeader.clone();
|
||||
// clone width per cell
|
||||
$clonedHeader.find("tr:first").children().width(function(i,val) {
|
||||
$clonedHeader.find('tr:first').children().width(function (i,val) {
|
||||
var width = $originalColumns.eq(i).width();
|
||||
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
|
||||
if (! is_firefox) {
|
||||
@ -986,7 +973,7 @@ function rearrangeStickyColumns($sticky_columns, $table_results) {
|
||||
/*
|
||||
* Adjust sticky columns on horizontal/vertical scroll for all tables
|
||||
*/
|
||||
function handleAllStickyColumns() {
|
||||
function handleAllStickyColumns () {
|
||||
$('.sticky_columns').each(function () {
|
||||
handleStickyColumns($(this), $(this).next('.table_results'));
|
||||
});
|
||||
@ -995,19 +982,19 @@ function handleAllStickyColumns() {
|
||||
/*
|
||||
* Adjust sticky columns on horizontal/vertical scroll
|
||||
*/
|
||||
function handleStickyColumns($sticky_columns, $table_results) {
|
||||
function handleStickyColumns ($sticky_columns, $table_results) {
|
||||
var currentScrollX = $(window).scrollLeft();
|
||||
var windowOffset = $(window).scrollTop();
|
||||
var tableStartOffset = $table_results.offset().top;
|
||||
var tableEndOffset = tableStartOffset + $table_results.height();
|
||||
if (windowOffset >= tableStartOffset && windowOffset <= tableEndOffset) {
|
||||
//for horizontal scrolling
|
||||
if(prevScrollX != currentScrollX) {
|
||||
// for horizontal scrolling
|
||||
if (prevScrollX != currentScrollX) {
|
||||
prevScrollX = currentScrollX;
|
||||
setStickyColumnsPosition($sticky_columns, $table_results, "absolute", $('#floating_menubar').height() + windowOffset - tableStartOffset);
|
||||
//for vertical scrolling
|
||||
setStickyColumnsPosition($sticky_columns, $table_results, 'absolute', $('#floating_menubar').height() + windowOffset - tableStartOffset);
|
||||
// for vertical scrolling
|
||||
} else {
|
||||
setStickyColumnsPosition($sticky_columns, $table_results, "fixed", $('#floating_menubar').height(), $("#pma_navigation").width() - currentScrollX, $('#page_content').css("margin-left"));
|
||||
setStickyColumnsPosition($sticky_columns, $table_results, 'fixed', $('#floating_menubar').height(), $('#pma_navigation').width() - currentScrollX, $('#page_content').css('margin-left'));
|
||||
}
|
||||
$sticky_columns.show();
|
||||
} else {
|
||||
|
||||
289
js/tbl_change.js
289
js/tbl_change.js
@ -18,11 +18,10 @@
|
||||
*
|
||||
* @return boolean always true
|
||||
*/
|
||||
function nullify(theType, urlField, md5Field, multi_edit)
|
||||
{
|
||||
function nullify (theType, urlField, md5Field, multi_edit) {
|
||||
var rowForm = document.forms.insertForm;
|
||||
|
||||
if (typeof(rowForm.elements['funcs' + multi_edit + '[' + md5Field + ']']) != 'undefined') {
|
||||
if (typeof(rowForm.elements['funcs' + multi_edit + '[' + md5Field + ']']) !== 'undefined') {
|
||||
rowForm.elements['funcs' + multi_edit + '[' + md5Field + ']'].selectedIndex = -1;
|
||||
}
|
||||
|
||||
@ -41,7 +40,6 @@ function nullify(theType, urlField, md5Field, multi_edit)
|
||||
for (var i = 0; i < elts_cnt; i++) {
|
||||
elts[i].checked = false;
|
||||
} // end for
|
||||
|
||||
} // end if
|
||||
}
|
||||
// "SET" field
|
||||
@ -57,7 +55,7 @@ function nullify(theType, urlField, md5Field, multi_edit)
|
||||
rowForm.elements['fields' + multi_edit + '[' + md5Field + ']'].value = '';
|
||||
}
|
||||
// Other field types
|
||||
else /*if (theType == 5)*/ {
|
||||
else /* if (theType == 5)*/ {
|
||||
rowForm.elements['fields' + multi_edit + '[' + md5Field + ']'].value = '';
|
||||
} // end if... else if... else
|
||||
|
||||
@ -70,14 +68,12 @@ function nullify(theType, urlField, md5Field, multi_edit)
|
||||
* its used to prevent adding default (0000-00-00 00:00:00) to database when user enter wrong values
|
||||
* Start of validation part
|
||||
*/
|
||||
//function checks the number of days in febuary
|
||||
function daysInFebruary(year)
|
||||
{
|
||||
// function checks the number of days in febuary
|
||||
function daysInFebruary (year) {
|
||||
return (((year % 4 === 0) && (((year % 100 !== 0)) || (year % 400 === 0))) ? 29 : 28);
|
||||
}
|
||||
//function to convert single digit to double digit
|
||||
function fractionReplace(num)
|
||||
{
|
||||
// function to convert single digit to double digit
|
||||
function fractionReplace (num) {
|
||||
num = parseInt(num, 10);
|
||||
return num >= 1 && num <= 9 ? '0' + num : '00';
|
||||
}
|
||||
@ -89,16 +85,15 @@ function fractionReplace(num)
|
||||
* 3) 02-12-23
|
||||
* 4) And instead of using '-' the following punctuations can be used (+,.,*,^,@,/) All these are accepted by mysql as well. Therefore no issues
|
||||
*/
|
||||
function isDate(val, tmstmp)
|
||||
{
|
||||
function isDate (val, tmstmp) {
|
||||
val = val.replace(/[.|*|^|+|//|@]/g, '-');
|
||||
var arrayVal = val.split("-");
|
||||
var arrayVal = val.split('-');
|
||||
for (var a = 0; a < arrayVal.length; a++) {
|
||||
if (arrayVal[a].length == 1) {
|
||||
arrayVal[a] = fractionReplace(arrayVal[a]);
|
||||
}
|
||||
}
|
||||
val = arrayVal.join("-");
|
||||
val = arrayVal.join('-');
|
||||
var pos = 2;
|
||||
var dtexp = new RegExp(/^([0-9]{4})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30))|((00)-(00)))$/);
|
||||
if (val.length == 8) {
|
||||
@ -112,7 +107,7 @@ function isDate(val, tmstmp)
|
||||
return false;
|
||||
}
|
||||
if (val.substring(0, pos + 2).length == 2) {
|
||||
year = parseInt("20" + val.substring(0, pos + 2), 10);
|
||||
year = parseInt('20' + val.substring(0, pos + 2), 10);
|
||||
}
|
||||
if (tmstmp === true) {
|
||||
if (year < 1978) {
|
||||
@ -134,15 +129,14 @@ function isDate(val, tmstmp)
|
||||
* 2) 2:23:43
|
||||
* 3) 2:23:43.123456
|
||||
*/
|
||||
function isTime(val)
|
||||
{
|
||||
var arrayVal = val.split(":");
|
||||
function isTime (val) {
|
||||
var arrayVal = val.split(':');
|
||||
for (var a = 0, l = arrayVal.length; a < l; a++) {
|
||||
if (arrayVal[a].length == 1) {
|
||||
arrayVal[a] = fractionReplace(arrayVal[a]);
|
||||
}
|
||||
}
|
||||
val = arrayVal.join(":");
|
||||
val = arrayVal.join(':');
|
||||
var tmexp = new RegExp(/^(-)?(([0-7]?[0-9][0-9])|(8[0-2][0-9])|(83[0-8])):((0[0-9])|([1-5][0-9])):((0[0-9])|([1-5][0-9]))(\.[0-9]{1,6}){0,1}$/);
|
||||
return tmexp.test(val);
|
||||
}
|
||||
@ -150,23 +144,21 @@ function isTime(val)
|
||||
/**
|
||||
* To check whether insert section is ignored or not
|
||||
*/
|
||||
function checkForCheckbox(multi_edit)
|
||||
{
|
||||
if($("#insert_ignore_"+multi_edit).length) {
|
||||
return $("#insert_ignore_"+multi_edit).is(":unchecked");
|
||||
function checkForCheckbox (multi_edit) {
|
||||
if ($('#insert_ignore_' + multi_edit).length) {
|
||||
return $('#insert_ignore_' + multi_edit).is(':unchecked');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
{
|
||||
function verificationsAfterFieldChange (urlField, multi_edit, theType) {
|
||||
var evt = window.event || arguments.callee.caller.arguments[0];
|
||||
var target = evt.target || evt.srcElement;
|
||||
var $this_input = $(":input[name^='fields[multi_edit][" + multi_edit + "][" +
|
||||
urlField + "]']");
|
||||
var $this_input = $(':input[name^=\'fields[multi_edit][' + multi_edit + '][' +
|
||||
urlField + ']\']');
|
||||
// the function drop-down that corresponds to this input field
|
||||
var $this_function = $("select[name='funcs[multi_edit][" + multi_edit + "][" +
|
||||
urlField + "]']");
|
||||
var $this_function = $('select[name=\'funcs[multi_edit][' + multi_edit + '][' +
|
||||
urlField + ']\']');
|
||||
var function_selected = false;
|
||||
if (typeof $this_function.val() !== 'undefined' &&
|
||||
$this_function.val() !== null &&
|
||||
@ -175,32 +167,32 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
function_selected = true;
|
||||
}
|
||||
|
||||
//To generate the textbox that can take the salt
|
||||
var new_salt_box = "<br><input type=text name=salt[multi_edit][" + multi_edit + "][" + urlField + "]" +
|
||||
" id=salt_" + target.id + " placeholder='" + PMA_messages.strEncryptionKey + "'>";
|
||||
// To generate the textbox that can take the salt
|
||||
var new_salt_box = '<br><input type=text name=salt[multi_edit][' + multi_edit + '][' + urlField + ']' +
|
||||
' id=salt_' + target.id + ' placeholder=\'' + PMA_messages.strEncryptionKey + '\'>';
|
||||
|
||||
//If encrypting or decrypting functions that take salt as input is selected append the new textbox for salt
|
||||
// If encrypting or decrypting functions that take salt as input is selected append the new textbox for salt
|
||||
if (target.value === 'AES_ENCRYPT' ||
|
||||
target.value === 'AES_DECRYPT' ||
|
||||
target.value === 'DES_ENCRYPT' ||
|
||||
target.value === 'DES_DECRYPT' ||
|
||||
target.value === 'ENCRYPT') {
|
||||
if (!($("#salt_" + target.id).length)) {
|
||||
if (!($('#salt_' + target.id).length)) {
|
||||
$this_input.after(new_salt_box);
|
||||
}
|
||||
} else {
|
||||
//Remove the textbox for salt
|
||||
// Remove the textbox for salt
|
||||
$('#salt_' + target.id).prev('br').remove();
|
||||
$("#salt_" + target.id).remove();
|
||||
$('#salt_' + target.id).remove();
|
||||
}
|
||||
|
||||
if (target.value === 'AES_DECRYPT'
|
||||
|| target.value === 'AES_ENCRYPT'
|
||||
|| target.value === 'MD5') {
|
||||
$('#' + target.id).rules("add", {
|
||||
$('#' + target.id).rules('add', {
|
||||
validationFunctionForFuns: {
|
||||
param: $this_input,
|
||||
depends: function() {
|
||||
depends: function () {
|
||||
return checkForCheckbox(multi_edit);
|
||||
}
|
||||
}
|
||||
@ -208,16 +200,15 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
}
|
||||
|
||||
// Unchecks the corresponding "NULL" control
|
||||
$("input[name='fields_null[multi_edit][" + multi_edit + "][" + urlField + "]']").prop('checked', false);
|
||||
$('input[name=\'fields_null[multi_edit][' + multi_edit + '][' + urlField + ']\']').prop('checked', false);
|
||||
|
||||
// Unchecks the Ignore checkbox for the current row
|
||||
$("input[name='insert_ignore_" + multi_edit + "']").prop('checked', false);
|
||||
$('input[name=\'insert_ignore_' + multi_edit + '\']').prop('checked', false);
|
||||
|
||||
var charExceptionHandling;
|
||||
if (theType.substring(0,4) === "char") {
|
||||
if (theType.substring(0,4) === 'char') {
|
||||
charExceptionHandling = theType.substring(5,6);
|
||||
}
|
||||
else if (theType.substring(0,7) === "varchar") {
|
||||
} else if (theType.substring(0,7) === 'varchar') {
|
||||
charExceptionHandling = theType.substring(8,9);
|
||||
}
|
||||
if (function_selected) {
|
||||
@ -227,34 +218,33 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
}
|
||||
|
||||
if ($this_input.data('rulesadded') == null && ! function_selected) {
|
||||
|
||||
//call validate before adding rules
|
||||
// call validate before adding rules
|
||||
$($this_input[0].form).validate();
|
||||
// validate for date time
|
||||
if (theType == "datetime" || theType == "time" || theType == "date" || theType == "timestamp") {
|
||||
$this_input.rules("add", {
|
||||
if (theType == 'datetime' || theType == 'time' || theType == 'date' || theType == 'timestamp') {
|
||||
$this_input.rules('add', {
|
||||
validationFunctionForDateTime: {
|
||||
param: theType,
|
||||
depends: function() {
|
||||
depends: function () {
|
||||
return checkForCheckbox(multi_edit);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//validation for integer type
|
||||
// validation for integer type
|
||||
if ($this_input.data('type') === 'INT') {
|
||||
var mini = parseInt($this_input.attr('min'));
|
||||
var maxi = parseInt($this_input.attr('max'));
|
||||
$this_input.rules("add", {
|
||||
$this_input.rules('add', {
|
||||
number: {
|
||||
param : true,
|
||||
depends: function() {
|
||||
depends: function () {
|
||||
return checkForCheckbox(multi_edit);
|
||||
}
|
||||
},
|
||||
min: {
|
||||
param: mini,
|
||||
depends: function() {
|
||||
depends: function () {
|
||||
if (isNaN($this_input.val())) {
|
||||
return false;
|
||||
} else {
|
||||
@ -264,7 +254,7 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
},
|
||||
max: {
|
||||
param: maxi,
|
||||
depends: function() {
|
||||
depends: function () {
|
||||
if (isNaN($this_input.val())) {
|
||||
return false;
|
||||
} else {
|
||||
@ -273,17 +263,17 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
}
|
||||
}
|
||||
});
|
||||
//validation for CHAR types
|
||||
// validation for CHAR types
|
||||
} else if ($this_input.data('type') === 'CHAR') {
|
||||
var maxlen = $this_input.data('maxlength');
|
||||
if (typeof maxlen !== 'undefined') {
|
||||
if (maxlen <=4) {
|
||||
maxlen=charExceptionHandling;
|
||||
if (maxlen <= 4) {
|
||||
maxlen = charExceptionHandling;
|
||||
}
|
||||
$this_input.rules("add", {
|
||||
$this_input.rules('add', {
|
||||
maxlength: {
|
||||
param: maxlen,
|
||||
depends: function() {
|
||||
depends: function () {
|
||||
return checkForCheckbox(multi_edit);
|
||||
}
|
||||
}
|
||||
@ -291,10 +281,10 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
}
|
||||
// validate binary & blob types
|
||||
} else if ($this_input.data('type') === 'HEX') {
|
||||
$this_input.rules("add", {
|
||||
$this_input.rules('add', {
|
||||
validationFunctionForHex: {
|
||||
param: true,
|
||||
depends: function() {
|
||||
depends: function () {
|
||||
return checkForCheckbox(multi_edit);
|
||||
}
|
||||
}
|
||||
@ -303,7 +293,7 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
$this_input.data('rulesadded', true);
|
||||
} else if ($this_input.data('rulesadded') == true && function_selected) {
|
||||
// remove any rules added
|
||||
$this_input.rules("remove");
|
||||
$this_input.rules('remove');
|
||||
// remove any error messages
|
||||
$this_input
|
||||
.removeClass('error')
|
||||
@ -320,11 +310,11 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType)
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_change.js', function () {
|
||||
$(document).off('click', 'span.open_gis_editor');
|
||||
$(document).off('click', "input[name^='insert_ignore_']");
|
||||
$(document).off('click', "input[name='gis_data[save]']");
|
||||
$(document).off('click', 'input[name^=\'insert_ignore_\']');
|
||||
$(document).off('click', 'input[name=\'gis_data[save]\']');
|
||||
$(document).off('click', 'input.checkbox_null');
|
||||
$('select[name="submit_type"]').off('change');
|
||||
$(document).off('change', "#insert_rows");
|
||||
$(document).off('change', '#insert_rows');
|
||||
});
|
||||
|
||||
/**
|
||||
@ -335,46 +325,43 @@ AJAX.registerTeardown('tbl_change.js', function () {
|
||||
* Restart insertion with 'N' rows.
|
||||
*/
|
||||
AJAX.registerOnload('tbl_change.js', function () {
|
||||
|
||||
if($("#insertForm").length) {
|
||||
if ($('#insertForm').length) {
|
||||
// validate the comment form when it is submitted
|
||||
$("#insertForm").validate();
|
||||
jQuery.validator.addMethod("validationFunctionForHex", function(value, element) {
|
||||
$('#insertForm').validate();
|
||||
jQuery.validator.addMethod('validationFunctionForHex', function (value, element) {
|
||||
return value.match(/^[a-f0-9]*$/i) !== null;
|
||||
});
|
||||
|
||||
jQuery.validator.addMethod("validationFunctionForFuns", function(value, element, options) {
|
||||
if (value.substring(0, 3) === "AES" && options.data('type') !== 'HEX') {
|
||||
jQuery.validator.addMethod('validationFunctionForFuns', function (value, element, options) {
|
||||
if (value.substring(0, 3) === 'AES' && options.data('type') !== 'HEX') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !(value.substring(0, 3) === "MD5" &&
|
||||
return !(value.substring(0, 3) === 'MD5' &&
|
||||
typeof options.data('maxlength') !== 'undefined' &&
|
||||
options.data('maxlength') < 32);
|
||||
});
|
||||
|
||||
jQuery.validator.addMethod("validationFunctionForDateTime", function(value, element, options) {
|
||||
jQuery.validator.addMethod('validationFunctionForDateTime', function (value, element, options) {
|
||||
var dt_value = value;
|
||||
var theType = options;
|
||||
if (theType == "date") {
|
||||
if (theType == 'date') {
|
||||
return isDate(dt_value);
|
||||
|
||||
} else if (theType == "time") {
|
||||
} else if (theType == 'time') {
|
||||
return isTime(dt_value);
|
||||
|
||||
} else if (theType == "datetime" || theType == "timestamp") {
|
||||
} else if (theType == 'datetime' || theType == 'timestamp') {
|
||||
var tmstmp = false;
|
||||
dt_value = dt_value.trim();
|
||||
if (dt_value == "CURRENT_TIMESTAMP") {
|
||||
if (dt_value == 'CURRENT_TIMESTAMP') {
|
||||
return true;
|
||||
}
|
||||
if (theType == "timestamp") {
|
||||
if (theType == 'timestamp') {
|
||||
tmstmp = true;
|
||||
}
|
||||
if (dt_value == "0000-00-00 00:00:00") {
|
||||
if (dt_value == '0000-00-00 00:00:00') {
|
||||
return true;
|
||||
}
|
||||
var dv = dt_value.indexOf(" ");
|
||||
var dv = dt_value.indexOf(' ');
|
||||
if (dv == -1) { // Only the date component, which is valid
|
||||
return isDate(dt_value, tmstmp);
|
||||
}
|
||||
@ -397,13 +384,13 @@ AJAX.registerOnload('tbl_change.js', function () {
|
||||
|
||||
var $span = $(this);
|
||||
// Current value
|
||||
var value = $span.parent('td').children("input[type='text']").val();
|
||||
var value = $span.parent('td').children('input[type=\'text\']').val();
|
||||
// Field name
|
||||
var field = $span.parents('tr').children('td:first').find("input[type='hidden']").val();
|
||||
var field = $span.parents('tr').children('td:first').find('input[type=\'hidden\']').val();
|
||||
// Column type
|
||||
var type = $span.parents('tr').find('span.column_type').text();
|
||||
// Names of input field and null checkbox
|
||||
var input_name = $span.parent('td').children("input[type='text']").attr('name');
|
||||
var input_name = $span.parent('td').children('input[type=\'text\']').attr('name');
|
||||
|
||||
openGISEditor();
|
||||
if (!gisEditorLoaded) {
|
||||
@ -416,16 +403,16 @@ AJAX.registerOnload('tbl_change.js', function () {
|
||||
/**
|
||||
* Forced validation check of fields
|
||||
*/
|
||||
$(document).on('click',"input[name^='insert_ignore_']", function (event) {
|
||||
$("#insertForm").valid();
|
||||
$(document).on('click','input[name^=\'insert_ignore_\']', function (event) {
|
||||
$('#insertForm').valid();
|
||||
});
|
||||
|
||||
/**
|
||||
* Uncheck the null checkbox as geometry data is placed on the input field
|
||||
*/
|
||||
$(document).on('click', "input[name='gis_data[save]']", function (event) {
|
||||
var input_name = $('form#gis_data_editor_form').find("input[name='input_name']").val();
|
||||
var $null_checkbox = $("input[name='" + input_name + "']").parents('tr').find('.checkbox_null');
|
||||
$(document).on('click', 'input[name=\'gis_data[save]\']', function (event) {
|
||||
var input_name = $('form#gis_data_editor_form').find('input[name=\'input_name\']').val();
|
||||
var $null_checkbox = $('input[name=\'' + input_name + '\']').parents('tr').find('.checkbox_null');
|
||||
$null_checkbox.prop('checked', false);
|
||||
});
|
||||
|
||||
@ -473,26 +460,25 @@ AJAX.registerOnload('tbl_change.js', function () {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Continue Insertion form
|
||||
*/
|
||||
$(document).on('change', "#insert_rows", function (event) {
|
||||
$(document).on('change', '#insert_rows', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var columnCount Number of number of columns table has.
|
||||
*/
|
||||
var columnCount = $("table.insertRowTable:first").find("tr").has("input[name*='fields_name']").length;
|
||||
var columnCount = $('table.insertRowTable:first').find('tr').has('input[name*=\'fields_name\']').length;
|
||||
/**
|
||||
* @var curr_rows Number of current insert rows already on page
|
||||
*/
|
||||
var curr_rows = $("table.insertRowTable").length;
|
||||
var curr_rows = $('table.insertRowTable').length;
|
||||
/**
|
||||
* @var target_rows Number of rows the user wants
|
||||
*/
|
||||
var target_rows = $("#insert_rows").val();
|
||||
var target_rows = $('#insert_rows').val();
|
||||
|
||||
// remove all datepickers
|
||||
$('input.datefield, input.datetimefield').each(function () {
|
||||
@ -500,9 +486,7 @@ AJAX.registerOnload('tbl_change.js', function () {
|
||||
});
|
||||
|
||||
if (curr_rows < target_rows) {
|
||||
|
||||
var tempIncrementIndex = function () {
|
||||
|
||||
var $this_element = $(this);
|
||||
/**
|
||||
* Extract the index from the name attribute for all input/select fields and increment it
|
||||
@ -529,22 +513,22 @@ AJAX.registerOnload('tbl_change.js', function () {
|
||||
$this_element.attr('name', new_name);
|
||||
|
||||
/** If element is select[name*='funcs'], update id */
|
||||
if ($this_element.is("select[name*='funcs']")) {
|
||||
var this_id = $this_element.attr("id");
|
||||
if ($this_element.is('select[name*=\'funcs\']')) {
|
||||
var this_id = $this_element.attr('id');
|
||||
var id_parts = this_id.split(/\_/);
|
||||
var old_id_index = id_parts[1];
|
||||
var prevSelectedValue = $("#field_" + old_id_index + "_1").val();
|
||||
var prevSelectedValue = $('#field_' + old_id_index + '_1').val();
|
||||
var new_id_index = parseInt(old_id_index) + columnCount;
|
||||
var new_id = 'field_' + new_id_index + '_1';
|
||||
$this_element.attr('id', new_id);
|
||||
$this_element.find("option").filter(function () {
|
||||
$this_element.find('option').filter(function () {
|
||||
return $(this).text() === prevSelectedValue;
|
||||
}).attr("selected","selected");
|
||||
}).attr('selected','selected');
|
||||
|
||||
// If salt field is there then update its id.
|
||||
var nextSaltInput = $this_element.parent().next("td").next("td").find("input[name*='salt']");
|
||||
var nextSaltInput = $this_element.parent().next('td').next('td').find('input[name*=\'salt\']');
|
||||
if (nextSaltInput.length !== 0) {
|
||||
nextSaltInput.attr("id", "salt_" + new_id);
|
||||
nextSaltInput.attr('id', 'salt_' + new_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -605,38 +589,36 @@ AJAX.registerOnload('tbl_change.js', function () {
|
||||
};
|
||||
|
||||
while (curr_rows < target_rows) {
|
||||
|
||||
/**
|
||||
* @var $last_row Object referring to the last row
|
||||
*/
|
||||
var $last_row = $("#insertForm").find(".insertRowTable:last");
|
||||
var $last_row = $('#insertForm').find('.insertRowTable:last');
|
||||
|
||||
// need to access this at more than one level
|
||||
// (also needs improvement because it should be calculated
|
||||
// just once per cloned row, not once per column)
|
||||
var new_row_index = 0;
|
||||
|
||||
//Clone the insert tables
|
||||
// Clone the insert tables
|
||||
$last_row
|
||||
.clone(true, true)
|
||||
.insertBefore("#actions_panel")
|
||||
.find('input[name*=multi_edit],select[name*=multi_edit],textarea[name*=multi_edit]')
|
||||
.each(tempIncrementIndex)
|
||||
.end()
|
||||
.find('.foreign_values_anchor')
|
||||
.each(tempReplaceAnchor);
|
||||
.clone(true, true)
|
||||
.insertBefore('#actions_panel')
|
||||
.find('input[name*=multi_edit],select[name*=multi_edit],textarea[name*=multi_edit]')
|
||||
.each(tempIncrementIndex)
|
||||
.end()
|
||||
.find('.foreign_values_anchor')
|
||||
.each(tempReplaceAnchor);
|
||||
|
||||
//Insert/Clone the ignore checkboxes
|
||||
// Insert/Clone the ignore checkboxes
|
||||
if (curr_rows == 1) {
|
||||
$('<input id="insert_ignore_1" type="checkbox" name="insert_ignore_1" checked="checked" />')
|
||||
.insertBefore("table.insertRowTable:last")
|
||||
.after('<label for="insert_ignore_1">' + PMA_messages.strIgnore + '</label>');
|
||||
.insertBefore('table.insertRowTable:last')
|
||||
.after('<label for="insert_ignore_1">' + PMA_messages.strIgnore + '</label>');
|
||||
} else {
|
||||
|
||||
/**
|
||||
* @var $last_checkbox Object reference to the last checkbox in #insertForm
|
||||
*/
|
||||
var $last_checkbox = $("#insertForm").children('input:checkbox:last');
|
||||
var $last_checkbox = $('#insertForm').children('input:checkbox:last');
|
||||
|
||||
/** name of {@link $last_checkbox} */
|
||||
var last_checkbox_name = $last_checkbox.attr('name');
|
||||
@ -646,21 +628,21 @@ AJAX.registerOnload('tbl_change.js', function () {
|
||||
var new_name = last_checkbox_name.replace(/\d+/, last_checkbox_index + 1);
|
||||
|
||||
$('<br/><div class="clearfloat"></div>')
|
||||
.insertBefore("table.insertRowTable:last");
|
||||
.insertBefore('table.insertRowTable:last');
|
||||
|
||||
$last_checkbox
|
||||
.clone()
|
||||
.attr({'id': new_name, 'name': new_name})
|
||||
.prop('checked', true)
|
||||
.insertBefore("table.insertRowTable:last");
|
||||
.clone()
|
||||
.attr({ 'id': new_name, 'name': new_name })
|
||||
.prop('checked', true)
|
||||
.insertBefore('table.insertRowTable:last');
|
||||
|
||||
$('label[for^=insert_ignore]:last')
|
||||
.clone()
|
||||
.attr('for', new_name)
|
||||
.insertBefore("table.insertRowTable:last");
|
||||
.clone()
|
||||
.attr('for', new_name)
|
||||
.insertBefore('table.insertRowTable:last');
|
||||
|
||||
$('<br/>')
|
||||
.insertBefore("table.insertRowTable:last");
|
||||
.insertBefore('table.insertRowTable:last');
|
||||
}
|
||||
curr_rows++;
|
||||
}
|
||||
@ -669,32 +651,32 @@ AJAX.registerOnload('tbl_change.js', function () {
|
||||
// function and Null
|
||||
var tabindex = 0;
|
||||
$('.textfield, .char, textarea')
|
||||
.each(function () {
|
||||
tabindex++;
|
||||
$(this).attr('tabindex', tabindex);
|
||||
// update the IDs of textfields to ensure that they are unique
|
||||
$(this).attr('id', "field_" + tabindex + "_3");
|
||||
.each(function () {
|
||||
tabindex++;
|
||||
$(this).attr('tabindex', tabindex);
|
||||
// update the IDs of textfields to ensure that they are unique
|
||||
$(this).attr('id', 'field_' + tabindex + '_3');
|
||||
|
||||
// special handling for radio fields after updating ids to unique
|
||||
if ($(this).closest('tr').find('span.column_type').html() === 'enum') {
|
||||
if ($(this).val() === $(this).closest('tr').find('span.default_value').html()) {
|
||||
$(this).prop('checked', true);
|
||||
} else {
|
||||
$(this).prop('checked', false);
|
||||
// special handling for radio fields after updating ids to unique
|
||||
if ($(this).closest('tr').find('span.column_type').html() === 'enum') {
|
||||
if ($(this).val() === $(this).closest('tr').find('span.default_value').html()) {
|
||||
$(this).prop('checked', true);
|
||||
} else {
|
||||
$(this).prop('checked', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('.control_at_footer')
|
||||
.each(function () {
|
||||
tabindex++;
|
||||
$(this).attr('tabindex', tabindex);
|
||||
});
|
||||
.each(function () {
|
||||
tabindex++;
|
||||
$(this).attr('tabindex', tabindex);
|
||||
});
|
||||
} else if (curr_rows > target_rows) {
|
||||
while (curr_rows > target_rows) {
|
||||
$("input[id^=insert_ignore]:last")
|
||||
.nextUntil("fieldset")
|
||||
.addBack()
|
||||
.remove();
|
||||
$('input[id^=insert_ignore]:last')
|
||||
.nextUntil('fieldset')
|
||||
.addBack()
|
||||
.remove();
|
||||
curr_rows--;
|
||||
}
|
||||
}
|
||||
@ -703,9 +685,8 @@ AJAX.registerOnload('tbl_change.js', function () {
|
||||
});
|
||||
});
|
||||
|
||||
function changeValueFieldType(elem, searchIndex)
|
||||
{
|
||||
var fieldsValue = $("select#fieldID_" + searchIndex);
|
||||
function changeValueFieldType (elem, searchIndex) {
|
||||
var fieldsValue = $('select#fieldID_' + searchIndex);
|
||||
if (0 === fieldsValue.size()) {
|
||||
return;
|
||||
}
|
||||
@ -716,8 +697,8 @@ function changeValueFieldType(elem, searchIndex)
|
||||
'BETWEEN' == type ||
|
||||
'NOT BETWEEN' == type
|
||||
) {
|
||||
$("#fieldID_" + searchIndex).attr('multiple', '');
|
||||
$('#fieldID_' + searchIndex).attr('multiple', '');
|
||||
} else {
|
||||
$("#fieldID_" + searchIndex).removeAttr('multiple');
|
||||
$('#fieldID_' + searchIndex).removeAttr('multiple');
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ var currentSettings = null;
|
||||
var dateTimeCols = [];
|
||||
var numericCols = [];
|
||||
|
||||
function extractDate(dateString) {
|
||||
function extractDate (dateString) {
|
||||
var matches, match;
|
||||
var dateTimeRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/;
|
||||
var dateRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2}/;
|
||||
@ -28,7 +28,7 @@ function extractDate(dateString) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function PMA_queryChart(data, columnNames, settings) {
|
||||
function PMA_queryChart (data, columnNames, settings) {
|
||||
if ($('#querychart').length === 0) {
|
||||
return;
|
||||
}
|
||||
@ -64,7 +64,7 @@ function PMA_queryChart(data, columnNames, settings) {
|
||||
|
||||
// create the chart
|
||||
var factory = new JQPlotChartFactory();
|
||||
var chart = factory.createChart(settings.type, "querychart");
|
||||
var chart = factory.createChart(settings.type, 'querychart');
|
||||
|
||||
// create the data table and add columns
|
||||
var dataTable = new DataTable();
|
||||
@ -83,7 +83,7 @@ function PMA_queryChart(data, columnNames, settings) {
|
||||
});
|
||||
|
||||
// set data to the data table
|
||||
var columnsToExtract = [ settings.mainAxis ];
|
||||
var columnsToExtract = [settings.mainAxis];
|
||||
$.each(settings.selectedSeries, function (index, element) {
|
||||
columnsToExtract.push(element);
|
||||
});
|
||||
@ -137,7 +137,7 @@ function PMA_queryChart(data, columnNames, settings) {
|
||||
}
|
||||
|
||||
var values = [];
|
||||
$.each(valueMap, function(index, value) {
|
||||
$.each(valueMap, function (index, value) {
|
||||
values.push(value);
|
||||
});
|
||||
dataTable.setData(values);
|
||||
@ -148,7 +148,7 @@ function PMA_queryChart(data, columnNames, settings) {
|
||||
return chart;
|
||||
}
|
||||
|
||||
function drawChart() {
|
||||
function drawChart () {
|
||||
currentSettings.width = $('#resizer').width() - 20;
|
||||
currentSettings.height = $('#resizer').height() - 20;
|
||||
|
||||
@ -171,7 +171,7 @@ function drawChart() {
|
||||
}
|
||||
}
|
||||
|
||||
function getSelectedSeries() {
|
||||
function getSelectedSeries () {
|
||||
var val = $('select[name="chartSeries"]').val() || [];
|
||||
var ret = [];
|
||||
$.each(val, function (i, v) {
|
||||
@ -180,7 +180,7 @@ function getSelectedSeries() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function onXAxisChange() {
|
||||
function onXAxisChange () {
|
||||
var $xAxisSelect = $('select[name="chartXAxis"]');
|
||||
currentSettings.mainAxis = parseInt($xAxisSelect.val(), 10);
|
||||
if (dateTimeCols.indexOf(currentSettings.mainAxis) != -1) {
|
||||
@ -206,7 +206,7 @@ function onXAxisChange() {
|
||||
currentSettings.xaxisLabel = xaxis_title;
|
||||
}
|
||||
|
||||
function onDataSeriesChange() {
|
||||
function onDataSeriesChange () {
|
||||
var $seriesSelect = $('select[name="chartSeries"]');
|
||||
currentSettings.selectedSeries = getSelectedSeries();
|
||||
var yaxis_title;
|
||||
@ -244,7 +244,6 @@ AJAX.registerTeardown('tbl_chart.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_chart.js', function () {
|
||||
|
||||
// handle manual resize
|
||||
$('#resizer').on('resizestop', function (event, ui) {
|
||||
// make room so that the handle will still appear
|
||||
@ -264,7 +263,7 @@ AJAX.registerOnload('tbl_chart.js', function () {
|
||||
$('span.barStacked').show();
|
||||
} else {
|
||||
$('input[name="barStacked"]').prop('checked', false);
|
||||
$.extend(true, currentSettings, {stackSeries : false});
|
||||
$.extend(true, currentSettings, { stackSeries : false });
|
||||
$('span.barStacked').hide();
|
||||
}
|
||||
drawChart();
|
||||
@ -294,27 +293,27 @@ AJAX.registerOnload('tbl_chart.js', function () {
|
||||
// handle stacking for bar, column and area charts
|
||||
$('input[name="barStacked"]').click(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$.extend(true, currentSettings, {stackSeries : true});
|
||||
$.extend(true, currentSettings, { stackSeries : true });
|
||||
} else {
|
||||
$.extend(true, currentSettings, {stackSeries : false});
|
||||
$.extend(true, currentSettings, { stackSeries : false });
|
||||
}
|
||||
drawChart();
|
||||
});
|
||||
|
||||
// handle changes in chart title
|
||||
$('input[name="chartTitle"]')
|
||||
.focus(function () {
|
||||
temp_chart_title = $(this).val();
|
||||
})
|
||||
.keyup(function () {
|
||||
currentSettings.title = $('input[name="chartTitle"]').val();
|
||||
drawChart();
|
||||
})
|
||||
.blur(function () {
|
||||
if ($(this).val() != temp_chart_title) {
|
||||
.focus(function () {
|
||||
temp_chart_title = $(this).val();
|
||||
})
|
||||
.keyup(function () {
|
||||
currentSettings.title = $('input[name="chartTitle"]').val();
|
||||
drawChart();
|
||||
}
|
||||
});
|
||||
})
|
||||
.blur(function () {
|
||||
if ($(this).val() != temp_chart_title) {
|
||||
drawChart();
|
||||
}
|
||||
});
|
||||
|
||||
// handle changing the x-axis
|
||||
$('select[name="chartXAxis"]').change(function () {
|
||||
@ -354,7 +353,6 @@ AJAX.registerOnload('tbl_chart.js', function () {
|
||||
|
||||
// handler for ajax form submission
|
||||
$('#tblchartform').submit(function (event) {
|
||||
|
||||
var $form = $(this);
|
||||
if (codemirror_editor) {
|
||||
$form[0].elements.sql_query.value = codemirror_editor.getValue();
|
||||
@ -375,7 +373,7 @@ AJAX.registerOnload('tbl_chart.js', function () {
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}, "json"); // end $.post()
|
||||
}, 'json'); // end $.post()
|
||||
|
||||
return false;
|
||||
});
|
||||
@ -385,8 +383,8 @@ AJAX.registerOnload('tbl_chart.js', function () {
|
||||
minHeight: 240,
|
||||
minWidth: 300
|
||||
})
|
||||
.width($('#div_view_options').width() - 50)
|
||||
.trigger('resizestop');
|
||||
.width($('#div_view_options').width() - 50)
|
||||
.trigger('resizestop');
|
||||
|
||||
currentSettings = {
|
||||
type : 'line',
|
||||
@ -414,5 +412,5 @@ AJAX.registerOnload('tbl_chart.js', function () {
|
||||
onXAxisChange();
|
||||
onDataSeriesChange();
|
||||
|
||||
$("#tblchartform").submit();
|
||||
$('#tblchartform').submit();
|
||||
});
|
||||
|
||||
@ -10,7 +10,6 @@ AJAX.registerTeardown('tbl_find_replace.js', function () {
|
||||
* Bind events
|
||||
*/
|
||||
AJAX.registerOnload('tbl_find_replace.js', function () {
|
||||
|
||||
$('<div id="toggle_find_div"><a id="toggle_find"></a></div>')
|
||||
.insertAfter('#find_replace_form')
|
||||
.hide();
|
||||
@ -38,9 +37,9 @@ AJAX.registerOnload('tbl_find_replace.js', function () {
|
||||
if (data.success === true) {
|
||||
$('#toggle_find_div').show();
|
||||
$('#toggle_find').click();
|
||||
$("#sqlqueryresultsouter").html(data.preview);
|
||||
$('#sqlqueryresultsouter').html(data.preview);
|
||||
} else {
|
||||
$("#sqlqueryresultsouter").html(data.error);
|
||||
$('#sqlqueryresultsouter').html(data.error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -23,8 +23,7 @@ var svg;
|
||||
/**
|
||||
* Zooms and pans the visualization.
|
||||
*/
|
||||
function zoomAndPan()
|
||||
{
|
||||
function zoomAndPan () {
|
||||
var g = svg.getElementById('groupPanel');
|
||||
if (!g) {
|
||||
return;
|
||||
@ -38,7 +37,7 @@ function zoomAndPan()
|
||||
circle = svg.getElementById(id);
|
||||
svg.change(circle, {
|
||||
r : (3 / scale),
|
||||
"stroke-width" : (2 / scale)
|
||||
'stroke-width' : (2 / scale)
|
||||
});
|
||||
});
|
||||
|
||||
@ -47,7 +46,7 @@ function zoomAndPan()
|
||||
id = $(this).attr('id');
|
||||
line = svg.getElementById(id);
|
||||
svg.change(line, {
|
||||
"stroke-width" : (2 / scale)
|
||||
'stroke-width' : (2 / scale)
|
||||
});
|
||||
});
|
||||
|
||||
@ -56,7 +55,7 @@ function zoomAndPan()
|
||||
id = $(this).attr('id');
|
||||
polygon = svg.getElementById(id);
|
||||
svg.change(polygon, {
|
||||
"stroke-width" : (0.5 / scale)
|
||||
'stroke-width' : (0.5 / scale)
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -64,7 +63,7 @@ function zoomAndPan()
|
||||
/**
|
||||
* Initially loads either SVG or OSM visualization based on the choice.
|
||||
*/
|
||||
function selectVisualization() {
|
||||
function selectVisualization () {
|
||||
if ($('#choice').prop('checked') !== true) {
|
||||
$('#openlayersmap').hide();
|
||||
} else {
|
||||
@ -75,7 +74,7 @@ function selectVisualization() {
|
||||
/**
|
||||
* Adds necessary styles to the div that coontains the openStreetMap.
|
||||
*/
|
||||
function styleOSM() {
|
||||
function styleOSM () {
|
||||
var $placeholder = $('#placeholder');
|
||||
var cssObj = {
|
||||
'border' : '1px solid #aaa',
|
||||
@ -89,7 +88,7 @@ function styleOSM() {
|
||||
/**
|
||||
* Loads the SVG element and make a reference to it.
|
||||
*/
|
||||
function loadSVG() {
|
||||
function loadSVG () {
|
||||
var $placeholder = $('#placeholder');
|
||||
|
||||
$placeholder.svg({
|
||||
@ -105,9 +104,9 @@ function loadSVG() {
|
||||
/**
|
||||
* Adds controllers for zooming and panning.
|
||||
*/
|
||||
function addZoomPanControllers() {
|
||||
function addZoomPanControllers () {
|
||||
var $placeholder = $('#placeholder');
|
||||
if ($("#placeholder").find("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);
|
||||
@ -124,7 +123,7 @@ function addZoomPanControllers() {
|
||||
/**
|
||||
* Resizes the GIS visualization to fit into the space available.
|
||||
*/
|
||||
function resizeGISVisualization() {
|
||||
function resizeGISVisualization () {
|
||||
var $placeholder = $('#placeholder');
|
||||
var old_width = $placeholder.width();
|
||||
var visWidth = $('#div_view_options').width() - 48;
|
||||
@ -143,14 +142,16 @@ function resizeGISVisualization() {
|
||||
/**
|
||||
* Initialize the GIS visualization.
|
||||
*/
|
||||
function initGISVisualization() {
|
||||
function initGISVisualization () {
|
||||
// Loads either SVG or OSM visualization based on the choice
|
||||
selectVisualization();
|
||||
// Resizes the GIS visualization to fit into the space available
|
||||
resizeGISVisualization();
|
||||
if (typeof OpenLayers !== 'undefined') {
|
||||
// Configure OpenLayers
|
||||
OpenLayers._getScriptLocation = function() {return './js/vendor/openlayers/';};
|
||||
OpenLayers._getScriptLocation = function () {
|
||||
return './js/vendor/openlayers/';
|
||||
};
|
||||
// Adds necessary styles to the div that coontains the openStreetMap
|
||||
styleOSM();
|
||||
// Draws openStreetMap with openLayers
|
||||
@ -163,7 +164,7 @@ function initGISVisualization() {
|
||||
zoomAndPan();
|
||||
}
|
||||
|
||||
function getRelativeCoords(e) {
|
||||
function getRelativeCoords (e) {
|
||||
var position = $('#placeholder').offset();
|
||||
return {
|
||||
x : e.pageX - position.left,
|
||||
@ -205,7 +206,6 @@ AJAX.registerTeardown('tbl_gis_visualization.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_gis_visualization.js', function () {
|
||||
|
||||
// If we are in GIS visualization, initialize it
|
||||
if ($('#gis_div').length > 0) {
|
||||
initGISVisualization();
|
||||
@ -228,14 +228,14 @@ AJAX.registerOnload('tbl_gis_visualization.js', function () {
|
||||
event.preventDefault();
|
||||
var relCoords = getRelativeCoords(event);
|
||||
if (delta > 0) {
|
||||
//zoom in
|
||||
// zoom in
|
||||
scale *= zoomFactor;
|
||||
// zooming in keeping the position under mouse pointer unmoved.
|
||||
x = relCoords.x - (relCoords.x - x) * zoomFactor;
|
||||
y = relCoords.y - (relCoords.y - y) * zoomFactor;
|
||||
zoomAndPan();
|
||||
} else {
|
||||
//zoom out
|
||||
// zoom out
|
||||
scale /= zoomFactor;
|
||||
// zooming out keeping the position under mouse pointer unmoved.
|
||||
x = relCoords.x - (relCoords.x - x) / zoomFactor;
|
||||
@ -279,7 +279,7 @@ AJAX.registerOnload('tbl_gis_visualization.js', function () {
|
||||
|
||||
$(document).on('click', '#zoom_in', function (e) {
|
||||
e.preventDefault();
|
||||
//zoom in
|
||||
// zoom in
|
||||
scale *= zoomFactor;
|
||||
|
||||
var $placeholder = $('#placeholder').find('svg');
|
||||
@ -301,7 +301,7 @@ AJAX.registerOnload('tbl_gis_visualization.js', function () {
|
||||
|
||||
$(document).on('click', '#zoom_out', function (e) {
|
||||
e.preventDefault();
|
||||
//zoom out
|
||||
// zoom out
|
||||
scale /= zoomFactor;
|
||||
|
||||
var $placeholder = $('#placeholder').find('svg');
|
||||
@ -342,7 +342,7 @@ AJAX.registerOnload('tbl_gis_visualization.js', function () {
|
||||
*/
|
||||
$('.vector').on('mousemove', function (event) {
|
||||
var contents = $.trim(escapeHtml($(this).attr('name')));
|
||||
$("#tooltip").remove();
|
||||
$('#tooltip').remove();
|
||||
if (contents !== '') {
|
||||
$('<div id="tooltip">' + contents + '</div>').css({
|
||||
position : 'absolute',
|
||||
@ -352,7 +352,7 @@ AJAX.registerOnload('tbl_gis_visualization.js', function () {
|
||||
padding : '2px',
|
||||
'background-color' : '#fee',
|
||||
opacity : 0.90
|
||||
}).appendTo("body").fadeIn(200);
|
||||
}).appendTo('body').fadeIn(200);
|
||||
}
|
||||
});
|
||||
|
||||
@ -360,6 +360,6 @@ AJAX.registerOnload('tbl_gis_visualization.js', function () {
|
||||
* Detect the mouseout event and hide tooltips.
|
||||
*/
|
||||
$('.vector').on('mouseout', function (event) {
|
||||
$("#tooltip").remove();
|
||||
$('#tooltip').remove();
|
||||
});
|
||||
});
|
||||
|
||||
@ -2,14 +2,14 @@
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_operations.js', function () {
|
||||
$(document).off('submit', "#copyTable.ajax");
|
||||
$(document).off('submit', "#moveTableForm");
|
||||
$(document).off('submit', "#tableOptionsForm");
|
||||
$(document).off('submit', "#partitionsForm");
|
||||
$(document).off('click', "#tbl_maintenance li a.maintain_action.ajax");
|
||||
$(document).off('click', "#drop_tbl_anchor.ajax");
|
||||
$(document).off('click', "#drop_view_anchor.ajax");
|
||||
$(document).off('click', "#truncate_tbl_anchor.ajax");
|
||||
$(document).off('submit', '#copyTable.ajax');
|
||||
$(document).off('submit', '#moveTableForm');
|
||||
$(document).off('submit', '#tableOptionsForm');
|
||||
$(document).off('submit', '#partitionsForm');
|
||||
$(document).off('click', '#tbl_maintenance li a.maintain_action.ajax');
|
||||
$(document).off('click', '#drop_tbl_anchor.ajax');
|
||||
$(document).off('click', '#drop_view_anchor.ajax');
|
||||
$(document).off('click', '#truncate_tbl_anchor.ajax');
|
||||
});
|
||||
|
||||
/**
|
||||
@ -20,20 +20,20 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
/**
|
||||
*Ajax action for submitting the "Copy table"
|
||||
**/
|
||||
$(document).on('submit', "#copyTable.ajax", function (event) {
|
||||
$(document).on('submit', '#copyTable.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
$.post($form.attr('action'), $form.serialize() + "&submit_copy=Go", function (data) {
|
||||
$.post($form.attr('action'), $form.serialize() + '&submit_copy=Go', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
if ($form.find("input[name='switch_to_new']").prop('checked')) {
|
||||
if ($form.find('input[name=\'switch_to_new\']').prop('checked')) {
|
||||
PMA_commonParams.set(
|
||||
'db',
|
||||
$form.find("select[name='target_db']").val()
|
||||
$form.find('select[name=\'target_db\']').val()
|
||||
);
|
||||
PMA_commonParams.set(
|
||||
'table',
|
||||
$form.find("input[name='new_name']").val()
|
||||
$form.find('input[name=\'new_name\']').val()
|
||||
);
|
||||
PMA_commonActions.refreshMain(false, function () {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
@ -47,16 +47,16 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});//end of copyTable ajax submit
|
||||
});// end of copyTable ajax submit
|
||||
|
||||
/**
|
||||
*Ajax action for submitting the "Move table"
|
||||
*/
|
||||
$(document).on('submit', "#moveTableForm", function (event) {
|
||||
$(document).on('submit', '#moveTableForm', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
$.post($form.attr('action'), $form.serialize() + "&submit_move=1", function (data) {
|
||||
$.post($form.attr('action'), $form.serialize() + '&submit_move=1', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_commonParams.set('db', data._params.db);
|
||||
PMA_commonParams.set('table', data._params.tbl);
|
||||
@ -74,7 +74,7 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
/**
|
||||
* Ajax action for submitting the "Table options"
|
||||
*/
|
||||
$(document).on('submit', "#tableOptionsForm", function (event) {
|
||||
$(document).on('submit', '#tableOptionsForm', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var $form = $(this);
|
||||
@ -96,7 +96,6 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
submitOptionsForm();
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($tblCollationField.val() !== collationOrigValue && $changeAllColumnCollationsCheckBox.is(':checked')) {
|
||||
$form.PMA_confirm(question, $form.attr('action'), function (url) {
|
||||
$form.removeClass('ajax').submit().addClass('ajax');
|
||||
@ -106,7 +105,7 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
}
|
||||
}
|
||||
|
||||
function submitOptionsForm() {
|
||||
function submitOptionsForm () {
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_commonParams.set('table', data._params.table);
|
||||
@ -126,59 +125,59 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
/**
|
||||
*Ajax events for actions in the "Table maintenance"
|
||||
**/
|
||||
$(document).on('click', "#tbl_maintenance li a.maintain_action.ajax", function (event) {
|
||||
$(document).on('click', '#tbl_maintenance li a.maintain_action.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
if ($(".sqlqueryresults").length !== 0) {
|
||||
$(".sqlqueryresults").remove();
|
||||
if ($('.sqlqueryresults').length !== 0) {
|
||||
$('.sqlqueryresults').remove();
|
||||
}
|
||||
if ($(".result_query").length !== 0) {
|
||||
$(".result_query").remove();
|
||||
if ($('.result_query').length !== 0) {
|
||||
$('.result_query').remove();
|
||||
}
|
||||
//variables which stores the common attributes
|
||||
// variables which stores the common attributes
|
||||
var params = {
|
||||
ajax_request: 1,
|
||||
server: PMA_commonParams.get('server')
|
||||
};
|
||||
$.post($(this).attr('href'), params, function (data) {
|
||||
function scrollToTop() {
|
||||
function scrollToTop () {
|
||||
$('html, body').animate({ scrollTop: 0 });
|
||||
}
|
||||
var $temp_div;
|
||||
if (typeof data !== 'undefined' && data.success === true && data.sql_query !== undefined) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("<div class='sqlqueryresults ajax'></div>").prependTo("#page_content");
|
||||
$(".sqlqueryresults").html(data.sql_query);
|
||||
$('<div class=\'sqlqueryresults ajax\'></div>').prependTo('#page_content');
|
||||
$('.sqlqueryresults').html(data.sql_query);
|
||||
PMA_highlightSQL($('#page_content'));
|
||||
scrollToTop();
|
||||
} else if (typeof data !== 'undefined' && data.success === true) {
|
||||
var $temp_div = $("<div id='temp_div'></div>");
|
||||
var $temp_div = $('<div id=\'temp_div\'></div>');
|
||||
$temp_div.html(data.message);
|
||||
var $success = $temp_div.find(".result_query .success");
|
||||
var $success = $temp_div.find('.result_query .success');
|
||||
PMA_ajaxShowMessage($success);
|
||||
$("<div class='sqlqueryresults ajax'></div>").prependTo("#page_content");
|
||||
$(".sqlqueryresults").html(data.message);
|
||||
$('<div class=\'sqlqueryresults ajax\'></div>').prependTo('#page_content');
|
||||
$('.sqlqueryresults').html(data.message);
|
||||
PMA_highlightSQL($('#page_content'));
|
||||
PMA_init_slider();
|
||||
$(".sqlqueryresults").children("fieldset,br").remove();
|
||||
$('.sqlqueryresults').children('fieldset,br').remove();
|
||||
scrollToTop();
|
||||
} else {
|
||||
$temp_div = $("<div id='temp_div'></div>");
|
||||
$temp_div = $('<div id=\'temp_div\'></div>');
|
||||
$temp_div.html(data.error);
|
||||
var $error = $temp_div.find("code").addClass("error");
|
||||
var $error = $temp_div.find('code').addClass('error');
|
||||
PMA_ajaxShowMessage($error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});//end of table maintenance ajax click
|
||||
});// end of table maintenance ajax click
|
||||
|
||||
/**
|
||||
* Ajax action for submitting the "Partition Maintenance"
|
||||
* Also, asks for confirmation when DROP partition is submitted
|
||||
*/
|
||||
$(document).on('submit', "#partitionsForm", function (event) {
|
||||
$(document).on('submit', '#partitionsForm', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
|
||||
function submitPartitionMaintenance() {
|
||||
function submitPartitionMaintenance () {
|
||||
var submitData = $form.serialize() + '&ajax_request=true&ajax_page_request=true';
|
||||
PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
AJAX.source = $form;
|
||||
@ -200,7 +199,7 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', "#drop_tbl_anchor.ajax", function (event) {
|
||||
$(document).on('click', '#drop_tbl_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
@ -212,7 +211,6 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
) + getForeignKeyCheckboxLoader();
|
||||
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
|
||||
var params = getJSConfirmCommonParam(this);
|
||||
@ -234,9 +232,9 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
}
|
||||
}); // end $.post()
|
||||
}, loadForeignKeyCheckbox); // end $.PMA_confirm()
|
||||
}); //end of Drop Table Ajax action
|
||||
}); // end of Drop Table Ajax action
|
||||
|
||||
$(document).on('click', "#drop_view_anchor.ajax", function (event) {
|
||||
$(document).on('click', '#drop_view_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
@ -248,7 +246,6 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
);
|
||||
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
var params = {
|
||||
'is_js_confirmed': '1',
|
||||
@ -271,9 +268,9 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
}
|
||||
}); // end $.post()
|
||||
}); // end $.PMA_confirm()
|
||||
}); //end of Drop View Ajax action
|
||||
}); // end of Drop View Ajax action
|
||||
|
||||
$(document).on('click', "#truncate_tbl_anchor.ajax", function (event) {
|
||||
$(document).on('click', '#truncate_tbl_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
@ -289,22 +286,21 @@ AJAX.registerOnload('tbl_operations.js', function () {
|
||||
var params = getJSConfirmCommonParam(this);
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if ($(".sqlqueryresults").length !== 0) {
|
||||
$(".sqlqueryresults").remove();
|
||||
if ($('.sqlqueryresults').length !== 0) {
|
||||
$('.sqlqueryresults').remove();
|
||||
}
|
||||
if ($(".result_query").length !== 0) {
|
||||
$(".result_query").remove();
|
||||
if ($('.result_query').length !== 0) {
|
||||
$('.result_query').remove();
|
||||
}
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("<div class='sqlqueryresults ajax'></div>").prependTo("#page_content");
|
||||
$(".sqlqueryresults").html(data.sql_query);
|
||||
$('<div class=\'sqlqueryresults ajax\'></div>').prependTo('#page_content');
|
||||
$('.sqlqueryresults').html(data.sql_query);
|
||||
PMA_highlightSQL($('#page_content'));
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}, loadForeignKeyCheckbox); // end $.PMA_confirm()
|
||||
}); //end of Truncate Table Ajax action
|
||||
|
||||
}); //end $(document).ready for 'Table operations'
|
||||
}); // end of Truncate Table Ajax action
|
||||
}); // end $(document).ready for 'Table operations'
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
* for tbl_relation.php
|
||||
*
|
||||
*/
|
||||
function show_hide_clauses($thisDropdown)
|
||||
{
|
||||
function show_hide_clauses ($thisDropdown) {
|
||||
if ($thisDropdown.val() === '') {
|
||||
$thisDropdown.parent().nextAll('span').hide();
|
||||
} else {
|
||||
@ -17,13 +16,13 @@ function show_hide_clauses($thisDropdown)
|
||||
/**
|
||||
* Sets dropdown options to values
|
||||
*/
|
||||
function setDropdownValues($dropdown, values, selectedValue) {
|
||||
function setDropdownValues ($dropdown, values, selectedValue) {
|
||||
$dropdown.empty();
|
||||
var optionsAsString = '';
|
||||
// add an empty string to the beginning for empty selection
|
||||
values.unshift('');
|
||||
$.each(values, function () {
|
||||
optionsAsString += "<option value='" + escapeHtml(this) + "'" + (selectedValue == this ? " selected='selected'" : "") + ">" + escapeHtml(this) + "</option>";
|
||||
optionsAsString += '<option value=\'' + escapeHtml(this) + '\'' + (selectedValue == this ? ' selected=\'selected\'' : '') + '>' + escapeHtml(this) + '</option>';
|
||||
});
|
||||
$dropdown.append($(optionsAsString));
|
||||
}
|
||||
@ -33,7 +32,7 @@ function setDropdownValues($dropdown, values, selectedValue) {
|
||||
*
|
||||
* @param $dropdown the dropdown whose value got changed
|
||||
*/
|
||||
function getDropdownValues($dropdown) {
|
||||
function getDropdownValues ($dropdown) {
|
||||
var foreignDb = null, foreignTable = null;
|
||||
var $databaseDd, $tableDd, $columnDd;
|
||||
var foreign = '';
|
||||
@ -61,7 +60,7 @@ function getDropdownValues($dropdown) {
|
||||
} else { // if a table selector
|
||||
foreignDb = $databaseDd.val();
|
||||
foreignTable = $dropdown.val();
|
||||
// if no table is selected empty the column dropdown
|
||||
// if no table is selected empty the column dropdown
|
||||
if (foreignTable === '') {
|
||||
setDropdownValues($columnDd, []);
|
||||
return;
|
||||
@ -126,7 +125,6 @@ AJAX.registerTeardown('tbl_relation.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_relation.js', function () {
|
||||
|
||||
/**
|
||||
* Ajax event handler to fetch table/column dropdown values.
|
||||
*/
|
||||
@ -149,20 +147,20 @@ AJAX.registerOnload('tbl_relation.js', function () {
|
||||
|
||||
// Add field.
|
||||
$(this)
|
||||
.prev('span')
|
||||
.clone(true, true)
|
||||
.insertBefore($(this))
|
||||
.find('select')
|
||||
.val('');
|
||||
.prev('span')
|
||||
.clone(true, true)
|
||||
.insertBefore($(this))
|
||||
.find('select')
|
||||
.val('');
|
||||
|
||||
// Add foreign field.
|
||||
var $source_elem = $('select[name^="destination_foreign_column[' +
|
||||
$(this).attr('data-index') + ']"]:last').parent();
|
||||
$source_elem
|
||||
.clone(true, true)
|
||||
.insertAfter($source_elem)
|
||||
.find('select')
|
||||
.val('');
|
||||
.clone(true, true)
|
||||
.insertAfter($source_elem)
|
||||
.find('select')
|
||||
.val('');
|
||||
});
|
||||
|
||||
/**
|
||||
@ -231,12 +229,12 @@ AJAX.registerOnload('tbl_relation.js', function () {
|
||||
// Do nothing
|
||||
});
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}); // end $.PMA_confirm()
|
||||
}); //end Drop Foreign key
|
||||
}); // end Drop Foreign key
|
||||
|
||||
var windowwidth = $(window).width();
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 35 ) + 'px');
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 35) + 'px');
|
||||
});
|
||||
|
||||
@ -20,8 +20,7 @@
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function PMA_checkIfDataTypeNumericOrDate(data_type)
|
||||
{
|
||||
function PMA_checkIfDataTypeNumericOrDate (data_type) {
|
||||
// To test for numeric data-types.
|
||||
var numeric_re = new RegExp(
|
||||
'TINYINT|SMALLINT|MEDIUMINT|INT|BIGINT|DECIMAL|FLOAT|DOUBLE|REAL',
|
||||
@ -51,7 +50,7 @@ function PMA_checkIfDataTypeNumericOrDate(data_type)
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_select.js', function () {
|
||||
$('#togglesearchformlink').off('click');
|
||||
$(document).off('submit', "#tbl_search_form.ajax");
|
||||
$(document).off('submit', '#tbl_search_form.ajax');
|
||||
$('select.geom_func').off('change');
|
||||
$(document).off('click', 'span.open_search_gis_editor');
|
||||
$('body').off('click', 'select[name*="criteriaColumnOperators"]');
|
||||
@ -82,8 +81,8 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
});
|
||||
|
||||
var tableRows = $('#fieldset_table_qbe select');
|
||||
$.each(tableRows, function(index, item){
|
||||
$(item).on("change", function() {
|
||||
$.each(tableRows, function (index, item) {
|
||||
$(item).on('change', function () {
|
||||
changeValueFieldType(this, index);
|
||||
});
|
||||
});
|
||||
@ -91,12 +90,12 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
/**
|
||||
* Ajax event handler for Table search
|
||||
*/
|
||||
$(document).on('submit', "#tbl_search_form.ajax", function (event) {
|
||||
$(document).on('submit', '#tbl_search_form.ajax', function (event) {
|
||||
var unaryFunctions = [
|
||||
'IS NULL',
|
||||
'IS NOT NULL',
|
||||
"= ''",
|
||||
"!= ''"
|
||||
'= \'\'',
|
||||
'!= \'\''
|
||||
];
|
||||
|
||||
var geomUnaryFunctions = [
|
||||
@ -111,7 +110,7 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
event.preventDefault();
|
||||
|
||||
// empty previous search results while we are waiting for new results
|
||||
$("#sqlqueryresultsouter").empty();
|
||||
$('#sqlqueryresultsouter').empty();
|
||||
var $msgbox = PMA_ajaxShowMessage(PMA_messages.strSearching, false);
|
||||
|
||||
PMA_prepareForAjaxRequest($search_form);
|
||||
@ -136,7 +135,7 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
|
||||
if (values['geom_func[' + a + ']'] &&
|
||||
$.isArray(values['geom_func[' + a + ']'], geomUnaryFunctions) >= 0) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (values['criteriaValues[' + a + ']'] === '' || values['criteriaValues[' + a + ']'] === null) {
|
||||
@ -161,10 +160,10 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
if (typeof data.sql_query !== 'undefined') { // zero rows
|
||||
$("#sqlqueryresultsouter").html(data.sql_query);
|
||||
$('#sqlqueryresultsouter').html(data.sql_query);
|
||||
} else { // results found
|
||||
$("#sqlqueryresultsouter").html(data.message);
|
||||
$(".sqlqueryresults").trigger('makegrid').trigger('stickycolumns');
|
||||
$('#sqlqueryresultsouter').html(data.message);
|
||||
$('.sqlqueryresults').trigger('makegrid').trigger('stickycolumns');
|
||||
}
|
||||
$('#tbl_search_form')
|
||||
// workaround for bug #3168569 - Issue on toggling the "Hide search criteria" in chrome.
|
||||
@ -178,9 +177,9 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
.show();
|
||||
// needed for the display options slider in the results
|
||||
PMA_init_slider();
|
||||
$('html, body').animate({scrollTop: 0}, 'fast');
|
||||
$('html, body').animate({ scrollTop: 0 }, 'fast');
|
||||
} else {
|
||||
$("#sqlqueryresultsouter").html(data.error);
|
||||
$('#sqlqueryresultsouter').html(data.error);
|
||||
}
|
||||
PMA_highlightSQL($('#sqlqueryresultsouter'));
|
||||
}); // end $.post()
|
||||
@ -244,7 +243,6 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
} else {
|
||||
$editorSpan.hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', 'span.open_search_gis_editor', function (event) {
|
||||
@ -252,7 +250,7 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
|
||||
var $span = $(this);
|
||||
// Current value
|
||||
var value = $span.parent('td').children("input[type='text']").val();
|
||||
var value = $span.parent('td').children('input[type=\'text\']').val();
|
||||
// Field name
|
||||
var field = 'Parameter';
|
||||
// Column type
|
||||
@ -266,8 +264,8 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
type = 'point';
|
||||
}
|
||||
// Names of input field and null checkbox
|
||||
var input_name = $span.parent('td').children("input[type='text']").attr('name');
|
||||
//Token
|
||||
var input_name = $span.parent('td').children('input[type=\'text\']').attr('name');
|
||||
// Token
|
||||
|
||||
openGISEditor();
|
||||
if (!gisEditorLoaded) {
|
||||
@ -366,10 +364,10 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
} else {
|
||||
$target_field.val(final_value);
|
||||
}
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
button_options[PMA_messages.strCancel] = function () {
|
||||
$(this).dialog("close");
|
||||
$(this).dialog('close');
|
||||
};
|
||||
|
||||
// Display dialog box.
|
||||
@ -411,5 +409,5 @@ AJAX.registerOnload('tbl_select.js', function () {
|
||||
}
|
||||
});
|
||||
var windowwidth = $(window).width();
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 69 ) + 'px');
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 69) + 'px');
|
||||
});
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function PMA_tbl_structure_menu_resizer_callback() {
|
||||
function PMA_tbl_structure_menu_resizer_callback () {
|
||||
var pagewidth = $('body').width();
|
||||
var $page = $('#page_content');
|
||||
pagewidth -= $page.outerWidth(true) - $page.outerWidth();
|
||||
@ -53,13 +53,13 @@ function PMA_tbl_structure_menu_resizer_callback() {
|
||||
/**
|
||||
* Reload fields table
|
||||
*/
|
||||
function reloadFieldForm() {
|
||||
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize() + "&ajax_request=true", function (form_data) {
|
||||
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').find('ul').replaceWith($temp_div.find("#move_columns_dialog ul"));
|
||||
$("#moveColumns").removeClass("move-active");
|
||||
function reloadFieldForm () {
|
||||
$.post($('#fieldsForm').attr('action'), $('#fieldsForm').serialize() + '&ajax_request=true', function (form_data) {
|
||||
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').find('ul').replaceWith($temp_div.find('#move_columns_dialog ul'));
|
||||
$('#moveColumns').removeClass('move-active');
|
||||
/* reinitialise the more options in table */
|
||||
var windowWidth = $(window).width();
|
||||
if (windowWidth > 768) {
|
||||
@ -71,29 +71,28 @@ function reloadFieldForm() {
|
||||
$('#page_content').show();
|
||||
}
|
||||
|
||||
function checkFirst() {
|
||||
if ($("select[name=after_field] option:selected").data('pos') === 'first') {
|
||||
$("input[name=field_where]").val('first');
|
||||
function checkFirst () {
|
||||
if ($('select[name=after_field] option:selected').data('pos') === 'first') {
|
||||
$('input[name=field_where]').val('first');
|
||||
} else {
|
||||
$("input[name=field_where]").val('after');
|
||||
$('input[name=field_where]').val('after');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('tbl_structure.js', function () {
|
||||
$(document).off('click', "a.drop_column_anchor.ajax");
|
||||
$(document).off('click', "a.add_key.ajax");
|
||||
$(document).off('click', "#move_columns_anchor");
|
||||
$(document).off('click', "#printView");
|
||||
$(document).off('submit', ".append_fields_form.ajax");
|
||||
$(document).off('click', 'a.drop_column_anchor.ajax');
|
||||
$(document).off('click', 'a.add_key.ajax');
|
||||
$(document).off('click', '#move_columns_anchor');
|
||||
$(document).off('click', '#printView');
|
||||
$(document).off('submit', '.append_fields_form.ajax');
|
||||
$('body').off('click', '#fieldsForm.ajax button[name="submit_mult"], #fieldsForm.ajax input[name="submit_mult"]');
|
||||
$(document).off('click', 'a[name^=partition_action].ajax');
|
||||
$(document).off('click', '#remove_partitioning.ajax');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_structure.js', function () {
|
||||
|
||||
// Re-initialize variables.
|
||||
primary_indexes = [];
|
||||
indexes = [];
|
||||
@ -103,8 +102,8 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
/**
|
||||
*Ajax action for submitting the "Column Change" and "Add Column" form
|
||||
*/
|
||||
$(".append_fields_form.ajax").off();
|
||||
$(document).on('submit', ".append_fields_form.ajax", function (event) {
|
||||
$('.append_fields_form.ajax').off();
|
||||
$(document).on('submit', '.append_fields_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var the_form object referring to the export form
|
||||
@ -113,21 +112,21 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
var field_cnt = $form.find('input[name=orig_num_fields]').val();
|
||||
|
||||
|
||||
function submitForm(){
|
||||
function submitForm () {
|
||||
$msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
|
||||
$.post($form.attr('action'), $form.serialize() + '&do_save_data=1', function (data) {
|
||||
if ($(".sqlqueryresults").length !== 0) {
|
||||
$(".sqlqueryresults").remove();
|
||||
} else if ($(".error:not(.tab)").length !== 0) {
|
||||
$(".error:not(.tab)").remove();
|
||||
if ($('.sqlqueryresults').length !== 0) {
|
||||
$('.sqlqueryresults').remove();
|
||||
} else if ($('.error:not(.tab)').length !== 0) {
|
||||
$('.error:not(.tab)').remove();
|
||||
}
|
||||
if (typeof data.success != 'undefined' && data.success === true) {
|
||||
$("#page_content")
|
||||
if (typeof data.success !== 'undefined' && data.success === true) {
|
||||
$('#page_content')
|
||||
.empty()
|
||||
.append(data.message)
|
||||
.show();
|
||||
PMA_highlightSQL($('#page_content'));
|
||||
$(".result_query .notice").remove();
|
||||
$('.result_query .notice').remove();
|
||||
reloadFieldForm();
|
||||
$form.remove();
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
@ -139,19 +138,19 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
}); // end $.post()
|
||||
}
|
||||
|
||||
function checkIfConfirmRequired($form, $field_cnt) {
|
||||
function checkIfConfirmRequired ($form, $field_cnt) {
|
||||
var i = 0, id, elm, val, name_orig, elm_orig, val_orig;
|
||||
var checkRequired = false;
|
||||
for (i = 0; i < field_cnt; i++) {
|
||||
id = "#field_" + i + "_5";
|
||||
id = '#field_' + i + '_5';
|
||||
elm = $(id);
|
||||
val = elm.val();
|
||||
|
||||
name_orig = "input[name=field_collation_orig\\[" + i + "\\]]";
|
||||
name_orig = 'input[name=field_collation_orig\\[' + i + '\\]]';
|
||||
elm_orig = $form.find(name_orig);
|
||||
val_orig = elm_orig.val();
|
||||
|
||||
if (val && val_orig && val !== val_orig){
|
||||
if (val && val_orig && val !== val_orig) {
|
||||
checkRequired = true;
|
||||
break;
|
||||
}
|
||||
@ -171,10 +170,10 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
if (PMA_checkReservedWordColumns($form)) {
|
||||
//User wants to submit the form
|
||||
// User wants to submit the form
|
||||
|
||||
// If Collation is changed, Warn and Confirm
|
||||
if (checkIfConfirmRequired($form, field_cnt)){
|
||||
if (checkIfConfirmRequired($form, field_cnt)) {
|
||||
var question = sprintf(
|
||||
PMA_messages.strChangeColumnCollation, 'https://wiki.phpmyadmin.net/pma/Garbled_data'
|
||||
);
|
||||
@ -191,7 +190,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
/**
|
||||
* Attach Event Handler for 'Drop Column'
|
||||
*/
|
||||
$(document).on('click', "a.drop_column_anchor.ajax", function (event) {
|
||||
$(document).on('click', 'a.drop_column_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var curr_table_name String containing the name of the current table
|
||||
@ -209,7 +208,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
/**
|
||||
* @var $after_field_item Corresponding entry in the 'After' field.
|
||||
*/
|
||||
var $after_field_item = $("select[name='after_field'] option[value='" + curr_column_name + "']");
|
||||
var $after_field_item = $('select[name=\'after_field\'] option[value=\'' + curr_column_name + '\']');
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
@ -239,18 +238,18 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
$row.find('td:nth-child(2)').text(new_val);
|
||||
}
|
||||
$after_field_item.remove();
|
||||
$curr_row.hide("medium").remove();
|
||||
$curr_row.hide('medium').remove();
|
||||
|
||||
// Remove the dropped column from select menu for 'after field'
|
||||
$("select[name=after_field]").find(
|
||||
$('select[name=after_field]').find(
|
||||
'[value="' + curr_column_name + '"]'
|
||||
).remove();
|
||||
|
||||
// by default select the (new) last option to add new column
|
||||
// (in case last column is dropped)
|
||||
$("select[name=after_field] option:last").attr("selected","selected");
|
||||
$('select[name=after_field] option:last').attr('selected','selected');
|
||||
|
||||
//refresh table stats
|
||||
// refresh table stats
|
||||
if (data.tableStat) {
|
||||
$('#tablestatistics').html(data.tableStat);
|
||||
}
|
||||
@ -258,26 +257,26 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
$('.index_info').replaceWith(data.indexes_list);
|
||||
PMA_reloadNavigation();
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false);
|
||||
PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}); // end $.PMA_confirm()
|
||||
}); //end of Drop Column Anchor action
|
||||
}); // end of Drop Column Anchor action
|
||||
|
||||
/**
|
||||
* Attach Event Handler for 'Print' link
|
||||
*/
|
||||
$(document).on('click', "#printView", function (event) {
|
||||
$(document).on('click', '#printView', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Take to preview mode
|
||||
printPreview();
|
||||
}); //end of Print View action
|
||||
}); // end of Print View action
|
||||
|
||||
/**
|
||||
* Ajax Event handler for adding keys
|
||||
*/
|
||||
$(document).on('click', "a.add_key.ajax", function (event) {
|
||||
$(document).on('click', 'a.add_key.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $this = $(this);
|
||||
@ -308,15 +307,15 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
};
|
||||
$.post(url, params, AJAX.responseHandler);
|
||||
}); // end $.PMA_confirm()
|
||||
}); //end Add key
|
||||
}); // end Add key
|
||||
|
||||
/**
|
||||
* Inline move columns
|
||||
**/
|
||||
$(document).on('click', "#move_columns_anchor", function (e) {
|
||||
$(document).on('click', '#move_columns_anchor', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ($(this).hasClass("move-active")) {
|
||||
if ($(this).hasClass('move-active')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -330,55 +329,55 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
event.preventDefault();
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
var $this = $(this);
|
||||
var $form = $this.find("form");
|
||||
var $form = $this.find('form');
|
||||
var serialized = $form.serialize();
|
||||
|
||||
// check if any columns were moved at all
|
||||
if (serialized == $form.data("serialized-unmoved")) {
|
||||
if (serialized == $form.data('serialized-unmoved')) {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
$this.dialog('close');
|
||||
return;
|
||||
}
|
||||
|
||||
$.post($form.prop("action"), serialized + "&ajax_request=true", function (data) {
|
||||
$.post($form.prop('action'), serialized + '&ajax_request=true', function (data) {
|
||||
if (data.success === false) {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
$this
|
||||
.clone()
|
||||
.html(data.error)
|
||||
.dialog({
|
||||
title: $(this).prop("title"),
|
||||
height: 230,
|
||||
width: 900,
|
||||
modal: true,
|
||||
buttons: button_options_error
|
||||
}); // end dialog options
|
||||
.clone()
|
||||
.html(data.error)
|
||||
.dialog({
|
||||
title: $(this).prop('title'),
|
||||
height: 230,
|
||||
width: 900,
|
||||
modal: true,
|
||||
buttons: button_options_error
|
||||
}); // end dialog options
|
||||
} else {
|
||||
if ($('#fieldsForm').hasClass('HideStructureActions')) {
|
||||
$('#fieldsForm').find('ul.table-structure-actions').menuResizer('destroy');
|
||||
}
|
||||
// sort the fields table
|
||||
var $fields_table = $("table#tablestructure tbody");
|
||||
var $fields_table = $('table#tablestructure tbody');
|
||||
// remove all existing rows and remember them
|
||||
var $rows = $fields_table.find("tr").remove();
|
||||
var $rows = $fields_table.find('tr').remove();
|
||||
// loop through the correct order
|
||||
for (var i in data.columns) {
|
||||
var the_column = data.columns[i];
|
||||
var $the_row = $rows
|
||||
.find("input:checkbox[value='" + the_column + "']")
|
||||
.closest("tr");
|
||||
.find('input:checkbox[value=\'' + the_column + '\']')
|
||||
.closest('tr');
|
||||
// append the row for this column to the table
|
||||
$fields_table.append($the_row);
|
||||
}
|
||||
var $firstrow = $fields_table.find("tr").eq(0);
|
||||
var $firstrow = $fields_table.find('tr').eq(0);
|
||||
// Adjust the row numbers and colors
|
||||
for (var $row = $firstrow; $row.length > 0; $row = $row.next()) {
|
||||
$row
|
||||
.find('td:nth-child(2)')
|
||||
.text($row.index() + 1)
|
||||
.end()
|
||||
.removeClass("odd even")
|
||||
.addClass($row.index() % 2 === 0 ? "odd" : "even");
|
||||
.find('td:nth-child(2)')
|
||||
.text($row.index() + 1)
|
||||
.end()
|
||||
.removeClass('odd even')
|
||||
.addClass($row.index() % 2 === 0 ? 'odd' : 'even');
|
||||
}
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$this.dialog('close');
|
||||
@ -402,43 +401,43 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
|
||||
var columns = [];
|
||||
|
||||
$("#tablestructure").find("tbody tr").each(function () {
|
||||
var col_name = $(this).find("input:checkbox").eq(0).val();
|
||||
var hidden_input = $("<input/>")
|
||||
$('#tablestructure').find('tbody tr').each(function () {
|
||||
var col_name = $(this).find('input:checkbox').eq(0).val();
|
||||
var hidden_input = $('<input/>')
|
||||
.prop({
|
||||
name: "move_columns[]",
|
||||
type: "hidden"
|
||||
name: 'move_columns[]',
|
||||
type: 'hidden'
|
||||
})
|
||||
.val(col_name);
|
||||
columns[columns.length] = $("<li/>")
|
||||
.addClass("placeholderDrag")
|
||||
columns[columns.length] = $('<li/>')
|
||||
.addClass('placeholderDrag')
|
||||
.text(col_name)
|
||||
.append(hidden_input);
|
||||
});
|
||||
|
||||
var col_list = $("#move_columns_dialog").find("ul")
|
||||
.find("li").remove().end();
|
||||
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").find("div"),
|
||||
containment: $('#move_columns_dialog').find('div'),
|
||||
tolerance: 'pointer'
|
||||
}).disableSelection();
|
||||
var $form = $("#move_columns_dialog").find("form");
|
||||
$form.data("serialized-unmoved", $form.serialize());
|
||||
var $form = $('#move_columns_dialog').find('form');
|
||||
$form.data('serialized-unmoved', $form.serialize());
|
||||
|
||||
$("#move_columns_dialog").dialog({
|
||||
$('#move_columns_dialog').dialog({
|
||||
modal: true,
|
||||
buttons: button_options,
|
||||
open: function () {
|
||||
if ($('#move_columns_dialog').parents('.ui-dialog').height() > $(window).height()) {
|
||||
$('#move_columns_dialog').dialog("option", "height", $(window).height());
|
||||
$('#move_columns_dialog').dialog('option', 'height', $(window).height());
|
||||
}
|
||||
},
|
||||
beforeClose: function () {
|
||||
$("#move_columns_anchor").removeClass("move-active");
|
||||
$('#move_columns_anchor').removeClass('move-active');
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -463,7 +462,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
e.preventDefault();
|
||||
var $link = $(this);
|
||||
|
||||
function submitPartitionAction(url) {
|
||||
function submitPartitionAction (url) {
|
||||
var params = {
|
||||
'ajax_request' : true,
|
||||
'ajax_page_request' : true
|
||||
@ -514,7 +513,7 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
/** Handler for "More" dropdown in structure table rows */
|
||||
AJAX.registerOnload('tbl_structure.js', function () {
|
||||
var windowwidth = $(window).width();
|
||||
if (windowwidth > 768){
|
||||
if (windowwidth > 768) {
|
||||
if ($('#fieldsForm').hasClass('HideStructureActions')) {
|
||||
$('#fieldsForm').find('ul.table-structure-actions').menuResizer(PMA_tbl_structure_menu_resizer_callback);
|
||||
} else {
|
||||
@ -528,18 +527,17 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
}
|
||||
}
|
||||
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 35 ) + 'px');
|
||||
$('.jsresponsive').css('max-width', (windowwidth - 35) + 'px');
|
||||
var tableRows = $('.central_columns');
|
||||
$.each(tableRows, function(index, item){
|
||||
$.each(tableRows, function (index, item) {
|
||||
if ($(item).hasClass('add_button')) {
|
||||
$(item).click(function() {
|
||||
$(item).click(function () {
|
||||
$('input:checkbox').prop('checked', false);
|
||||
$('#checkbox_row_' + (index + 1)).prop('checked', true);
|
||||
$('button[value=add_to_central_columns]').click();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(item).click(function() {
|
||||
} else {
|
||||
$(item).click(function () {
|
||||
$('input:checkbox').prop('checked', false);
|
||||
$('#checkbox_row_' + (index + 1)).prop('checked', true);
|
||||
$('button[value=remove_from_central_columns]').click();
|
||||
|
||||
@ -11,15 +11,14 @@ AJAX.registerTeardown('tbl_tracking.js', function () {
|
||||
* Bind event handlers
|
||||
*/
|
||||
AJAX.registerOnload('tbl_tracking.js', function () {
|
||||
|
||||
$('#versions tr:first th').append($('<div class="sorticon"></div>'));
|
||||
$('#versions').tablesorter({
|
||||
sortList: [[1, 0]],
|
||||
headers: {
|
||||
0: {sorter: false},
|
||||
1: {sorter: "integer"},
|
||||
5: {sorter: false},
|
||||
6: {sorter: false}
|
||||
0: { sorter: false },
|
||||
1: { sorter: 'integer' },
|
||||
5: { sorter: false },
|
||||
6: { sorter: false }
|
||||
}
|
||||
});
|
||||
|
||||
@ -28,9 +27,9 @@ AJAX.registerOnload('tbl_tracking.js', function () {
|
||||
$('#ddl_versions').tablesorter({
|
||||
sortList: [[0, 0]],
|
||||
headers: {
|
||||
0: {sorter: "integer"},
|
||||
3: {sorter: false},
|
||||
4: {sorter: false}
|
||||
0: { sorter: 'integer' },
|
||||
3: { sorter: false },
|
||||
4: { sorter: false }
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -40,9 +39,9 @@ AJAX.registerOnload('tbl_tracking.js', function () {
|
||||
$('#dml_versions').tablesorter({
|
||||
sortList: [[0, 0]],
|
||||
headers: {
|
||||
0: {sorter: "integer"},
|
||||
3: {sorter: false},
|
||||
4: {sorter: false}
|
||||
0: { sorter: 'integer' },
|
||||
3: { sorter: false },
|
||||
4: { sorter: false }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
/**
|
||||
** Display Help/Info
|
||||
**/
|
||||
function displayHelp() {
|
||||
function displayHelp () {
|
||||
$('<div />')
|
||||
.append(PMA_messages.strDisplayHelp)
|
||||
.appendTo('#page_content')
|
||||
@ -43,7 +43,7 @@ Array.min = function (array) {
|
||||
** Checks if a string contains only numeric value
|
||||
** @param n: String (to be checked)
|
||||
**/
|
||||
function isNumeric(n) {
|
||||
function isNumeric (n) {
|
||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ function isNumeric(n) {
|
||||
** Checks if an object is empty
|
||||
** @param n: Object (to be checked)
|
||||
**/
|
||||
function isEmpty(obj) {
|
||||
function isEmpty (obj) {
|
||||
var name;
|
||||
for (name in obj) {
|
||||
return false;
|
||||
@ -64,16 +64,14 @@ function isEmpty(obj) {
|
||||
** @param val String Date
|
||||
** @param type Sring Field type(datetime/timestamp/time/date)
|
||||
**/
|
||||
function getTimeStamp(val, type) {
|
||||
function getTimeStamp (val, type) {
|
||||
if (type.toString().search(/datetime/i) != -1 ||
|
||||
type.toString().search(/timestamp/i) != -1
|
||||
) {
|
||||
return $.datepicker.parseDateTime('yy-mm-dd', 'HH:mm:ss', val);
|
||||
}
|
||||
else if (type.toString().search(/time/i) != -1) {
|
||||
} else if (type.toString().search(/time/i) != -1) {
|
||||
return $.datepicker.parseDateTime('yy-mm-dd', 'HH:mm:ss', '1970-01-01 ' + val);
|
||||
}
|
||||
else if (type.toString().search(/date/i) != -1) {
|
||||
} else if (type.toString().search(/date/i) != -1) {
|
||||
return $.datepicker.parseDate('yy-mm-dd', val);
|
||||
}
|
||||
}
|
||||
@ -82,7 +80,7 @@ function getTimeStamp(val, type) {
|
||||
** Classifies the field type into numeric,timeseries or text
|
||||
** @param field: field type (as in database structure)
|
||||
**/
|
||||
function getType(field) {
|
||||
function getType (field) {
|
||||
if (field.toString().search(/int/i) != -1 ||
|
||||
field.toString().search(/decimal/i) != -1 ||
|
||||
field.toString().search(/year/i) != -1
|
||||
@ -100,9 +98,9 @@ function getType(field) {
|
||||
/**
|
||||
** Scrolls the view to the display section
|
||||
**/
|
||||
function scrollToChart() {
|
||||
function scrollToChart () {
|
||||
var x = $('#dataDisplay').offset().top - 100; // 100 provides buffer in viewport
|
||||
$('html,body').animate({scrollTop: x}, 500);
|
||||
$('html,body').animate({ scrollTop: x }, 500);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,14 +113,14 @@ AJAX.registerTeardown('tbl_zoom_plot_jqplot.js', function () {
|
||||
$('#tableid_3').off('change');
|
||||
$('#inputFormSubmitId').off('click');
|
||||
$('#togglesearchformlink').off('click');
|
||||
$(document).off('keydown', "#dataDisplay :input");
|
||||
$(document).off('keydown', '#dataDisplay :input');
|
||||
$('button.button-reset').off('click');
|
||||
$('div#resizer').off('resizestop');
|
||||
$('div#querychart').off('jqplotDataClick');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
|
||||
var cursorMode = ($('input[name=\'mode\']:checked').val() == 'edit') ? 'crosshair' : 'pointer';
|
||||
var currentChart = null;
|
||||
var searchedDataKey = null;
|
||||
var xLabel = $('#tableid_0').val();
|
||||
@ -150,7 +148,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
|
||||
// first column choice corresponds to the X axis
|
||||
$('#tableid_0').change(function () {
|
||||
//AJAX request for field type, collation, operators, and value field
|
||||
// AJAX request for field type, collation, operators, and value field
|
||||
$.post('tbl_zoom_select.php', {
|
||||
'ajax_request' : true,
|
||||
'change_tbl_info' : true,
|
||||
@ -174,7 +172,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
|
||||
// second column choice corresponds to the Y axis
|
||||
$('#tableid_1').change(function () {
|
||||
//AJAX request for field type, collation, operators, and value field
|
||||
// AJAX request for field type, collation, operators, and value field
|
||||
$.post('tbl_zoom_select.php', {
|
||||
'ajax_request' : true,
|
||||
'change_tbl_info' : true,
|
||||
@ -197,7 +195,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
});
|
||||
|
||||
$('#tableid_2').change(function () {
|
||||
//AJAX request for field type, collation, operators, and value field
|
||||
// AJAX request for field type, collation, operators, and value field
|
||||
$.post('tbl_zoom_select.php', {
|
||||
'ajax_request' : true,
|
||||
'change_tbl_info' : true,
|
||||
@ -218,7 +216,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
});
|
||||
|
||||
$('#tableid_3').change(function () {
|
||||
//AJAX request for field type, collation, operators, and value field
|
||||
// AJAX request for field type, collation, operators, and value field
|
||||
$.post('tbl_zoom_select.php', {
|
||||
'ajax_request' : true,
|
||||
'change_tbl_info' : true,
|
||||
@ -280,8 +278,8 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
* Handle saving of a row in the editor
|
||||
*/
|
||||
buttonOptions[PMA_messages.strSave] = function () {
|
||||
//Find changed values by comparing form values with selectedRow Object
|
||||
var newValues = {};//Stores the values changed from original
|
||||
// Find changed values by comparing form values with selectedRow Object
|
||||
var newValues = {};// Stores the values changed from original
|
||||
var sqlTypes = {};
|
||||
var it = 0;
|
||||
var xChange = false;
|
||||
@ -294,7 +292,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
var oldVal = selectedRow[key];
|
||||
var newVal = ($('#edit_fields_null_id_' + it).prop('checked')) ? null : $('#edit_fieldID_' + it).val();
|
||||
if (newVal instanceof Array) { // when the column is of type SET
|
||||
newVal = $('#edit_fieldID_' + it).map(tempGetVal).get().join(",");
|
||||
newVal = $('#edit_fieldID_' + it).map(tempGetVal).get().join(',');
|
||||
}
|
||||
if (oldVal != newVal) {
|
||||
selectedRow[key] = newVal;
|
||||
@ -314,12 +312,12 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
sqlTypes[key] = null;
|
||||
}
|
||||
it++;
|
||||
} //End data update
|
||||
} // End data update
|
||||
|
||||
//Update the chart series and replot
|
||||
// Update the chart series and replot
|
||||
if (xChange || yChange) {
|
||||
//Logic similar to plot generation, replot only if xAxis changes or yAxis changes.
|
||||
//Code includes a lot of checks so as to replot only when necessary
|
||||
// Logic similar to plot generation, replot only if xAxis changes or yAxis changes.
|
||||
// Code includes a lot of checks so as to replot only when necessary
|
||||
if (xChange) {
|
||||
xCord[searchedDataKey] = selectedRow[xLabel];
|
||||
// [searchedDataKey][0] contains the x value
|
||||
@ -335,7 +333,6 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
currentChart.series[0].data = series[0];
|
||||
// TODO: axis changing
|
||||
currentChart.replot();
|
||||
|
||||
}
|
||||
if (yChange) {
|
||||
yCord[searchedDataKey] = selectedRow[yLabel];
|
||||
@ -353,9 +350,9 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
// TODO: axis changing
|
||||
currentChart.replot();
|
||||
}
|
||||
} //End plot update
|
||||
} // End plot update
|
||||
|
||||
//Generate SQL query for update
|
||||
// Generate SQL query for update
|
||||
if (!isEmpty(newValues)) {
|
||||
var sql_query = 'UPDATE `' + PMA_commonParams.get('table') + '` SET ';
|
||||
for (key in newValues) {
|
||||
@ -368,19 +365,19 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
|
||||
// empty
|
||||
} else if ($.trim(value) === '') {
|
||||
sql_query += "'', ";
|
||||
sql_query += '\'\', ';
|
||||
|
||||
// other
|
||||
} else {
|
||||
// type explicitly identified
|
||||
if (sqlTypes[key] !== null) {
|
||||
if (sqlTypes[key] == 'bit') {
|
||||
sql_query += "b'" + value + "', ";
|
||||
sql_query += 'b\'' + value + '\', ';
|
||||
}
|
||||
// type not explicitly identified
|
||||
} else {
|
||||
if (!isNumeric(value)) {
|
||||
sql_query += "'" + value + "', ";
|
||||
sql_query += '\'' + value + '\', ';
|
||||
} else {
|
||||
sql_query += value + ', ';
|
||||
}
|
||||
@ -391,28 +388,28 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
sql_query = sql_query.substring(0, sql_query.length - 2);
|
||||
sql_query += ' WHERE ' + PMA_urldecode(searchedData[searchedDataKey].where_clause);
|
||||
|
||||
//Post SQL query to sql.php
|
||||
// Post SQL query to sql.php
|
||||
$.post('sql.php', {
|
||||
'server' : PMA_commonParams.get('server'),
|
||||
'db' : PMA_commonParams.get('db'),
|
||||
'ajax_request' : true,
|
||||
'sql_query' : sql_query,
|
||||
'inline_edit' : false
|
||||
}, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('#sqlqueryresultsouter').html(data.sql_query);
|
||||
PMA_highlightSQL($('#sqlqueryresultsouter'));
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); //End $.post
|
||||
}//End database update
|
||||
$("#dataDisplay").dialog('close');
|
||||
'server' : PMA_commonParams.get('server'),
|
||||
'db' : PMA_commonParams.get('db'),
|
||||
'ajax_request' : true,
|
||||
'sql_query' : sql_query,
|
||||
'inline_edit' : false
|
||||
}, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('#sqlqueryresultsouter').html(data.sql_query);
|
||||
PMA_highlightSQL($('#sqlqueryresultsouter'));
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // End $.post
|
||||
}// End database update
|
||||
$('#dataDisplay').dialog('close');
|
||||
};
|
||||
buttonOptions[PMA_messages.strCancel] = function () {
|
||||
$(this).dialog('close');
|
||||
};
|
||||
$("#dataDisplay").dialog({
|
||||
$('#dataDisplay').dialog({
|
||||
autoOpen: false,
|
||||
title: PMA_messages.strDataPointContent,
|
||||
modal: true,
|
||||
@ -427,7 +424,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
* in the dialog. Used to submit the Ajax
|
||||
* request when the ENTER key is pressed.
|
||||
*/
|
||||
$(document).on('keydown', "#dataDisplay :input", function (e) {
|
||||
$(document).on('keydown', '#dataDisplay :input', function (e) {
|
||||
if (e.which === 13) { // 13 is the ENTER key
|
||||
e.preventDefault();
|
||||
if (typeof buttonOptions[PMA_messages.strSave] === 'function') {
|
||||
@ -443,10 +440,10 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
|
||||
if (searchedData !== null) {
|
||||
$('#zoom_search_form')
|
||||
.slideToggle()
|
||||
.hide();
|
||||
.slideToggle()
|
||||
.hide();
|
||||
$('#togglesearchformlink')
|
||||
.text(PMA_messages.strShowSearchCriteria);
|
||||
.text(PMA_messages.strShowSearchCriteria);
|
||||
$('#togglesearchformdiv').show();
|
||||
var selectedRow;
|
||||
var colorCodes = ['#FF0000', '#00FFFF', '#0000FF', '#0000A0', '#FF0080', '#800080', '#FFFF00', '#00FF00', '#FF00FF'];
|
||||
@ -515,11 +512,11 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
format = '%Y-%m-%d';
|
||||
}
|
||||
// TODO: does not seem to work
|
||||
//else if (originalXType == 'time') {
|
||||
// format = '%H:%M';
|
||||
//} else {
|
||||
// else if (originalXType == 'time') {
|
||||
// format = '%H:%M';
|
||||
// } else {
|
||||
// format = '%Y-%m-%d %H:%M';
|
||||
//}
|
||||
// }
|
||||
$.extend(options.axes.xaxis, {
|
||||
renderer: $.jqplot.DateAxisRenderer,
|
||||
tickOptions: {
|
||||
@ -558,7 +555,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
yVal,
|
||||
// extra Y values
|
||||
value[dataLabel], // for highlighter
|
||||
// (may set an undefined value)
|
||||
// (may set an undefined value)
|
||||
value.where_clause, // for click on point
|
||||
key // key from searchedData
|
||||
]);
|
||||
@ -580,7 +577,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
// make room so that the handle will still appear
|
||||
$('div#querychart').height($('div#resizer').height() * 0.96);
|
||||
$('div#querychart').width($('div#resizer').width() * 0.96);
|
||||
currentChart.replot({resetAxes: true});
|
||||
currentChart.replot({ resetAxes: true });
|
||||
});
|
||||
|
||||
$('div#querychart').bind('jqplotDataClick',
|
||||
@ -619,12 +616,12 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
|
||||
selectedRow = data.row_info;
|
||||
});
|
||||
|
||||
$("#dataDisplay").dialog("open");
|
||||
$('#dataDisplay').dialog('open');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$('#help_dialog').click(function(){
|
||||
$('#help_dialog').click(function () {
|
||||
displayHelp();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,10 +5,10 @@
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
AJAX.registerOnload('transformations/image_upload.js', function() {
|
||||
AJAX.registerOnload('transformations/image_upload.js', function () {
|
||||
// Change thumbnail when image file is selected
|
||||
// through file upload dialog
|
||||
$('input.image-upload').on('change', function(event) {
|
||||
$('input.image-upload').on('change', function (event) {
|
||||
if (this.files && this.files[0]) {
|
||||
var reader = new FileReader();
|
||||
var $input = $(this);
|
||||
@ -23,6 +23,6 @@ AJAX.registerOnload('transformations/image_upload.js', function() {
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
*/
|
||||
AJAX.registerTeardown('transformations/image_upload.js', function() {
|
||||
AJAX.registerTeardown('transformations/image_upload.js', function () {
|
||||
$('input.image-upload').off('change');
|
||||
});
|
||||
|
||||
@ -2,17 +2,17 @@
|
||||
/**
|
||||
* JSON syntax highlighting transformation plugin
|
||||
*/
|
||||
AJAX.registerOnload('transformations/json.js', function() {
|
||||
AJAX.registerOnload('transformations/json.js', function () {
|
||||
var $elm = $('#page_content').find('code.json');
|
||||
$elm.each(function () {
|
||||
var $json = $(this);
|
||||
var $pre = $json.find('pre');
|
||||
/* We only care about visible elements to avoid double processing */
|
||||
if ($pre.is(":visible")) {
|
||||
if ($pre.is(':visible')) {
|
||||
var $highlight = $('<div class="json-highlight cm-s-default"></div>');
|
||||
$json.append($highlight);
|
||||
CodeMirror.runMode($json.text(), 'application/json', $highlight[0]);
|
||||
$pre.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
AJAX.registerOnload('transformations/json_editor.js', function() {
|
||||
AJAX.registerOnload('transformations/json_editor.js', function () {
|
||||
$('textarea.transform_json_editor').each(function () {
|
||||
CodeMirror.fromTextArea(this, {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
indentUnit: 4,
|
||||
mode: "application/json",
|
||||
mode: 'application/json',
|
||||
lineWrapping: true
|
||||
});
|
||||
});
|
||||
|
||||
@ -4,8 +4,7 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
AJAX.registerOnload('transformations/sql_editor.js', function() {
|
||||
|
||||
AJAX.registerOnload('transformations/sql_editor.js', function () {
|
||||
$('textarea.transform_sql_editor').each(function () {
|
||||
PMA_getSQLEditor($(this), {}, 'both');
|
||||
});
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
/**
|
||||
* XML syntax highlighting transformation plugin
|
||||
*/
|
||||
AJAX.registerOnload('transformations/xml.js', function() {
|
||||
AJAX.registerOnload('transformations/xml.js', function () {
|
||||
var $elm = $('#page_content').find('code.xml');
|
||||
$elm.each(function () {
|
||||
var $json = $(this);
|
||||
var $pre = $json.find('pre');
|
||||
/* We only care about visible elements to avoid double processing */
|
||||
if ($pre.is(":visible")) {
|
||||
if ($pre.is(':visible')) {
|
||||
var $highlight = $('<div class="xml-highlight cm-s-default"></div>');
|
||||
$json.append($highlight);
|
||||
CodeMirror.runMode($json.text(), 'application/xml', $highlight[0]);
|
||||
|
||||
@ -4,12 +4,12 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
AJAX.registerOnload('transformations/xml_editor.js', function() {
|
||||
$('textarea.transform_xml_editor').each( function () {
|
||||
AJAX.registerOnload('transformations/xml_editor.js', function () {
|
||||
$('textarea.transform_xml_editor').each(function () {
|
||||
CodeMirror.fromTextArea(this, {
|
||||
lineNumbers: true,
|
||||
indentUnit: 4,
|
||||
mode: "application/xml",
|
||||
mode: 'application/xml',
|
||||
lineWrapping: true
|
||||
});
|
||||
});
|
||||
|
||||
@ -13,7 +13,6 @@ if (top != self) {
|
||||
//
|
||||
|
||||
$(function () {
|
||||
|
||||
if (window.location.protocol === 'https:') {
|
||||
$('#no_https').remove();
|
||||
} else {
|
||||
@ -39,10 +38,10 @@ $(function () {
|
||||
}
|
||||
});
|
||||
|
||||
//set document width
|
||||
$(document).ready(function(){
|
||||
// set document width
|
||||
$(document).ready(function () {
|
||||
width = 0;
|
||||
$('ul.tabs li').each(function(){
|
||||
$('ul.tabs li').each(function () {
|
||||
width += $(this).width() + 10;
|
||||
});
|
||||
var contentWidth = width;
|
||||
@ -66,8 +65,7 @@ $(document).ready(function(){
|
||||
* @param {String} id validator id
|
||||
* @param {Object} values values hash {element1_id: value, ...}
|
||||
*/
|
||||
function ajaxValidate(parent, id, values)
|
||||
{
|
||||
function ajaxValidate (parent, id, values) {
|
||||
parent = $(parent);
|
||||
// ensure that parent is a fieldset
|
||||
if (parent.attr('tagName') != 'FIELDSET') {
|
||||
@ -96,9 +94,9 @@ function ajaxValidate(parent, id, values)
|
||||
}
|
||||
|
||||
var error = {};
|
||||
if (typeof response != 'object') {
|
||||
if (typeof response !== 'object') {
|
||||
error[parent.id] = [response];
|
||||
} else if (typeof response.error != 'undefined') {
|
||||
} else if (typeof response.error !== 'undefined') {
|
||||
error[parent.id] = [response.error];
|
||||
} else {
|
||||
for (var key in response) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user