From aff4046fdd54e636cc2617c6eae3251cc4064863 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Thu, 27 Nov 2014 16:58:20 +0530 Subject: [PATCH 01/29] Update getCheckbox to add id field. Remove id field from profiling checkbox Signed-off-by: Madhura Jayaratne --- libraries/DisplayResults.class.php | 9 ++++++--- libraries/TableSearch.class.php | 3 ++- libraries/Util.class.php | 16 ++++++++++------ libraries/server_privileges.lib.php | 7 ++++--- test/libraries/PMA_server_privileges_test.php | 2 +- test/libraries/common/PMA_getCheckbox_test.php | 8 ++++---- 6 files changed, 27 insertions(+), 18 deletions(-) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 49aa2fd6bb..d31cfb89c3 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -1661,12 +1661,14 @@ class PMA_DisplayResults $options_html .= '
' . PMA_Util::getCheckbox( 'display_binary', __('Show binary contents'), - ! empty($_SESSION['tmpval']['display_binary']), false + ! empty($_SESSION['tmpval']['display_binary']), false, + 'display_binary' ) . '
' . PMA_Util::getCheckbox( 'display_blob', __('Show BLOB contents'), - ! empty($_SESSION['tmpval']['display_blob']), false + ! empty($_SESSION['tmpval']['display_blob']), false, + 'display_blob' ) . '
'; @@ -1677,7 +1679,8 @@ class PMA_DisplayResults $options_html .= '
' . PMA_Util::getCheckbox( 'hide_transformation', __('Hide browser transformation'), - ! empty($_SESSION['tmpval']['hide_transformation']), false + ! empty($_SESSION['tmpval']['hide_transformation']), false, + 'hide_transformation' ) . '
'; diff --git a/libraries/TableSearch.class.php b/libraries/TableSearch.class.php index ca5f13dba4..08cd599a13 100644 --- a/libraries/TableSearch.class.php +++ b/libraries/TableSearch.class.php @@ -1369,7 +1369,8 @@ class PMA_TableSearch 'useRegex', __('Use regular expression'), false, - false + false, + 'useRegex' ); return $htmlOutput; } diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 47dee4bf50..fd93109269 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -2605,15 +2605,19 @@ class PMA_Util * @param string $label label for checkbox * @param boolean $checked is it initially checked? * @param boolean $onclick should it submit the form on click? + * @param string $html_field_id id for the checkbox * * @return string HTML for the checkbox */ - public static function getCheckbox($html_field_name, $label, $checked, $onclick) - { - return ''; + public static function getCheckbox( + $html_field_name, $label, $checked, $onclick, $html_field_id = '' + ) { + return '' + . '' . $label . ''; } /** diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 0a56668315..a8123a558e 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -1757,13 +1757,13 @@ function PMA_getHtmlForAddUser($dbname) $html_output .= PMA_Util::getCheckbox( 'createdb-1', __('Create database with same name and grant all privileges.'), - false, false + false, false, 'createdb-1' ); $html_output .= '
' . "\n"; $html_output .= PMA_Util::getCheckbox( 'createdb-2', __('Grant all privileges on wildcard name (username\\_%).'), - false, false + false, false, 'createdb-2' ); $html_output .= '
' . "\n"; @@ -1775,7 +1775,8 @@ function PMA_getHtmlForAddUser($dbname) htmlspecialchars($dbname) ), true, - false + false, + 'createdb-3' ); $html_output .= '' . "\n"; diff --git a/test/libraries/PMA_server_privileges_test.php b/test/libraries/PMA_server_privileges_test.php index 3e628728cf..1e252531af 100644 --- a/test/libraries/PMA_server_privileges_test.php +++ b/test/libraries/PMA_server_privileges_test.php @@ -1200,7 +1200,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $item = PMA_Util::getCheckbox( 'createdb-2', __('Grant all privileges on wildcard name (username\\_%).'), - false, false + false, false, 'createdb-2' ); $this->assertContains( $item, diff --git a/test/libraries/common/PMA_getCheckbox_test.php b/test/libraries/common/PMA_getCheckbox_test.php index 340c3b61de..ba5349e215 100644 --- a/test/libraries/common/PMA_getCheckbox_test.php +++ b/test/libraries/common/PMA_getCheckbox_test.php @@ -31,7 +31,7 @@ class PMA_GetCheckboxTest extends PHPUnit_Framework_TestCase $label = "text_label_for_checkbox"; $this->assertEquals( - PMA_Util::getCheckbox($name, $label, false, false), + PMA_Util::getCheckbox($name, $label, false, false, $name), '' @@ -49,7 +49,7 @@ class PMA_GetCheckboxTest extends PHPUnit_Framework_TestCase $label = "text_label_for_checkbox"; $this->assertEquals( - PMA_Util::getCheckbox($name, $label, true, false), + PMA_Util::getCheckbox($name, $label, true, false, $name), '' @@ -67,7 +67,7 @@ class PMA_GetCheckboxTest extends PHPUnit_Framework_TestCase $label = "text_label_for_checkbox"; $this->assertEquals( - PMA_Util::getCheckbox($name, $label, false, true), + PMA_Util::getCheckbox($name, $label, false, true, $name), '' @@ -85,7 +85,7 @@ class PMA_GetCheckboxTest extends PHPUnit_Framework_TestCase $label = "text_label_for_checkbox"; $this->assertEquals( - PMA_Util::getCheckbox($name, $label, true, true), + PMA_Util::getCheckbox($name, $label, true, true, $name), '' From ff393b207e459874dcfc070e728aec026b7f6f9d Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Thu, 27 Nov 2014 17:05:06 +0530 Subject: [PATCH 02/29] Remove id field from displayOptionsForm Signed-off-by: Madhura Jayaratne --- js/sql.js | 4 ++-- libraries/DisplayResults.class.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/js/sql.js b/js/sql.js index ae969f0b2b..e9838f139b 100644 --- a/js/sql.js +++ b/js/sql.js @@ -95,7 +95,7 @@ AJAX.registerTeardown('sql.js', function () { $("input[name=navig].ajax").die('click'); $("#pageselector").die('change'); $("#table_results.ajax").find("a[title=Sort]").die('click'); - $("#displayOptionsForm.ajax").die('submit'); + $(".displayOptionsForm.ajax").die('submit'); $('th.column_heading.pointer').die('hover'); $('th.column_heading.marker').die('click'); $(window).unbind('scroll'); @@ -389,7 +389,7 @@ AJAX.registerOnload('sql.js', function () { * @memberOf jQuery * @name displayOptionsForm_submit */ - $("#displayOptionsForm.ajax").live('submit', function (event) { + $(".displayOptionsForm.ajax").live('submit', function (event) { event.preventDefault(); $form = $(this); diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index d31cfb89c3..57cfbb1f30 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -1608,8 +1608,7 @@ class PMA_DisplayResults $options_html = ''; $options_html .= '
Date: Thu, 27 Nov 2014 17:19:53 +0530 Subject: [PATCH 03/29] Remove id from display options slider Signed-off-by: Madhura Jayaratne --- libraries/DisplayResults.class.php | 2 +- libraries/Util.class.php | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 57cfbb1f30..0c72fc7b54 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -1624,7 +1624,7 @@ class PMA_DisplayResults $options_html .= PMA_URL_getHiddenInputs($url_params) . '
' . PMA_Util::getDivForSliderEffect( - 'displayoptions', __('Options') + '', __('Options') ) . '
'; diff --git a/libraries/Util.class.php b/libraries/Util.class.php index fd93109269..c06d7755da 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -2722,10 +2722,10 @@ class PMA_Util * @return string html div element * */ - public static function getDivForSliderEffect($id, $message) + public static function getDivForSliderEffect($id = '', $message = '') { if ($GLOBALS['cfg']['InitialSlidersState'] == 'disabled') { - return '
'; + return ''; } /** * Bad hack on the next line. document.write() conflicts with jQuery, @@ -2736,11 +2736,14 @@ class PMA_Util * append to */ - return '