Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-11-13 17:54:31 +01:00
commit e2cda595e4
5 changed files with 64 additions and 32 deletions

View File

@ -59,6 +59,7 @@ phpMyAdmin - ChangeLog
- bug #4495 Comment lines in multiquery
- bug #4535 Loads of Warnings/Notices in PMA_getServerSlaveStatus on replication slave
- bug #4585 Multi query results not shown
- rfe #1556 Disabling Show all
4.2.12.0 (not yet released)
- bug #4574 Blank/white page when JavaScript disabled

View File

@ -430,6 +430,7 @@ $js_messages['strColVisibHint'] = __(
$js_messages['strShowAllCol'] = __('Show all');
$js_messages['strAlertNonUnique'] = __('This table does not contain a unique column. Features related to the grid edit, checkbox, Edit, Copy and Delete links may not work after saving.');
$js_messages['strEnterValidHex'] = __('Please enter a valid hexadecimal string. Valid characters are 0-9, A-F.');
$js_messages['strShowAllRowsWarning'] = __('Do you really want to see all rows? For a big table this could crash the browser.');
/** Drag & Drop sql import messages */
$js_messages['dropImportMessageCancel'] = __('cancel');

View File

@ -100,6 +100,7 @@ AJAX.registerTeardown('sql.js', function () {
$('th.column_heading.marker').die('click');
$(window).unbind('scroll');
$(".filter_rows").die("keyup");
$('body').off('click', '.navigation .showAllRows');
$('body').off('click','a.browse_foreign');
$('body').off('click', '#simulate_dml');
$('body').off('keyup', '#sqlqueryform');
@ -441,6 +442,26 @@ AJAX.registerOnload('sql.js', function () {
});
// Filter row handling. --ENDS--
// Prompt to confirm on Show All
$('body').on('click', '.navigation .showAllRows', function (e) {
e.preventDefault();
$form = $(this).parents('form');
if (! $(this).is(':checked')) { // already showing all rows
submitShowAllForm();
} else {
$form.PMA_confirm(PMA_messages.strShowAllRowsWarning, $form.attr('action'), function (url) {
submitShowAllForm();
});
}
function submitShowAllForm() {
var submitData = $form.serialize() + '&ajax_request=true&ajax_page_request=true';
PMA_ajaxShowMessage();
$.post($form.attr('action'), submitData, AJAX.responseHandler);
}
});
$('body').on('keyup', '#sqlqueryform', function () {
PMA_handleSimulateQueryButton();
});

View File

@ -703,17 +703,10 @@ class PMA_DisplayResults
} //_if2
} //_if1
// Display the "Show all" button if allowed
if (($this->__get('num_rows') < $this->__get('unlim_num_rows'))
&& ($GLOBALS['cfg']['ShowAll']
|| ($this->__get('unlim_num_rows') <= 500))
) {
$table_navigation_html .= $this->_getShowAllButtonForTableNavigation(
$html_sql_query
);
} // end show all
$showing_all = false;
if ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS) {
$showing_all = true;
}
// Move to the next page or to the last one
$endpos = $_SESSION['tmpval']['pos']
@ -731,8 +724,17 @@ class PMA_DisplayResults
} // end move toward
// Display the "Show all" button if allowed
if ($GLOBALS['cfg']['ShowAll'] || ($this->__get('unlim_num_rows') <= 500) ) {
$table_navigation_html .= $this->_getShowAllCheckboxForTableNavigation(
$showing_all, $html_sql_query
);
} // end show all
// show separator if pagination happen
if ($nbTotalPage > 1) {
if ($nbTotalPage > 1 || $showing_all) {
$table_navigation_html
.= '<td><div class="navigation_separator">|</div></td>';
}
@ -832,8 +834,9 @@ class PMA_DisplayResults
/**
* Prepare Show All button for table navigation
* Prepare Show All checkbox for table navigation
*
* @param bool $showing_all whether all rows are shown currently
* @param string $html_sql_query the sql encoded by html special characters
*
* @return string html content
@ -842,8 +845,9 @@ class PMA_DisplayResults
*
* @see _getTableNavigation()
*/
private function _getShowAllButtonForTableNavigation($html_sql_query)
{
private function _getShowAllCheckboxForTableNavigation(
$showing_all, $html_sql_query
) {
return "\n"
. '<td>'
. '<form action="sql.php" method="post">'
@ -853,10 +857,13 @@ class PMA_DisplayResults
. '<input type="hidden" name="sql_query" value="'
. $html_sql_query . '" />'
. '<input type="hidden" name="pos" value="0" />'
. '<input type="hidden" name="session_max_rows" value="all" />'
. '<input type="hidden" name="session_max_rows" value="'
. (! $showing_all ? 'all' : $GLOBALS['cfg']['MaxRows']) . '" />'
. '<input type="hidden" name="goto" value="' . $this->__get('goto')
. '" />'
. '<input type="submit" name="navig" value="' . __('Show all') . '" />'
. '<input type="checkbox" name="navig" class="showAllRows"'
. (! $showing_all ? '' : ' checked="checked"') . ' value="all" />'
. '<label for="navig">' . __('Show all') . '</label>'
. '</form>'
. '</td>';
} // end of the '_getShowAllButtonForTableNavigation()' function
@ -2925,7 +2932,7 @@ class PMA_DisplayResults
false,
$this->__get('table')
);
$transform_url_params = array(
'db' => $this->__get('db'),
'table' => $this->__get('table'),

View File

@ -1601,7 +1601,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
*
* @return array parameters and output
*/
public function dataProviderForTestGetShowAllButtonForTableNavigation()
public function dataProviderForTestGetShowAllCheckboxForTableNavigation()
{
return array(
array(
@ -1610,15 +1610,17 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
'tbl_structure.php',
'SELECT * FROM `user`',
"\n"
. '<td><form action="sql.php" method="post"><input type="hidden" '
. 'name="db" value="mysql" /><input type="hidden" name="table" '
. 'value="user" /><input type="hidden" name="lang" value="en" />'
. '<input type="hidden" name="token" value="token" /><input type="'
. 'hidden" name="sql_query" value="SELECT * FROM `user`" /><input '
. 'type="hidden" name="pos" value="0" /><input type="hidden" name='
. '"session_max_rows" value="all" /><input type="hidden" name='
. '"goto" value="tbl_structure.php" /><input type="submit" name='
. '"navig" value="Show all" /></form></td>'
. '<td><form action="sql.php" method="post">'
. '<input type="hidden" name="db" value="mysql" />'
. '<input type="hidden" name="table" value="user" />'
. '<input type="hidden" name="lang" value="en" />'
. '<input type="hidden" name="token" value="token" />'
. '<input type="hidden" name="sql_query" value="SELECT * FROM `user`" />'
. '<input type="hidden" name="pos" value="0" />'
. '<input type="hidden" name="session_max_rows" value="all" />'
. '<input type="hidden" name="goto" value="tbl_structure.php" />'
. '<input type="checkbox" name="navig" class="showAllRows" value="all" />'
. '<label for="navig">Show all</label></form></td>'
)
);
}
@ -1635,9 +1637,9 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
*
* @return void
*
* @dataProvider dataProviderForTestGetShowAllButtonForTableNavigation
* @dataProvider dataProviderForTestGetShowAllCheckboxForTableNavigation
*/
public function testGetShowAllButtonForTableNavigation(
public function testGetShowAllCheckboxForTableNavigation(
$db, $table, $goto, $html_sql_query, $output
) {
$this->object->__set('db', $db);
@ -1647,8 +1649,8 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
$output,
$this->_callPrivateFunction(
'_getShowAllButtonForTableNavigation',
array($html_sql_query)
'_getShowAllCheckboxForTableNavigation',
array(false, $html_sql_query)
)
);
}