The branch, master has been updated via 2038266f88cc773fd0035d9273f0bc83d3a21991 (commit) from 29dbdde4ffb4c4cbb13fd2351eabb5f22042c9ac (commit)
- Log ----------------------------------------------------------------- commit 2038266f88cc773fd0035d9273f0bc83d3a21991 Author: Madhura Jayaratne madhura.cj@gmail.com Date: Wed Mar 23 18:08:35 2011 +0530
For Bug #3207730 Inline edit and Relational display column
-----------------------------------------------------------------------
Summary of changes: js/sql.js | 8 +++++++- sql.php | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/js/sql.js b/js/sql.js index 9adfb62..15c780f 100644 --- a/js/sql.js +++ b/js/sql.js @@ -543,6 +543,11 @@ $(document).ready(function() { */ 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 = $this_field.text(); @@ -647,7 +652,8 @@ $(document).ready(function() { 'table' : window.parent.table, 'column' : field_name, '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) { diff --git a/sql.php b/sql.php index 41f1ec6..50026b9 100644 --- a/sql.php +++ b/sql.php @@ -63,8 +63,17 @@ if (isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_value $column = $_REQUEST['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, '', '');
+ 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) { //Handle the case when number of values is more than $cfg['ForeignKeyMaxLimit'] $_url_params = array( @@ -78,7 +87,7 @@ if (isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_value .'>' . __('Browse foreign values') . '</a>'; } 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>'; }
hooks/post-receive