Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-12-16 15:08:04 +01:00
commit 380e7e52e1
3 changed files with 19 additions and 3 deletions

View File

@ -8,6 +8,7 @@ phpMyAdmin - ChangeLog
+ rfe #1566 Change value of "Number of rows:" when "Show all" is checked
+ rfe Focus console by clicking on white space
+ rfe 1507 Part 1: Cycle through console history with keyboard up/down arrows
+ rfe #1579 Default to primary key when adding relation
4.3.3.0 (not yet released)
- bug The "Recently used tables" setting should be with Nav panel

View File

@ -17,13 +17,13 @@ function show_hide_clauses($thisDropdown)
/**
* Sets dropdown options to values
*/
function setDropdownValues($dropdown, values) {
function setDropdownValues($dropdown, values, selectedValue) {
$dropdown.empty();
var optionsAsString = '';
// add an empty string to the beginning for empty selection
values.unshift('');
$.each(values, function () {
optionsAsString += "<option value='" + this + "'>" + this + "</option>";
optionsAsString += "<option value='" + this + "'" + (selectedValue == this ? " selected='selected'" : "") + ">" + this + "</option>";
});
$dropdown.append($(optionsAsString));
}
@ -94,7 +94,13 @@ function getDropdownValues($dropdown) {
setDropdownValues($columnDd, []);
} else { // if a table selector
// set values for the column dropdown
setDropdownValues($columnDd, data.columns);
var primary = null;
if (typeof data.primary !== 'undefined'
&& 1 === data.primary.length
) {
primary = data.primary[0];
}
setDropdownValues($columnDd, data.columns, primary);
}
} else {
PMA_ajaxShowMessage(data.error, false);

View File

@ -722,6 +722,15 @@ function PMA_sendHtmlForColumnDropdownList()
$columns[] = htmlspecialchars($column);
}
$response->addJSON('columns', $columns);
// @todo should be: $server->db($db)->table($table)->primary()
$primary = PMA_Index::getPrimary($foreignTable, $_REQUEST['foreignDb']);
if (false === $primary) {
return;
}
$primarycols = array_keys($primary->getColumns());
$response->addJSON('primary', $primarycols);
}
/**