Merge pull request #1572 from tapanhalani/master
Fix Feature#1609- Lock page navigation when entering data.
This commit is contained in:
commit
c326cc9542
41
js/ajax.js
41
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');
|
||||
});
|
||||
|
||||
@ -1424,7 +1424,7 @@ class PMA_DbQbe
|
||||
*/
|
||||
public function getSelectionForm()
|
||||
{
|
||||
$html_output = '<form action="db_qbe.php" method="post" id="formQBE">';
|
||||
$html_output = '<form action="db_qbe.php" method="post" id="formQBE" class="lock-page">';
|
||||
$html_output .= '<fieldset>';
|
||||
|
||||
if ($GLOBALS['cfgRelation']['savedsearcheswork']) {
|
||||
@ -1452,7 +1452,7 @@ class PMA_DbQbe
|
||||
// get tables select list
|
||||
$html_output .= $this->_getTablesList();
|
||||
$html_output .= '</form>';
|
||||
$html_output .= '<form action="db_qbe.php" method="post">';
|
||||
$html_output .= '<form action="db_qbe.php" method="post" class="lock-page">';
|
||||
$html_output .= PMA_URL_getHiddenInputs(array('db' => $this->_db));
|
||||
// get SQL query
|
||||
$html_output .= '<div class="floatleft">';
|
||||
|
||||
@ -380,7 +380,7 @@ class PMA_DbSearch
|
||||
{
|
||||
$html_output = '<a id="db_search"></a>';
|
||||
$html_output .= '<form id="db_search_form"'
|
||||
. ' class="ajax"'
|
||||
. ' class="ajax lock-page"'
|
||||
. ' method="post" action="db_search.php" name="db_search">';
|
||||
$html_output .= PMA_URL_getHiddenInputs($GLOBALS['db']);
|
||||
$html_output .= '<fieldset>';
|
||||
|
||||
@ -1152,7 +1152,7 @@ class PMA_TableSearch
|
||||
|
||||
$html_output .= '<form method="post" action="' . $scriptName . '" '
|
||||
. 'name="insertForm" id="' . $formId . '" '
|
||||
. 'class="ajax"' . '>';
|
||||
. 'class="ajax lock-page"' . '>';
|
||||
|
||||
$html_output .= PMA_URL_getHiddenInputs($this->_db, $this->_table);
|
||||
$html_output .= '<input type="hidden" name="goto" value="' . $goto . '" />';
|
||||
|
||||
@ -45,7 +45,7 @@ $is_create_table_priv = true;
|
||||
function PMA_getHtmlForCreateTable($db)
|
||||
{
|
||||
$html = '<form id="create_table_form_minimal" method="post" '
|
||||
. 'action="tbl_create.php">';
|
||||
. 'action="tbl_create.php" class="lock-page">';
|
||||
$html .= '<fieldset>';
|
||||
$html .= '<legend>';
|
||||
|
||||
|
||||
@ -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(
|
||||
'<a id="db_search"></a><form id="db_search_form" class="ajax" '
|
||||
'<a id="db_search"></a><form id="db_search_form" class="ajax lock-page" '
|
||||
. 'method="post" action="db_search.php" name="db_search">'
|
||||
. '<input type="hidden" name="db" value="pma" />'
|
||||
. '<input type="hidden" name="lang" value="en" />'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user