From 9b56acacabefe6e3248155e3b5793cc78ca71e6f Mon Sep 17 00:00:00 2001 From: ankitjain28may Date: Fri, 22 Sep 2017 20:08:25 +0530 Subject: [PATCH] Fix alignment of action and fixed tests #12167 Signed-off-by: Ankit Jain --- libraries/classes/Display/Results.php | 74 +++++++++-------- .../structure/body_for_table_summary.phtml | 20 ++--- .../structure/structure_table_row.phtml | 80 ++++++++++--------- .../database/structure/table_header.phtml | 6 +- test/selenium/PmaSeleniumSqlQueryTest.php | 8 +- test/selenium/PmaSeleniumTableBrowseTest.php | 46 +++++------ test/selenium/PmaSeleniumTableInsertTest.php | 18 ++--- .../PmaSeleniumTableOperationsTest.php | 2 +- 8 files changed, 134 insertions(+), 120 deletions(-) diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index b7c4d49da3..d6158d7320 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -1329,21 +1329,16 @@ class Results $displayParts['del_lnk'] ); - // 1. Set $colspan and generate html with full/partial - // text button or link - list($colspan, $button_html) - = $this->_getFieldVisibilityParams( - $displayParts, $full_or_partial_text_link - ); + $table_headers_html .= '' . "\n"; - $table_headers_html .= $button_html; - // 2. Displays the fields' name - // 2.0 If sorting links should be used, checks if the query is a "JOIN" + // 1. Displays the fields' name + // 1.0 If sorting links should be used, checks if the query is a "JOIN" // statement (see 2.1.3) // See if we have to highlight any header fields of a WHERE query. // Uses SQL-Parser results. + $this->_setHighlightedColumnGlobalField($analyzed_sql_results); // Get the headers for all of the columns @@ -1353,6 +1348,17 @@ class Results $is_limited_display, $unsorted_sql_query ); + // 2. Set $colspan and generate html with full/partial + // text button or link + list($colspan, $button_html) + = $this->_getFieldVisibilityParams( + $displayParts, $full_or_partial_text_link + ); + + $table_headers_html .= $button_html; + + + // Display column at rightside - checkboxes or empty column if (! $printview) { $table_headers_html .= $this->_getColumnAtRightSide( @@ -1524,7 +1530,7 @@ class Results $display_params = $this->__get('display_params'); // 1. Displays the full/partial text button (part 1)... - $button_html .= '' . "\n"; + // $button_html .= '' . "\n"; $colspan = (($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE) && ($displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE)) @@ -2770,7 +2776,25 @@ class Results $del_url = $del_str = $edit_anchor_class = $edit_str = $js_conf = $copy_url = $copy_str = $edit_url = null; - // 1.2 Defines the URLs for the modify/delete link(s) + // 1.2 Displays the rows' values + if (is_null($this->__get('mime_map'))) { + $this->_setMimeMap(); + } + $table_body_html .= $this->_getRowValues( + $dt_result, + $row, + $row_no, + $col_order, + $map, + $grid_edit_class, + $col_visib, + $url_sql_query, + $analyzed_sql_results + ); // end (1) + + // 2 Defines the Action + + // 2.1 Defines the URLs for the modify/delete link(s) if (($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE) || ($displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE) @@ -2798,7 +2822,7 @@ class Results $where_clause_html = htmlspecialchars($where_clause); - // 1.2.1 Modify link(s) - update row case + // 2.1.1 Modify link(s) - update row case if ($displayParts['edit_lnk'] == self::UPDATE_ROW) { list($edit_url, $copy_url, $edit_str, $copy_str, @@ -2808,9 +2832,9 @@ class Results $clause_is_unique, $url_sql_query ); - } // end if (1.2.1) + } // end if (2.1.1) - // 1.2.2 Delete/Kill link(s) + // 2.1.2 Delete/Kill link(s) list($del_url, $del_str, $js_conf) = $this->_getDeleteAndKillLinks( $where_clause, $clause_is_unique, @@ -2818,7 +2842,7 @@ class Results $row ); - // 1.3 Displays the links at left if required + // 2.1.3 Displays the links at left if required if (($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_LEFT) || ($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_BOTH) ) { @@ -2839,24 +2863,10 @@ class Results $edit_str, $copy_str, $del_str, $js_conf ); - } // end if (1.3) - } // end if (1) + } // end if (2.1.3) + } // end if (2) + - // 2. Displays the rows' values - if (is_null($this->__get('mime_map'))) { - $this->_setMimeMap(); - } - $table_body_html .= $this->_getRowValues( - $dt_result, - $row, - $row_no, - $col_order, - $map, - $grid_edit_class, - $col_visib, - $url_sql_query, - $analyzed_sql_results - ); // 3. Displays the modify/delete links on the right if required if (($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE) diff --git a/templates/database/structure/body_for_table_summary.phtml b/templates/database/structure/body_for_table_summary.phtml index 56778860b0..e0b0ad270d 100644 --- a/templates/database/structure/body_for_table_summary.phtml +++ b/templates/database/structure/body_for_table_summary.phtml @@ -6,15 +6,7 @@ printf(_ngettext('%s table', '%s tables', $num_tables), PhpMyAdmin\Util::formatNumber($num_tables, 0)); ?> - - - - - + + + + + + + diff --git a/templates/database/structure/structure_table_row.phtml b/templates/database/structure/structure_table_row.phtml index 7335eb2416..8c0f300cfb 100644 --- a/templates/database/structure/structure_table_row.phtml +++ b/templates/database/structure/structure_table_row.phtml @@ -17,46 +17,7 @@ - - 0): ?> - - render( - array( - 'db' => $db, - 'current_table' => $current_table, - 'titles' => $titles, - 'already_favorite' => $already_favorite - ) - ); ?> - - - - - - - - - - - - - - - - - - - - - - - - - @@ -116,6 +77,47 @@ + + 0): ?> + + render( + array( + 'db' => $db, + 'current_table' => $current_table, + 'titles' => $titles, + 'already_favorite' => $already_favorite + ) + ); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + 1)): ?> diff --git a/templates/database/structure/table_header.phtml b/templates/database/structure/table_header.phtml index 4d8871aafd..45e5772684 100644 --- a/templates/database/structure/table_header.phtml +++ b/templates/database/structure/table_header.phtml @@ -27,9 +27,6 @@ if ($GLOBALS['cfg']['NumFavoriteTables'] > 0) { - - - render( @@ -78,6 +75,9 @@ if ($GLOBALS['cfg']['NumFavoriteTables'] > 0) { ) ); $cnt++; ?> + + + render( diff --git a/test/selenium/PmaSeleniumSqlQueryTest.php b/test/selenium/PmaSeleniumSqlQueryTest.php index 436b63f2c6..b121a13f86 100644 --- a/test/selenium/PmaSeleniumSqlQueryTest.php +++ b/test/selenium/PmaSeleniumSqlQueryTest.php @@ -148,19 +148,19 @@ class PMA_SeleniumSqlQueryTest extends PMA_SeleniumBase $this->waitForElement('byCssSelector', 'table.table_results'); $this->assertEquals( 3, - $this->getCellByTableClass('table_results', 1, 5) + $this->getCellByTableClass('table_results', 1, 1) ); $this->assertEquals( 4, - $this->getCellByTableClass('table_results', 2, 5) + $this->getCellByTableClass('table_results', 2, 1) ); $this->assertEquals( 4, - $this->getCellByTableClass('table_results', 1, 6) + $this->getCellByTableClass('table_results', 1, 2) ); $this->assertEquals( 5, - $this->getCellByTableClass('table_results', 2, 6) + $this->getCellByTableClass('table_results', 2, 2) ); // test inline edit button diff --git a/test/selenium/PmaSeleniumTableBrowseTest.php b/test/selenium/PmaSeleniumTableBrowseTest.php index 69473e004d..80ac7c3280 100644 --- a/test/selenium/PmaSeleniumTableBrowseTest.php +++ b/test/selenium/PmaSeleniumTableBrowseTest.php @@ -72,17 +72,17 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase $this->assertEquals( "1", - $this->getCellByTableClass('table_results', 1, 5) + $this->getCellByTableClass('table_results', 1, 1) ); $this->assertEquals( "3", - $this->getCellByTableClass('table_results', 2, 5) + $this->getCellByTableClass('table_results', 2, 1) ); $this->assertEquals( "2", - $this->getCellByTableClass('table_results', 3, 5) + $this->getCellByTableClass('table_results', 3, 1) ); // case 2 @@ -91,37 +91,37 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase $this->assertEquals( "2", - $this->getCellByTableClass('table_results', 1, 5) + $this->getCellByTableClass('table_results', 1, 1) ); $this->assertEquals( "1", - $this->getCellByTableClass('table_results', 2, 5) + $this->getCellByTableClass('table_results', 2, 1) ); $this->assertEquals( "3", - $this->getCellByTableClass('table_results', 3, 5) + $this->getCellByTableClass('table_results', 3, 1) ); // case 2 $this->byLinkText("datetimefield")->click(); $this->waitAjax(); - $this->getCellByTableClass('table_results', 1, 5); + $this->getCellByTableClass('table_results', 1, 1); $this->assertEquals( "3", - $this->getCellByTableClass('table_results', 1, 5) + $this->getCellByTableClass('table_results', 1, 1) ); $this->assertEquals( "1", - $this->getCellByTableClass('table_results', 2, 5) + $this->getCellByTableClass('table_results', 2, 1) ); $this->assertEquals( "2", - $this->getCellByTableClass('table_results', 3, 5) + $this->getCellByTableClass('table_results', 3, 1) ); // case 4 @@ -130,17 +130,17 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase $this->assertEquals( "2", - $this->getCellByTableClass('table_results', 1, 5) + $this->getCellByTableClass('table_results', 1, 1) ); $this->assertEquals( "1", - $this->getCellByTableClass('table_results', 2, 5) + $this->getCellByTableClass('table_results', 2, 1) ); $this->assertEquals( "3", - $this->getCellByTableClass('table_results', 3, 5) + $this->getCellByTableClass('table_results', 3, 1) ); } @@ -154,7 +154,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase public function testChangeRecords() { $ele = $this->byCssSelector( - "table.table_results tbody tr:nth-child(2) td:nth-child(2)" + "table.table_results tbody tr:nth-child(2) td:nth-child(5)" ); $this->moveto($ele); $this->click(); @@ -195,12 +195,12 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase $this->assertEquals( "foobar", - $this->getCellByTableClass('table_results', 2, 6) + $this->getCellByTableClass('table_results', 2, 2) ); $this->assertEquals( "2009-01-02 00:00:00", - $this->getCellByTableClass('table_results', 2, 7) + $this->getCellByTableClass('table_results', 2, 3) ); } @@ -214,7 +214,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase public function testChangeRecordsByDoubleClick() { $element = $this->byCssSelector( - "table.table_results tbody tr:nth-child(1) td:nth-child(6)" + "table.table_results tbody tr:nth-child(1) td:nth-child(2)" ); $this->moveto($element); @@ -241,7 +241,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase $this->assertEquals( "abcde", - $this->getCellByTableClass('table_results', 1, 6) + $this->getCellByTableClass('table_results', 1, 2) ); } @@ -255,7 +255,7 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase public function testCopyRecords() { $ele = $this->byCssSelector( - "table.table_results tbody tr:nth-child(3) td:nth-child(3)" + "table.table_results tbody tr:nth-child(3) td:nth-child(6)" ); $this->moveto($ele); $this->click(); @@ -287,12 +287,12 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase $this->assertEquals( "ABCDEFG", - $this->getCellByTableClass('table_results', 4, 6) + $this->getCellByTableClass('table_results', 4, 2) ); $this->assertEquals( "2012-01-02 00:00:00", - $this->getCellByTableClass('table_results', 4, 7) + $this->getCellByTableClass('table_results', 4, 3) ); } @@ -325,12 +325,12 @@ class PMA_SeleniumTableBrowseTest extends PMA_SeleniumBase $this->assertEquals( "1", - $this->getCellByTableClass('table_results', 1, 5) + $this->getCellByTableClass('table_results', 1, 1) ); $this->assertEquals( "3", - $this->getCellByTableClass('table_results', 2, 5) + $this->getCellByTableClass('table_results', 2, 1) ); } diff --git a/test/selenium/PmaSeleniumTableInsertTest.php b/test/selenium/PmaSeleniumTableInsertTest.php index d231df3072..e05e55e519 100644 --- a/test/selenium/PmaSeleniumTableInsertTest.php +++ b/test/selenium/PmaSeleniumTableInsertTest.php @@ -133,47 +133,47 @@ class PMA_SeleniumTableInsertTest extends PMA_SeleniumBase $this->assertEquals( "1", - $this->getCellByTableClass('table_results', 1, 5) + $this->getCellByTableClass('table_results', 1, 1) ); $this->assertEquals( "abcd", - $this->getCellByTableClass('table_results', 1, 6) + $this->getCellByTableClass('table_results', 1, 2) ); $this->assertEquals( "2011-01-02 00:00:00", - $this->getCellByTableClass('table_results', 1, 7) + $this->getCellByTableClass('table_results', 1, 3) ); $this->assertEquals( "2", - $this->getCellByTableClass('table_results', 2, 5) + $this->getCellByTableClass('table_results', 2, 1) ); $this->assertEquals( "foo", - $this->getCellByTableClass('table_results', 2, 6) + $this->getCellByTableClass('table_results', 2, 2) ); $this->assertEquals( "2012-01-02 00:00:00", - $this->getCellByTableClass('table_results', 2, 7) + $this->getCellByTableClass('table_results', 2, 3) ); $this->assertEquals( "4", - $this->getCellByTableClass('table_results', 3, 5) + $this->getCellByTableClass('table_results', 3, 1) ); $this->assertEquals( "Abcd", - $this->getCellByTableClass('table_results', 3, 6) + $this->getCellByTableClass('table_results', 3, 2) ); $this->assertEquals( "2013-01-02 00:00:00", - $this->getCellByTableClass('table_results', 3, 7) + $this->getCellByTableClass('table_results', 3, 3) ); } } diff --git a/test/selenium/PmaSeleniumTableOperationsTest.php b/test/selenium/PmaSeleniumTableOperationsTest.php index a706c1447a..0bf66e35c7 100644 --- a/test/selenium/PmaSeleniumTableOperationsTest.php +++ b/test/selenium/PmaSeleniumTableOperationsTest.php @@ -97,7 +97,7 @@ class PMA_SeleniumTableOperationsTest extends PMA_SeleniumBase $this->assertEquals( "2", - $this->getCellByTableClass('table_results', 1, 5) + $this->getCellByTableClass('table_results', 1, 1) ); }