diff --git a/js/ajax.js b/js/ajax.js index 91abbcaa30..094760ceec 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -153,7 +153,11 @@ var AJAX = { * @todo Fix Code mirror does not give correct full value (query) * in textarea, it returns only the change in content. */ - var newHash = AJAX.hash($(this).val()); + if (event.data.value == 1) { + var newHash = AJAX.hash($(this).val()); + } else { + var newHash = AJAX.hash($(this).is(":checked")); + } var oldHash = $(this).data('val-hash'); // Set lock if old value != new value // otherwise release lock @@ -432,16 +436,25 @@ var AJAX = { } AJAX._callback = function () {}; }); - // initializes all lock-page elements lock-id and - // val-hash data property + // initializes lock-page elements (textarea, input types text and number, + // and select) lock-id and val-hash data property $('#page_content form.lock-page textarea, ' + - '#page_content form.lock-page input[type="text"]').each(function(i){ + '#page_content form.lock-page input[type="text"], '+ + '#page_content form.lock-page input[type="number"], '+ + '#page_content form.lock-page select').each(function(i){ $(this).data('lock-id', i); // val-hash is the hash of default value of the field // so that it can be compared with new value hash // to check whether field was modified or not. $(this).data('val-hash', AJAX.hash($(this).val())); }); + // initializes lock-page elements (input types checkbox and radio buttons) + // lock-id and val-hash data property + $('#page_content form.lock-page input[type="checkbox"], ' + + '#page_content form.lock-page input[type="radio"]').each(function(i){ + $(this).data('lock-id', i); + $(this).data('val-hash', AJAX.hash($(this).is(":checked"))); + }); } else { PMA_ajaxShowMessage(data.error, false); AJAX.active = false; @@ -623,12 +636,22 @@ AJAX.registerOnload('functions.js', function () { /** * Attach event listener to events when user modify visible - * Input or Textarea fields to make changes in forms + * Input,Textarea and select fields to make changes in forms */ $('#page_content').on( 'keyup change', 'form.lock-page textarea, ' + - 'form.lock-page input[type="text"]', + 'form.lock-page input[type="text"], ' + + 'form.lock-page input[type="number"], ' + + 'form.lock-page select', + {value:1}, + AJAX.lockPageHandler + ); + $('#page_content').on( + 'change', + 'form.lock-page input[type="checkbox"], ' + + 'form.lock-page input[type="radio"]', + {value:2}, AJAX.lockPageHandler ); /** @@ -647,7 +670,11 @@ AJAX.registerOnload('functions.js', function () { AJAX.registerTeardown('functions.js', function () { $('#page_content').off('keyup change', 'form.lock-page textarea, ' + - 'form.lock-page input[type="text"]' + 'form.lock-page input[type="text"], ' + + 'form.lock-page input[type="number"], ' + + 'form.lock-page select, ' + + 'form.lock-page input[type="checkbox"], ' + + 'form.lock-page input[type="radio"]' ); $('form.lock-page').off('reset'); }); diff --git a/libraries/DBQbe.class.php b/libraries/DBQbe.class.php index 085ae10006..a48025fc37 100644 --- a/libraries/DBQbe.class.php +++ b/libraries/DBQbe.class.php @@ -1424,7 +1424,7 @@ class PMA_DbQbe */ public function getSelectionForm() { - $html_output = '
'; + $html_output = ''; $html_output .= '
'; if ($GLOBALS['cfgRelation']['savedsearcheswork']) { @@ -1452,7 +1452,7 @@ class PMA_DbQbe // get tables select list $html_output .= $this->_getTablesList(); $html_output .= ''; - $html_output .= '
'; + $html_output .= ''; $html_output .= PMA_URL_getHiddenInputs(array('db' => $this->_db)); // get SQL query $html_output .= '
'; diff --git a/libraries/DbSearch.class.php b/libraries/DbSearch.class.php index 30e30d2a66..ab62901426 100644 --- a/libraries/DbSearch.class.php +++ b/libraries/DbSearch.class.php @@ -380,7 +380,7 @@ class PMA_DbSearch { $html_output = ''; $html_output .= ''; $html_output .= PMA_URL_getHiddenInputs($GLOBALS['db']); $html_output .= '
'; diff --git a/libraries/TableSearch.class.php b/libraries/TableSearch.class.php index bda58fbc59..51f57d4814 100644 --- a/libraries/TableSearch.class.php +++ b/libraries/TableSearch.class.php @@ -1152,7 +1152,7 @@ class PMA_TableSearch $html_output .= ''; + . 'class="ajax lock-page"' . '>'; $html_output .= PMA_URL_getHiddenInputs($this->_db, $this->_table); $html_output .= ''; diff --git a/libraries/display_create_table.lib.php b/libraries/display_create_table.lib.php index 0562d442ba..7e0605481e 100644 --- a/libraries/display_create_table.lib.php +++ b/libraries/display_create_table.lib.php @@ -45,7 +45,7 @@ $is_create_table_priv = true; function PMA_getHtmlForCreateTable($db) { $html = ''; + . 'action="tbl_create.php" class="lock-page">'; $html .= '
'; $html .= ''; diff --git a/test/classes/PMA_DbSearch_test.php b/test/classes/PMA_DbSearch_test.php index d9cd47ff6c..fa4f42f673 100644 --- a/test/classes/PMA_DbSearch_test.php +++ b/test/classes/PMA_DbSearch_test.php @@ -201,7 +201,7 @@ class PMA_DbSearch_Test extends PHPUnit_Framework_TestCase $_SESSION['PMA_Theme'] = new PMA_Theme(); $GLOBALS['pmaThemeImage'] = 'themes/dot.gif'; $this->assertEquals( - '' . '' . ''