For Bug #3207730 Inline edit and Relational display column
This commit is contained in:
@@ -542,6 +542,11 @@ $(document).ready(function() {
|
|||||||
* @var relation_curr_value String current value of the field (for fields that are foreign keyed).
|
* @var relation_curr_value String current value of the field (for fields that are foreign keyed).
|
||||||
*/
|
*/
|
||||||
var relation_curr_value = $this_field.find('a').text();
|
var relation_curr_value = $this_field.find('a').text();
|
||||||
|
/**
|
||||||
|
* @var relation_key_or_display_column String relational key if in 'Relational display column' mode,
|
||||||
|
* relational display column if in 'Relational key' mode (for fields that are foreign keyed).
|
||||||
|
*/
|
||||||
|
var relation_key_or_display_column = $this_field.find('a').attr('title');
|
||||||
/**
|
/**
|
||||||
* @var curr_value String current value of the field (for fields that are of type enum or set).
|
* @var curr_value String current value of the field (for fields that are of type enum or set).
|
||||||
*/
|
*/
|
||||||
@@ -647,7 +652,8 @@ $(document).ready(function() {
|
|||||||
'table' : window.parent.table,
|
'table' : window.parent.table,
|
||||||
'column' : field_name,
|
'column' : field_name,
|
||||||
'token' : window.parent.token,
|
'token' : window.parent.token,
|
||||||
'curr_value' : relation_curr_value
|
'curr_value' : relation_curr_value,
|
||||||
|
'relation_key_or_display_column' : relation_key_or_display_column
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post('sql.php', post_params, function(data) {
|
$.post('sql.php', post_params, function(data) {
|
||||||
|
11
sql.php
11
sql.php
@@ -63,8 +63,17 @@ if (isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_value
|
|||||||
$column = $_REQUEST['column'];
|
$column = $_REQUEST['column'];
|
||||||
$foreigners = PMA_getForeigners($db, $table, $column);
|
$foreigners = PMA_getForeigners($db, $table, $column);
|
||||||
|
|
||||||
|
$display_field = PMA_getDisplayField($foreigners[$column][foreign_db], $foreigners[$column][foreign_table]);
|
||||||
|
|
||||||
$foreignData = PMA_getForeignData($foreigners, $column, false, '', '');
|
$foreignData = PMA_getForeignData($foreigners, $column, false, '', '');
|
||||||
|
|
||||||
|
if ($_SESSION['tmp_user_values']['relational_display'] == 'D'
|
||||||
|
&& (isset($display_field) && strlen($display_field)
|
||||||
|
&& (isset($_REQUEST['relation_key_or_display_column']) && $_REQUEST['relation_key_or_display_column']))) {
|
||||||
|
$curr_value = $_REQUEST['relation_key_or_display_column'];
|
||||||
|
} else {
|
||||||
|
$curr_value = $_REQUEST['curr_value'];
|
||||||
|
}
|
||||||
if ($foreignData['disp_row'] == null) {
|
if ($foreignData['disp_row'] == null) {
|
||||||
//Handle the case when number of values is more than $cfg['ForeignKeyMaxLimit']
|
//Handle the case when number of values is more than $cfg['ForeignKeyMaxLimit']
|
||||||
$_url_params = array(
|
$_url_params = array(
|
||||||
@@ -78,7 +87,7 @@ if (isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_value
|
|||||||
.'>' . __('Browse foreign values') . '</a>';
|
.'>' . __('Browse foreign values') . '</a>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$dropdown = PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $_REQUEST['curr_value'], $cfg['ForeignKeyMaxLimit']);
|
$dropdown = PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $curr_value, $cfg['ForeignKeyMaxLimit']);
|
||||||
$dropdown = '<select>' . $dropdown . '</select>';
|
$dropdown = '<select>' . $dropdown . '</select>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user