Merge pull request #1412 from nisargjhaveri/show_all_dropdown

Show placeholder in number of rows dropdown when showing all
This commit is contained in:
Marc Delisle 2014-12-03 12:32:18 -05:00
commit eb66742475
2 changed files with 12 additions and 2 deletions

View File

@ -968,6 +968,11 @@ class PMA_DisplayResults
// Do not change the position when changing the number of rows
. $_SESSION['tmpval']['pos'] . '" />';
$numberOfRowsPlaceholder = null;
if ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS) {
$numberOfRowsPlaceholder = 'All';
}
$numberOfRowsChoices = array(
'25' => 25,
'50' => 50,
@ -978,7 +983,7 @@ class PMA_DisplayResults
$additional_fields_html .= __('Number of rows:') . ' ';
$additional_fields_html .= PMA_Util::getDropdown(
'session_max_rows', $numberOfRowsChoices,
$_SESSION['tmpval']['max_rows'], '', 'autosubmit'
$_SESSION['tmpval']['max_rows'], '', 'autosubmit', $numberOfRowsPlaceholder
);
if ($GLOBALS['cfg']['ShowDisplayDirection']) {

View File

@ -2689,13 +2689,14 @@ class PMA_Util
* case the dropdown is present more than once
* on the page
* @param string $class class for the select element
* @param string $placeholder Placeholder for dropdown if nothing else is selected
*
* @return string html content
*
* @todo support titles
*/
public static function getDropdown(
$select_name, $choices, $active_choice, $id, $class = ''
$select_name, $choices, $active_choice, $id, $class = '', $placeholder = null
) {
$result = '<select'
. ' name="' . htmlspecialchars($select_name) . '"'
@ -2703,6 +2704,10 @@ class PMA_Util
. (! empty($class) ? ' class="' . htmlspecialchars($class) . '"' : '')
. '>';
if (!empty($placeholder)) {
$result .= '<option style="display: none">'.$placeholder.'</option>';
}
foreach ($choices as $one_choice_value => $one_choice_label) {
$result .= '<option value="' . htmlspecialchars($one_choice_value) . '"';