Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiyush Vijay <piyushvijay.1997@gmail.com>2018-08-17 11:27:21 +0300
committerPiyush Vijay <piyushvijay.1997@gmail.com>2018-08-17 11:27:21 +0300
commitc0856b231076082da3f4fd8eacbc929b82b4ff4f (patch)
treecf77fe3a35c614b33c3cf8820474de50275d1d30
parentbfc9d62d4350523c066ceed21659a7ac208ac24c (diff)
Resolve merge conflicts and some code cleanup for functions.js
Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
-rw-r--r--js/functions.js190
-rw-r--r--js/src/db_central_columns.js2
-rw-r--r--js/src/db_tracking.js2
3 files changed, 2 insertions, 192 deletions
diff --git a/js/functions.js b/js/functions.js
index 49708ff9dc..5d39f13830 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -2694,196 +2694,6 @@ AJAX.registerTeardown('functions.js', function () {
});
/**
- * jQuery coding for 'Create Table'. Used on db_operations.php,
- * db_structure.php and db_tracking.php (i.e., wherever
- * PhpMyAdmin\Display\CreateTable is used)
- *
- * Attach Ajax Event handlers for Create Table
- */
-AJAX.registerOnload('functions.js', function () {
- /**
- * Attach event handler for submission of create table form (save)
- */
- $(document).on('submit', 'form.create_table_form.ajax', function (event) {
- event.preventDefault();
-
- /**
- * @var the_form object referring to the create table form
- */
- var $form = $(this);
-
- /*
- * First validate the form; if there is a problem, avoid submitting it
- *
- * checkTableEditForm() needs a pure element and not a jQuery object,
- * this is why we pass $form[0] as a parameter (the jQuery object
- * is actually an array of DOM elements)
- */
-
- if (checkTableEditForm($form[0], $form.find('input[name=orig_num_fields]').val())) {
- PMA_prepareForAjaxRequest($form);
- if (PMA_checkReservedWordColumns($form)) {
- PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
- // User wants to submit the form
- $.post($form.attr('action'), $form.serialize() + PMA_commonParams.get('arg_separator') + 'do_save_data=1', function (data) {
- if (typeof data !== 'undefined' && data.success === true) {
- $('#properties_message')
- .removeClass('error')
- .html('');
- PMA_ajaxShowMessage(data.message);
- // Only if the create table dialog (distinct panel) exists
- var $createTableDialog = $('#create_table_dialog');
- if ($createTableDialog.length > 0) {
- $createTableDialog.dialog('close').remove();
- }
- $('#tableslistcontainer').before(data.formatted_sql);
-
- /**
- * @var tables_table Object referring to the <tbody> element that holds the list of tables
- */
- var tables_table = $('#tablesForm').find('tbody').not('#tbl_summary_row');
- // this is the first table created in this db
- if (tables_table.length === 0) {
- PMA_commonActions.refreshMain(
- PMA_commonParams.get('opendb_url')
- );
- } else {
- /**
- * @var curr_last_row Object referring to the last <tr> element in {@link tables_table}
- */
- var curr_last_row = $(tables_table).find('tr:last');
- /**
- * @var curr_last_row_index_string String containing the index of {@link curr_last_row}
- */
- var curr_last_row_index_string = $(curr_last_row).find('input:checkbox').attr('id').match(/\d+/)[0];
- /**
- * @var curr_last_row_index Index of {@link curr_last_row}
- */
- var curr_last_row_index = parseFloat(curr_last_row_index_string);
- /**
- * @var new_last_row_index Index of the new row to be appended to {@link tables_table}
- */
- var new_last_row_index = curr_last_row_index + 1;
- /**
- * @var new_last_row_id String containing the id of the row to be appended to {@link tables_table}
- */
- var new_last_row_id = 'checkbox_tbl_' + new_last_row_index;
-
- data.new_table_string = data.new_table_string.replace(/checkbox_tbl_/, new_last_row_id);
- // append to table
- $(data.new_table_string)
- .appendTo(tables_table);
-
- // Sort the table
- $(tables_table).PMA_sort_table('th');
-
- // Adjust summary row
- PMA_adjustTotals();
- }
-
- // Refresh navigation as a new table has been added
- PMA_reloadNavigation();
- // Redirect to table structure page on creation of new table
- var argsep = PMA_commonParams.get('arg_separator');
- var params_12 = 'ajax_request=true' + argsep + 'ajax_page_request=true';
- if (! (history && history.pushState)) {
- params_12 += PMA_MicroHistory.menus.getRequestParam();
- }
- tblStruct_url = 'tbl_structure.php?server=' + data._params.server +
- argsep + 'db=' + data._params.db + argsep + 'token=' + data._params.token +
- argsep + 'goto=db_structure.php' + argsep + 'table=' + data._params.table + '';
- $.get(tblStruct_url, params_12, AJAX.responseHandler);
- } else {
- PMA_ajaxShowMessage(
- '<div class="error">' + data.error + '</div>',
- false
- );
- }
- }); // end $.post()
- }
- } // end if (checkTableEditForm() )
- }); // end create table form (save)
-
- /**
- * Submits the intermediate changes in the table creation form
- * to refresh the UI accordingly
- */
- function submitChangesInCreateTableForm (actionParam) {
- /**
- * @var the_form object referring to the create table form
- */
- var $form = $('form.create_table_form.ajax');
-
- var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
- PMA_prepareForAjaxRequest($form);
-
- // User wants to add more fields to the table
- $.post($form.attr('action'), $form.serialize() + '&' + actionParam, function (data) {
- if (typeof data !== 'undefined' && data.success) {
- var $pageContent = $('#page_content');
- $pageContent.html(data.message);
- PMA_highlightSQL($pageContent);
- PMA_verifyColumnsProperties();
- PMA_hideShowConnection($('.create_table_form select[name=tbl_storage_engine]'));
- PMA_ajaxRemoveMessage($msgbox);
- } else {
- PMA_ajaxShowMessage(data.error);
- }
- }); // end $.post()
- }
-
- /**
- * Attach event handler for create table form (add fields)
- */
- $(document).on('click', 'form.create_table_form.ajax input[name=submit_num_fields]', function (event) {
- event.preventDefault();
- submitChangesInCreateTableForm('submit_num_fields=1');
- }); // end create table form (add fields)
-
- $(document).on('keydown', 'form.create_table_form.ajax input[name=added_fields]', function (event) {
- if (event.keyCode === 13) {
- event.preventDefault();
- event.stopImmediatePropagation();
- $(this)
- .closest('form')
- .find('input[name=submit_num_fields]')
- .trigger('click');
- }
- });
-
- /**
- * Attach event handler to manage changes in number of partitions and subpartitions
- */
- $(document).on('change', 'input[name=partition_count],input[name=subpartition_count],select[name=partition_by]', function (event) {
- $this = $(this);
- $form = $this.parents('form');
- if ($form.is('.create_table_form.ajax')) {
- submitChangesInCreateTableForm('submit_partition_change=1');
- } else {
- $form.submit();
- }
- });
-
- $(document).on('change', 'input[value=AUTO_INCREMENT]', function () {
- if (this.checked) {
- var col = /\d/.exec($(this).attr('name'));
- col = col[0];
- var $selectFieldKey = $('select[name="field_key[' + col + ']"]');
- if ($selectFieldKey.val() === 'none_' + col) {
- $selectFieldKey.val('primary_' + col).trigger('change');
- }
- }
- });
- $('body')
- .off('click', 'input.preview_sql')
- .on('click', 'input.preview_sql', function () {
- var $form = $(this).closest('form');
- PMA_previewSQL($form);
- });
-});
-
-
-/**
* Validates the password field in a form
*
* @see PMA_messages.strPasswordEmpty
diff --git a/js/src/db_central_columns.js b/js/src/db_central_columns.js
index 5b36c34407..cd92967974 100644
--- a/js/src/db_central_columns.js
+++ b/js/src/db_central_columns.js
@@ -1,5 +1,5 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
-import { $ } from './utils/extend_jquery';
+import { $ } from './utils/JqueryExtended';
import './plugins/jquery/jquery.tablesorter';
import { PMA_Messages as PMA_messages } from './variables/export_variables';
import { PMA_ajaxShowMessage } from './utils/show_ajax_messages';
diff --git a/js/src/db_tracking.js b/js/src/db_tracking.js
index ffbe4b4050..a61dbd124f 100644
--- a/js/src/db_tracking.js
+++ b/js/src/db_tracking.js
@@ -1,4 +1,4 @@
-import { $ } from './utils/extend_jquery';
+import { $ } from './utils/JqueryExtended';
import './plugins/jquery/jquery.tablesorter';
import PMA_commonParams from './variables/common_params';
import { PMA_Messages as PMA_messages } from './variables/export_variables';