diff --git a/js/src/functions/Table/CreateTable.js b/js/src/functions/Table/CreateTable.js
index f1e3ddbb2f..cdfc18e948 100644
--- a/js/src/functions/Table/CreateTable.js
+++ b/js/src/functions/Table/CreateTable.js
@@ -1,5 +1,11 @@
-import PMA_commonParams from '../../variables/common_params';
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
+import CommonParams from '../../variables/common_params';
import { PMA_Messages as PMA_messages } from '../../variables/export_variables';
+
/**
* Check if a form's element is empty.
* An element containing only spaces is also considered empty
@@ -81,7 +87,7 @@ export function PMA_checkReservedWordColumns ($form) {
$.ajax({
type: 'POST',
url: 'tbl_structure.php',
- data: $form.serialize() + PMA_commonParams.get('arg_separator') + 'reserved_word_check=1',
+ data: $form.serialize() + CommonParams.get('arg_separator') + 'reserved_word_check=1',
success: function (data) {
if (typeof data.success !== 'undefined' && data.success === true) {
is_confirmed = confirm(data.message);
diff --git a/js/src/functions/Table/Relation.js b/js/src/functions/Table/Relation.js
index a987a6867a..3fb16cad7f 100644
--- a/js/src/functions/Table/Relation.js
+++ b/js/src/functions/Table/Relation.js
@@ -1,7 +1,13 @@
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
import { $ } from '../../utils/JqueryExtended';
+import CommonParams from '../../variables/common_params';
import { escapeHtml } from '../../utils/Sanitise';
-import PMA_commonParams from '../../variables/common_params';
import { PMA_ajaxShowMessage, PMA_ajaxRemoveMessage } from '../../utils/show_ajax_messages';
+
/**
* for tbl_relation.php
*
@@ -74,7 +80,7 @@ export function getDropdownValues ($dropdown) {
}
var $msgbox = PMA_ajaxShowMessage();
var $form = $dropdown.parents('form');
- var argsep = PMA_commonParams.get('arg_separator');
+ var argsep = CommonParams.get('arg_separator');
var url = 'tbl_relation.php?getDropdownValues=true' + argsep + 'ajax_request=true' +
argsep + 'db=' + $form.find('input[name="db"]').val() +
argsep + 'table=' + $form.find('input[name="table"]').val() +
diff --git a/js/src/functions/Table/TableChange.js b/js/src/functions/Table/TableChange.js
index 3b9133de61..651e38e3ac 100644
--- a/js/src/functions/Table/TableChange.js
+++ b/js/src/functions/Table/TableChange.js
@@ -1,3 +1,8 @@
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
import { $ } from '../../utils/JqueryExtended';
import { PMA_Messages as PMA_messages } from '../../variables/export_variables';
@@ -65,13 +70,13 @@ function fractionReplace (num) {
return num >= 1 && num <= 9 ? '0' + num : '00';
}
-/* function to check the validity of date
-* The following patterns are accepted in this validation (accepted in mysql as well)
-* 1) 2001-12-23
-* 2) 2001-1-2
-* 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 to check the validity of date
+ * The following patterns are accepted in this validation (accepted in mysql as well)
+ * 1) 2001-12-23
+ * 2) 2001-1-2
+ * 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
+ */
export function isDate (val, tmstmp) {
val = val.replace(/[.|*|^|+|//|@]/g, '-');
var arrayVal = val.split('-');
@@ -110,12 +115,12 @@ export function isDate (val, tmstmp) {
return true;
}
-/* function to check the validity of time
-* The following patterns are accepted in this validation (accepted in mysql as well)
-* 1) 2:3:4
-* 2) 2:23:43
-* 3) 2:23:43.123456
-*/
+/** function to check the validity of time
+ * The following patterns are accepted in this validation (accepted in mysql as well)
+ * 1) 2:3:4
+ * 2) 2:23:43
+ * 3) 2:23:43.123456
+ */
export function isTime (val) {
var arrayVal = val.split(':');
for (var a = 0, l = arrayVal.length; a < l; a++) {
diff --git a/js/src/functions/Table/TableChart.js b/js/src/functions/Table/TableChart.js
index e00a36c6b1..d58c41b9a5 100644
--- a/js/src/functions/Table/TableChart.js
+++ b/js/src/functions/Table/TableChart.js
@@ -1,3 +1,8 @@
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
import { $ } from '../../utils/JqueryExtended';
import JQPlotChartFactory, { DataTable, ColumnType } from '../../classes/Chart';
import { escapeHtml } from '../../utils/Sanitise';
diff --git a/js/src/functions/Table/TableColumns.js b/js/src/functions/Table/TableColumns.js
index eef47c540f..64578015ea 100644
--- a/js/src/functions/Table/TableColumns.js
+++ b/js/src/functions/Table/TableColumns.js
@@ -1,4 +1,10 @@
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
import { $ } from '../../utils/JqueryExtended';
+
/**
* Hides/shows the "Open in ENUM/SET editor" message, depending on the data type of the column currently selected
*/
diff --git a/js/src/functions/Table/TableSelect.js b/js/src/functions/Table/TableSelect.js
index 69302e9cab..b66a49e495 100644
--- a/js/src/functions/Table/TableSelect.js
+++ b/js/src/functions/Table/TableSelect.js
@@ -1,3 +1,8 @@
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
import { $ } from '../../utils/JqueryExtended';
export function changeValueFieldType (elem, searchIndex) {
diff --git a/js/src/functions/Table/TableStructure.js b/js/src/functions/Table/TableStructure.js
new file mode 100644
index 0000000000..b67b1e96ad
--- /dev/null
+++ b/js/src/functions/Table/TableStructure.js
@@ -0,0 +1,28 @@
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
+import CommonParams from '../../variables/common_params';
+
+/**
+ * Reload fields table
+ */
+export function reloadFieldForm () {
+ $.post($('#fieldsForm').attr('action'), $('#fieldsForm').serialize() + CommonParams.get('arg_separator') + 'ajax_request=true', function (form_data) {
+ var $temp_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');
+ });
+ $('#page_content').show();
+}
+
+export 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');
+ }
+}
diff --git a/js/src/tbl_change.js b/js/src/tbl_change.js
index 9868c2d425..13491b3b82 100644
--- a/js/src/tbl_change.js
+++ b/js/src/tbl_change.js
@@ -1,14 +1,13 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
import { $, extendingValidatorMessages } from './utils/JqueryExtended';
-import {
- isDate,
- isTime,
- nullify,
- verificationsAfterFieldChange
-} from './functions/Table/TableChange';
+import { AJAX } from './ajax';
+import * as TableChange from './functions/Table/TableChange';
import { PMA_Messages as PMA_messages } from './variables/export_variables';
import { addDateTimePicker } from './utils/DateTime';
-import { AJAX } from './ajax';
/**
* @fileoverview function used in table data manipulation pages
@@ -60,9 +59,9 @@ export function onloadTblChange () {
var dt_value = value;
var theType = options;
if (theType === 'date') {
- return isDate(dt_value);
+ return TableChange.isDate(dt_value);
} else if (theType === 'time') {
- return isTime(dt_value);
+ return TableChange.isTime(dt_value);
} else if (theType === 'datetime' || theType === 'timestamp') {
var tmstmp = false;
dt_value = dt_value.trim();
@@ -77,11 +76,11 @@ export function onloadTblChange () {
}
var dv = dt_value.indexOf(' ');
if (dv === -1) { // Only the date component, which is valid
- return isDate(dt_value, tmstmp);
+ return TableChange.isDate(dt_value, tmstmp);
}
- return isDate(dt_value.substring(0, dv), tmstmp) &&
- isTime(dt_value.substring(dv + 1));
+ return TableChange.isDate(dt_value.substring(0, dv), tmstmp) &&
+ TableChange.isTime(dt_value.substring(dv + 1));
}
});
/*
@@ -137,7 +136,7 @@ export function onloadTblChange () {
*
*/
$(document).on('click', 'input.checkbox_null', function () {
- nullify(
+ TableChange.nullify(
// use hidden fields populated by tbl_change.php
$(this).siblings('.nullify_code').val(),
$(this).closest('tr').find('input:hidden').first().val(),
@@ -264,7 +263,7 @@ export function onloadTblChange () {
.data('new_row_index', new_row_index)
.on('change', function () {
var $changed_element = $(this);
- verificationsAfterFieldChange(
+ TableChange.verificationsAfterFieldChange(
$changed_element.data('hashed_field'),
$changed_element.data('new_row_index'),
$changed_element.closest('tr').find('span.column_type').html()
@@ -283,7 +282,7 @@ export function onloadTblChange () {
.data('new_row_index', new_row_index)
.on('click', function () {
var $changed_element = $(this);
- nullify(
+ TableChange.nullify(
$changed_element.siblings('.nullify_code').val(),
$this_element.closest('tr').find('input:hidden').first().val(),
$changed_element.data('hashed_field'),
diff --git a/js/src/tbl_chart.js b/js/src/tbl_chart.js
index 81849e4dd7..595ba0279d 100644
--- a/js/src/tbl_chart.js
+++ b/js/src/tbl_chart.js
@@ -1,4 +1,8 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
import { TableChartEnum,
drawChart,
onDataSeriesChange,
diff --git a/js/src/tbl_find_replace.js b/js/src/tbl_find_replace.js
index 3da67f242d..cee33430e6 100644
--- a/js/src/tbl_find_replace.js
+++ b/js/src/tbl_find_replace.js
@@ -1,4 +1,9 @@
-import { PMA_Messages as PMA_messages } from './variables/export_variables';
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
+import { PMA_Messages as messages } from './variables/export_variables';
import { PMA_prepareForAjaxRequest } from './functions/AjaxRequest';
import { PMA_ajaxRemoveMessage, PMA_ajaxShowMessage } from './utils/show_ajax_messages';
@@ -19,14 +24,14 @@ export function onloadTblFindReplace () {
.hide();
$('#toggle_find')
- .html(PMA_messages.strHideFindNReplaceCriteria)
+ .html(messages.strHideFindNReplaceCriteria)
.on('click', function () {
var $link = $(this);
$('#find_replace_form').slideToggle();
- if ($link.text() === PMA_messages.strHideFindNReplaceCriteria) {
- $link.text(PMA_messages.strShowFindNReplaceCriteria);
+ if ($link.text() === messages.strHideFindNReplaceCriteria) {
+ $link.text(messages.strShowFindNReplaceCriteria);
} else {
- $link.text(PMA_messages.strHideFindNReplaceCriteria);
+ $link.text(messages.strHideFindNReplaceCriteria);
}
return false;
});
diff --git a/js/src/tbl_operations.js b/js/src/tbl_operations.js
index 2845bab167..7c0eed08ef 100644
--- a/js/src/tbl_operations.js
+++ b/js/src/tbl_operations.js
@@ -1,4 +1,9 @@
-import { PMA_Messages as PMA_messages } from './variables/export_variables';
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
+import { PMA_Messages as messages } from './variables/export_variables';
import PMA_commonParams from './variables/common_params';
import { PMA_commonActions } from './classes/CommonActions';
import { PMA_ajaxShowMessage, PMA_ajaxRemoveMessage } from './utils/show_ajax_messages';
@@ -98,7 +103,7 @@ export function onloadTblOperations () {
var $tblCollationField = $form.find('select[name=tbl_collation]');
var collationOrigValue = $('select[name="tbl_collation"] option[selected]').val();
var $changeAllColumnCollationsCheckBox = $('#checkbox_change_all_collations');
- var question = PMA_messages.strChangeAllColumnCollationsWarning;
+ var question = messages.strChangeAllColumnCollationsWarning;
if ($tblNameField.val() !== $tblNameField[0].defaultValue) {
// reload page and navigation if the table has been renamed
@@ -210,18 +215,18 @@ export function onloadTblOperations () {
function submitPartitionMaintenance () {
var argsep = PMA_commonParams.get('arg_separator');
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
- PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
+ PMA_ajaxShowMessage(messages.strProcessingRequest);
AJAX.source = $form;
$.post($form.attr('action'), submitData, AJAX.responseHandler);
}
if ($('#partition_operation_DROP').is(':checked')) {
- let question = PMA_messages.strDropPartitionWarning;
+ let question = messages.strDropPartitionWarning;
$form.PMA_confirm(question, $form.attr('action'), function () {
submitPartitionMaintenance();
});
} else if ($('#partition_operation_TRUNCATE').is(':checked')) {
- let question = PMA_messages.strTruncatePartitionWarning;
+ let question = messages.strTruncatePartitionWarning;
$form.PMA_confirm(question, $form.attr('action'), function () {
submitPartitionMaintenance();
});
@@ -236,14 +241,14 @@ export function onloadTblOperations () {
/**
* @var question String containing the question to be asked for confirmation
*/
- var question = PMA_messages.strDropTableStrongWarning + ' ';
+ var question = messages.strDropTableStrongWarning + ' ';
question += PMA_sprintf(
- PMA_messages.strDoYouReally,
+ messages.strDoYouReally,
'DROP TABLE `' + escapeHtml(PMA_commonParams.get('db')) + '`.`' + escapeHtml(PMA_commonParams.get('table') + '`')
) + getForeignKeyCheckboxLoader();
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
- var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
+ var $msgbox = PMA_ajaxShowMessage(messages.strProcessingRequest);
var params = getJSConfirmCommonParam(this, $link.getPostData());
@@ -271,14 +276,14 @@ export function onloadTblOperations () {
/**
* @var question String containing the question to be asked for confirmation
*/
- var question = PMA_messages.strDropTableStrongWarning + ' ';
+ var question = messages.strDropTableStrongWarning + ' ';
question += PMA_sprintf(
- PMA_messages.strDoYouReally,
+ messages.strDoYouReally,
'DROP VIEW `' + escapeHtml(PMA_commonParams.get('table') + '`')
);
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
- var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
+ var $msgbox = PMA_ajaxShowMessage(messages.strProcessingRequest);
var params = {
'is_js_confirmed': '1',
'ajax_request': true
@@ -308,13 +313,13 @@ export function onloadTblOperations () {
/**
* @var question String containing the question to be asked for confirmation
*/
- var question = PMA_messages.strTruncateTableStrongWarning + ' ';
+ var question = messages.strTruncateTableStrongWarning + ' ';
question += PMA_sprintf(
- PMA_messages.strDoYouReally,
+ messages.strDoYouReally,
'TRUNCATE `' + escapeHtml(PMA_commonParams.get('db')) + '`.`' + escapeHtml(PMA_commonParams.get('table') + '`')
) + getForeignKeyCheckboxLoader();
$(this).PMA_confirm(question, $(this).attr('href'), function (url) {
- PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
+ PMA_ajaxShowMessage(messages.strProcessingRequest);
var params = getJSConfirmCommonParam(this, $link.getPostData());
diff --git a/js/src/tbl_relation.js b/js/src/tbl_relation.js
index 06afd6c2d6..cc61a8f38f 100644
--- a/js/src/tbl_relation.js
+++ b/js/src/tbl_relation.js
@@ -1,5 +1,9 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
-import { PMA_Messages as PMA_messages } from './variables/export_variables';
+
+/**
+ * Module import
+ */
+import { PMA_Messages as messages } from './variables/export_variables';
import { PMA_ajaxShowMessage, PMA_ajaxRemoveMessage } from './utils/show_ajax_messages';
import { escapeHtml } from './utils/Sanitise';
import { PMA_commonActions } from './classes/CommonActions';
@@ -112,10 +116,10 @@ export function onloadTblRelation () {
.val()
);
- var question = PMA_sprintf(PMA_messages.strDoYouReally, drop_query);
+ var question = PMA_sprintf(messages.strDoYouReally, drop_query);
$anchor.PMA_confirm(question, $anchor.attr('href'), function (url) {
- var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingForeignKey, false);
+ var $msg = PMA_ajaxShowMessage(messages.strDroppingForeignKey, false);
var params = getJSConfirmCommonParam(this, $anchor.getPostData());
$.post(url, params, function (data) {
if (data.success === true) {
@@ -124,7 +128,7 @@ export function onloadTblRelation () {
// Do nothing
});
} else {
- PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ' : ' + data.error, false);
+ PMA_ajaxShowMessage(messages.strErrorProcessingRequest + ' : ' + data.error, false);
}
}); // end $.post()
}); // end $.PMA_confirm()
diff --git a/js/src/tbl_select.js b/js/src/tbl_select.js
index e6082c84ad..1d5340c757 100644
--- a/js/src/tbl_select.js
+++ b/js/src/tbl_select.js
@@ -1,6 +1,10 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
+
+/**
+ * Module import
+ */
import { $ } from './utils/JqueryExtended';
-import { PMA_Messages as PMA_messages } from './variables/export_variables';
+import { PMA_Messages as messages } from './variables/export_variables';
import {
changeValueFieldType,
PMA_checkIfDataTypeNumericOrDate
@@ -10,7 +14,7 @@ import { PMA_prepareForAjaxRequest } from './functions/AjaxRequest';
import { PMA_init_slider } from './utils/Slider';
import { PMA_highlightSQL } from './utils/sql';
import { PMA_addDatepicker } from './utils/DateTime';
-import { PMA_commonParams } from './variables/common_params';
+import CommonParams from './variables/common_params';
/**
* @fileoverview JavaScript functions used on tbl_select.php
@@ -48,14 +52,14 @@ export function onloadTblSelect () {
.hide();
$('#togglesearchformlink')
- .html(PMA_messages.strShowSearchCriteria)
+ .html(messages.strShowSearchCriteria)
.on('click', function () {
var $link = $(this);
$('#tbl_search_form').slideToggle();
- if ($link.text() === PMA_messages.strHideSearchCriteria) {
- $link.text(PMA_messages.strShowSearchCriteria);
+ if ($link.text() === messages.strHideSearchCriteria) {
+ $link.text(messages.strShowSearchCriteria);
} else {
- $link.text(PMA_messages.strHideSearchCriteria);
+ $link.text(messages.strHideSearchCriteria);
}
// avoid default click action
return false;
@@ -92,7 +96,7 @@ export function onloadTblSelect () {
// empty previous search results while we are waiting for new results
$('#sqlqueryresultsouter').empty();
- var $msgbox = PMA_ajaxShowMessage(PMA_messages.strSearching, false);
+ var $msgbox = PMA_ajaxShowMessage(messages.strSearching, false);
PMA_prepareForAjaxRequest($search_form);
@@ -152,7 +156,7 @@ export function onloadTblSelect () {
.hide();
$('#togglesearchformlink')
// always start with the Show message
- .text(PMA_messages.strShowSearchCriteria);
+ .text(messages.strShowSearchCriteria);
$('#togglesearchformdiv')
// now it's time to show the div containing the link
.show();
@@ -285,7 +289,7 @@ export function onloadTblSelect () {
url: 'tbl_select.php',
type: 'POST',
data: {
- server: PMA_commonParams.get('server'),
+ server: CommonParams.get('server'),
ajax_request: 1,
db: $('input[name="db"]').val(),
table: $('input[name="table"]').val(),
@@ -297,16 +301,16 @@ export function onloadTblSelect () {
if (response.success) {
// Get the column min value.
var min = response.column_data.min
- ? '(' + PMA_messages.strColumnMin +
+ ? '(' + messages.strColumnMin +
' ' + response.column_data.min + ')'
: '';
// Get the column max value.
var max = response.column_data.max
- ? '(' + PMA_messages.strColumnMax +
+ ? '(' + messages.strColumnMax +
' ' + response.column_data.max + ')'
: '';
var button_options = {};
- button_options[PMA_messages.strGo] = function () {
+ button_options[messages.strGo] = function () {
var min_value = $('#min_value').val();
var max_value = $('#max_value').val();
var final_value = '';
@@ -347,7 +351,7 @@ export function onloadTblSelect () {
}
$(this).dialog('close');
};
- button_options[PMA_messages.strCancel] = function () {
+ button_options[messages.strCancel] = function () {
$(this).dialog('close');
};
@@ -355,11 +359,11 @@ export function onloadTblSelect () {
$('').append(
'