diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-03-06 08:57:50 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-03-06 08:57:50 +0300 |
commit | 5a0ffa30fdb12f33c6dd4edebba959cd3fa9336f (patch) | |
tree | f1805053980fd2ec20aab34352d0821ead217d76 | |
parent | 3de6ee1b0ae712a0f98ff932c44c0dc61053f0cc (diff) |
rfe Pagination for GIS visualization
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | js/tbl_chart.js | 5 | ||||
-rw-r--r-- | libraries/Util.class.php | 41 | ||||
-rw-r--r-- | libraries/tbl_chart.lib.php | 34 | ||||
-rw-r--r-- | libraries/tbl_gis_visualization.lib.php | 19 | ||||
-rw-r--r-- | test/libraries/PMA_tbl_chart_test.php | 2 |
6 files changed, 58 insertions, 44 deletions
@@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog ====================== 4.5.0.0 (not yet released) ++ rfe Pagination for GIS visualization 4.4.0.0 (not yet released) + rfe #1553 InnoDB presently supports one FULLTEXT index creation at a time diff --git a/js/tbl_chart.js b/js/tbl_chart.js index 49d5f1685c..67f1d7646d 100644 --- a/js/tbl_chart.js +++ b/js/tbl_chart.js @@ -395,11 +395,6 @@ AJAX.registerOnload('tbl_chart.js', function () { * */ $(document).on('submit', "#tblchartform", function (event) { - if (!checkFormElementInRange(this, 'session_max_rows', PMA_messages.strNotValidRowNumber, 1) || - !checkFormElementInRange(this, 'pos', PMA_messages.strNotValidRowNumber, 0 - 1) - ) { - return false; - } var $form = $(this); if (codemirror_editor) { diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 5c233600e4..af573eb8e0 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -4581,6 +4581,47 @@ class PMA_Util return $html; } + + /** + * Function to get html for the start row and number of rows panel + * + * @param string $sql_query sql query + * + * @return string html + */ + public static function getStartAndNumberOfRowsPanel($sql_query) + { + $html = '<fieldset><div>'; + + $pos = isset($_REQUEST['pos']) ? $_REQUEST['pos'] : $_SESSION['tmpval']['pos']; + $html .= '<label for="pos">' . __('Start row:') . '</label>' + . '<input type="number" name="pos" min="0" required="required"' + . ' value="' . htmlspecialchars($pos) . '" />'; + + if (isset($_REQUEST['session_max_rows'])) { + $rows = $_REQUEST['session_max_rows']; + } else { + if ($_SESSION['tmpval']['max_rows'] != 'all') { + $rows = $_SESSION['tmpval']['max_rows']; + } else { + $rows = $GLOBALS['cfg']['MaxRows']; + } + } + $html .= '<label for="session_max_rows">' + . __('Number of rows:') + . '</label>' + . '<input type="number" name="session_max_rows" min="1"' + . ' value="' . htmlspecialchars($rows) . '" required="required" />'; + + $html .= '<input type="submit" name="submit" class="Go"' + . ' value="' . __('Go') . '" />' + . '<input type="hidden" name="sql_query"' + . ' value="' . htmlspecialchars($sql_query) . '" />'; + + $html .= '</div></fieldset>'; + + return $html; + } } ?> diff --git a/libraries/tbl_chart.lib.php b/libraries/tbl_chart.lib.php index d6d49451db..8862b33859 100644 --- a/libraries/tbl_chart.lib.php +++ b/libraries/tbl_chart.lib.php @@ -272,38 +272,6 @@ function PMA_getHtmlForAlternativeDataFormat($keys, $fields_meta, $numeric_types } /** - * Function to get html for the start row and number of rows options - * - * @param string $sql_query sql query - * - * @return string - */ -function PMA_getHtmlForStartAndNumberOfRowsOptions($sql_query) -{ - $htmlString = '<p style="clear:both;"> </p>' - . '<fieldset>' - . '<div>' - . '<label for="pos">' . __('Start row:') . '</label>' - . '<input type="text" name="pos" size="3" value="' - . $_SESSION['tmpval']['pos'] . '" />' - . '<label for="session_max_rows">' - . __('Number of rows:') . '</label>' - . '<input type="text" name="session_max_rows" size="3" value="' - . (($_SESSION['tmpval']['max_rows'] != 'all') - ? $_SESSION['tmpval']['max_rows'] - : $GLOBALS['cfg']['MaxRows']) - . '" />' - . '<input type="submit" name="submit" class="Go" value="' . __('Go') - . '" />' - . '<input type="hidden" name="sql_query" value="' - . htmlspecialchars($sql_query) . '" />' - . '</div>' - . '</fieldset>'; - - return $htmlString; -} - -/** * Function to get html for the chart area div * * @return string @@ -370,7 +338,7 @@ function PMA_getHtmlForTableChartDisplay($url_query, $url_params, $keys, $htmlString .= PMA_getHtmlForAlternativeDataFormat( $keys, $fields_meta, $numeric_types, $xaxis ); - $htmlString .= PMA_getHtmlForStartAndNumberOfRowsOptions($sql_query); + $htmlString .= PMA_Util::getStartAndNumberOfRowsPanel($sql_query); $htmlString .= PMA_getHtmlForChartAreaDiv(); diff --git a/libraries/tbl_gis_visualization.lib.php b/libraries/tbl_gis_visualization.lib.php index 4e1c9c96bc..c078ff2739 100644 --- a/libraries/tbl_gis_visualization.lib.php +++ b/libraries/tbl_gis_visualization.lib.php @@ -39,9 +39,20 @@ function PMA_GIS_modifyQuery($sql_query, $visualizationSettings) . PMA_Util::backquote($visualizationSettings['spatialColumn']) . ') AS ' . PMA_Util::backquote('srid') . ' '; + $pos = isset($_REQUEST['pos']) ? $_REQUEST['pos'] : $_SESSION['tmpval']['pos']; + if (isset($_REQUEST['session_max_rows'])) { + $rows = $_REQUEST['session_max_rows']; + } else { + if ($_SESSION['tmpval']['max_rows'] != 'all') { + $rows = $_SESSION['tmpval']['max_rows']; + } else { + $rows = $GLOBALS['cfg']['MaxRows']; + } + } // Append the original query as the inner query $modified_query .= 'FROM (' . $sql_query . ') AS ' - . PMA_Util::backquote('temp_gis'); + . PMA_Util::backquote('temp_gis') . ' LIMIT ' + . $pos . ', ' . $rows; return $modified_query; } @@ -222,14 +233,12 @@ function PMA_getHtmlForGisVisualization( ); $html .= '<input type="hidden" name="displayVisualization" value="redraw">'; - $html .= '<input type="hidden" name="sql_query" value="'; - $html .= htmlspecialchars($sql_query) . '" />'; - $html .= '</form>'; - if (! $GLOBALS['PMA_Config']->isHttps()) { $isSelected = isset($visualizationSettings['choice']) ? true : false; $html .= PMA_getHtmlForUseOpenStreetMaps($isSelected); } + $html .= PMA_Util::getStartAndNumberOfRowsPanel($sql_query); + $html .= '</form>'; $html .= '<div class="pma_quick_warp" style="width: 50px; position: absolute;' . ' right: 0; top: 0; cursor: pointer;">'; diff --git a/test/libraries/PMA_tbl_chart_test.php b/test/libraries/PMA_tbl_chart_test.php index ff511f03f1..043762d013 100644 --- a/test/libraries/PMA_tbl_chart_test.php +++ b/test/libraries/PMA_tbl_chart_test.php @@ -259,7 +259,7 @@ class PMA_TblChartTest extends PHPUnit_Framework_TestCase $html ); $this->assertContains( - PMA_getHtmlForStartAndNumberOfRowsOptions($sql_query), + PMA_Util::getStartAndNumberOfRowsPanel($sql_query), $html ); $this->assertContains( |