The anchor is now correctly generated for a saved relational field during inline edit with the correct where clause. Trying to fix the bug with ['ForeignKeyMaxLimit']

This commit is contained in:
ninadsp
2010-07-31 01:34:47 +05:30
parent 5996773bf7
commit 6547920e8a
2 changed files with 22 additions and 10 deletions

View File

@@ -243,7 +243,7 @@ $(document).ready(function() {
// Collect values of all fields to submit, we don't know which changed
var params_to_submit = {};
var relation_fields = new Array();
var relation_fields = {};
var transform_fields = {};
var transformation_fields = false;
@@ -268,7 +268,7 @@ $(document).ready(function() {
this_field_params[field_name] = $(this).find('select').val();
if($(this).is('.relation')) {
relation_fields.push(field_name);
$.extend(relation_fields, this_field_params);
}
}
@@ -284,10 +284,8 @@ $(document).ready(function() {
sql_query = sql_query.replace(/,\s$/, '');
sql_query += ' WHERE ' + where_clause;
var rel_fields_list = '';
if(relation_fields.length > 0) {
rel_fields_list = relation_fields.join();
}
var rel_fields_list = $.param(relation_fields);
var transform_fields_list = $.param(transform_fields);
// Make the Ajax post after setting all parameters

18
sql.php
View File

@@ -64,7 +64,19 @@ if(isset($_REQUEST['get_relational_values']) && $_REQUEST['get_relational_values
$dropdown = PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], $_REQUEST['curr_value'], $cfg['ForeignKeyMaxLimit']);
if( $dropdown == '<option value="">&nbsp;</option>') {
//Handle the case when number of values is more than $cfg['ForeignKeyMaxLimit']
$_url_params = array(
'db' => $db,
'table' => $table,
'field' => $column
);
$dropdown = '<a href="browse_foreigners.php' . PMA_generate_common_url($_url_params) . '">Search Foreign Data</a>';
}
else {
$dropdown = '<select>' . $dropdown . '</select>';
}
$extra_data['dropdown'] = $dropdown;
PMA_ajaxResponse(NULL, true, $extra_data);
@@ -593,10 +605,12 @@ if (0 == $num_rows || $is_affected) {
$map = PMA_getForeigners($db, $table, '', 'both');
$rel_fields = explode(',', $_REQUEST['rel_fields_list']);
$rel_fields = array();
parse_str($_REQUEST['rel_fields_list'], $rel_fields);
foreach( $rel_fields as $rel_field) {
foreach( $rel_fields as $rel_field => $rel_field_value) {
$where_comparison = '=' . $rel_field_value;
$_url_params = array(
'db' => $map[$rel_field]['foreign_db'],
'table' => $map[$rel_field]['foreign_table'],