The branch, master has been updated via 20ca1e471c61f8c3c0497f71ab182a3f7b83fc15 (commit) from 1ff96183cb3031b3cacfd54169fff39717ed8982 (commit)
- Log ----------------------------------------------------------------- commit 20ca1e471c61f8c3c0497f71ab182a3f7b83fc15 Author: Madhura Jayaratne madhura.cj@gmail.com Date: Sun Sep 18 11:54:59 2011 +0530
bug #3410999 - Zoom search, problems with data editor
-----------------------------------------------------------------------
Summary of changes: js/tbl_zoom_plot.js | 11 +++++++++- libraries/tbl_select.lib.php | 46 ++++++++++++++++++++++++++++++----------- tbl_zoom_select.php | 9 +++++-- 3 files changed, 49 insertions(+), 17 deletions(-)
diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js index df73c3c..3e760df 100644 --- a/js/tbl_zoom_plot.js +++ b/js/tbl_zoom_plot.js @@ -265,6 +265,7 @@ $(document).ready(function() {
//Find changed values by comparing form values with selectedRow Object var newValues = new Array();//Stores the values changed from original + var sqlTypes = new Array(); var it = 4; var xChange = false; var yChange = false; @@ -283,6 +284,10 @@ $(document).ready(function() { data[currentData][yLabel] = newVal; } } + var $input = $('#fieldID_' + it); + if ($input.hasClass('bit')) { + sqlTypes[key] = 'bit'; + } } it++; } //End data update @@ -378,7 +383,11 @@ $(document).ready(function() { if (key != 'where_clause') { sql_query += '`' + key + '`=' ; var value = newValues[key]; - if (!isNumeric(value) && value != null) { + if (sqlTypes[key] != null) { + if (sqlTypes[key] == 'bit') { + sql_query += 'b'' + value + '' ,'; + } + } else if (!isNumeric(value) && value != null) { sql_query += ''' + value + '' ,'; } else { sql_query += value + ' ,'; diff --git a/libraries/tbl_select.lib.php b/libraries/tbl_select.lib.php index 848eb28..53ffcb7 100644 --- a/libraries/tbl_select.lib.php +++ b/libraries/tbl_select.lib.php @@ -154,11 +154,13 @@ function PMA_tbl_getSubTabs() * @param int $foreignMaxLimit Max limit of displaying foreign elements * @param array $fields Array of search criteria inputs * @param bool $in_fbs Whether we are in 'function based search' + * @param bool $in_edit Whether in search mode + * or edit mode (used for zoom search) * * @return string HTML content for viewing foreing data and elements * for search criteria input. */ -function PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i, $db, $table, $titles, $foreignMaxLimit, $fields, $in_fbs = false) +function PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i, $db, $table, $titles, $foreignMaxLimit, $fields, $in_fbs = false, $in_edit = false) { $str = ''; if ($foreigners && isset($foreigners[$field]) && is_array($foreignData['disp_row'])) { @@ -208,23 +210,39 @@ EOT; $str .= '</span>'; }
- } elseif (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0) { - // e n u m s - $enum_value=explode(', ', str_replace("'", '', substr($tbl_fields_type[$i], 5, -1))); - $cnt_enum_value = count($enum_value); - $str .= '<select name="fields[' . ($i) . '][]" id="fieldID_' . $i .'"' - .' multiple="multiple" size="' . min(3, $cnt_enum_value) . '">' . "\n"; + } elseif (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0 + || (strncasecmp($tbl_fields_type[$i], 'set', 3) == 0 && $in_edit) + ) { + // e n u m s a n d s e t s
- for ($j = 0; $j < $cnt_enum_value; $j++) { + // Enum in edit mode --> dropdown + // Enum in search mode --> multiselect + // Set in edit mode --> multiselect + // Set in search mode --> input (skipped here, so the 'else' + // section would handle it) + + $value = explode(', ', str_replace("'", '', substr($tbl_fields_type[$i], 5, -1))); + $cnt_value = count($value); + + if ((strncasecmp($tbl_fields_type[$i], 'enum', 4) && ! $in_edit) + || (strncasecmp($tbl_fields_type[$i], 'set', 3) && $in_edit) + ) { + $str .= '<select name="fields[' . ($i) . '][]" id="fieldID_' . $i .'">' . "\n"; + } else { + $str .= '<select name="fields[' . ($i) . '][]" id="fieldID_' . $i .'"' + . ' multiple="multiple" size="' . min(3, $cnt_value) . '">' . "\n"; + } + + for ($j = 0; $j < $cnt_value; $j++) { if (isset($fields[$i]) && is_array($fields[$i]) - && in_array($enum_value[$j], $fields[$i]) + && in_array($value[$j], $fields[$i]) ) { - $str .= '<option value="' . $enum_value[$j] . '" Selected>' - . $enum_value[$j] . '</option>'; + $str .= '<option value="' . $value[$j] . '" Selected>' + . $value[$j] . '</option>'; } else { - $str .= '<option value="' . $enum_value[$j] . '">' - . $enum_value[$j] . '</option>'; + $str .= '<option value="' . $value[$j] . '">' + . $value[$j] . '</option>'; } } // end for $str .= '</select>' . "\n"; @@ -238,6 +256,8 @@ EOT; $the_class .= ' datefield'; } elseif ($type == 'datetime' || substr($type, 0, 9) == 'timestamp') { $the_class .= ' datetimefield'; + } elseif (substr($type, 0, 3) == 'bit') { + $the_class .= ' bit'; }
if (isset($fields[$i]) && is_string($fields[$i])) { diff --git a/tbl_zoom_select.php b/tbl_zoom_select.php index a110ace..548b03f 100644 --- a/tbl_zoom_select.php +++ b/tbl_zoom_select.php @@ -438,13 +438,16 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' ?> <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>"> <th><?php echo htmlspecialchars($fields_list[$i - 4]); ?></th> - <th><?php echo '<input type="checkbox" class="checkbox_null" name="fields_null[ ' - . $i . ' ]" id="fields_null_id_' . $i . '" />'; ?> + <th><?php echo ($fields_null[$i - 4] == 'YES') + ? '<input type="checkbox" class="checkbox_null" name="fields_null[ ' + . $i . ' ]" id="fields_null_id_' . $i . '" />' + : ''; ?> </th> <th> <?php echo PMA_getForeignFields_Values( $foreigners, $foreignData, $fieldpopup, $tbl_fields_type, - $i, $db, $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], '' + $i, $db, $table, $titles, + $GLOBALS['cfg']['ForeignKeyMaxLimit'], '', false, true ); ?> </th> </tr>
hooks/post-receive