We can now edit NULL fields and set fields to NULL in inline editing.
This commit is contained in:
13
js/sql.js
13
js/sql.js
@@ -203,7 +203,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// In each input sibling, wrap the current value in a textarea
|
// In each input sibling, wrap the current value in a textarea
|
||||||
// and store the current value in a hidden span
|
// and store the current value in a hidden span
|
||||||
if($(this).is(':not(.truncated, .transformed, .relation, .enum)')) {
|
if($(this).is(':not(.truncated, .transformed, .relation, .enum, .null)')) {
|
||||||
// handle non-truncated, non-transformed, non-relation values
|
// handle non-truncated, non-transformed, non-relation values
|
||||||
// We don't need to get any more data, just wrap the value
|
// We don't need to get any more data, just wrap the value
|
||||||
$(this).html('<textarea>'+data_value+'</textarea>')
|
$(this).html('<textarea>'+data_value+'</textarea>')
|
||||||
@@ -274,6 +274,12 @@ $(document).ready(function() {
|
|||||||
$(".original_data").hide();
|
$(".original_data").hide();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
else if($(this).is('.null')) {
|
||||||
|
//handle null fields
|
||||||
|
$(this_field).html('<textarea></textarea>')
|
||||||
|
.append('<span class="original_data">NULL</span>');
|
||||||
|
$(".original_data").hide();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}) // End On click, replace the current field with an input/textarea
|
}) // End On click, replace the current field with an input/textarea
|
||||||
|
|
||||||
@@ -339,7 +345,10 @@ $(document).ready(function() {
|
|||||||
var sql_query = 'UPDATE ' + window.parent.table + ' SET ';
|
var sql_query = 'UPDATE ' + window.parent.table + ' SET ';
|
||||||
|
|
||||||
$.each(params_to_submit, function(key, value) {
|
$.each(params_to_submit, function(key, value) {
|
||||||
sql_query += ' ' + key + "='" + value + "' , ";
|
if(value.length == 0) {
|
||||||
|
value = 'NULL'
|
||||||
|
}
|
||||||
|
sql_query += ' ' + key + "='" + value + "' , ";
|
||||||
})
|
})
|
||||||
sql_query = sql_query.replace(/,\s$/, '');
|
sql_query = sql_query.replace(/,\s$/, '');
|
||||||
sql_query += ' WHERE ' + where_clause;
|
sql_query += ' WHERE ' + where_clause;
|
||||||
|
@@ -1031,6 +1031,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
$vertical_display['delete'] = array();
|
$vertical_display['delete'] = array();
|
||||||
$vertical_display['data'] = array();
|
$vertical_display['data'] = array();
|
||||||
$vertical_display['row_delete'] = array();
|
$vertical_display['row_delete'] = array();
|
||||||
|
$data_inline_edit_class = 'data_inline_edit';
|
||||||
|
|
||||||
// Correction University of Virginia 19991216 in the while below
|
// Correction University of Virginia 19991216 in the while below
|
||||||
// Previous code assumed that all tables have keys, specifically that
|
// Previous code assumed that all tables have keys, specifically that
|
||||||
@@ -1074,7 +1075,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
|
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
|
||||||
// pointer code part
|
// pointer code part
|
||||||
echo ' <tr class="' . $class . '">' . "\n";
|
echo ' <tr class="' . $class . '">' . "\n";
|
||||||
$class = '';
|
$class = $data_inline_edit_class;
|
||||||
|
if(is_null($row[$i])) {
|
||||||
|
$class .= 'null';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1285,6 +1289,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
// PMA_mysql_fetch_fields returns BLOB in place of
|
// PMA_mysql_fetch_fields returns BLOB in place of
|
||||||
// TEXT fields type so we have to ensure it's really a BLOB
|
// TEXT fields type so we have to ensure it's really a BLOB
|
||||||
$field_flags = PMA_DBI_field_flags($dt_result, $i);
|
$field_flags = PMA_DBI_field_flags($dt_result, $i);
|
||||||
|
|
||||||
|
// reset $class from $data_inline_edit_class to '' as we can't edit binary data
|
||||||
|
$class = '';
|
||||||
|
|
||||||
if (stristr($field_flags, 'BINARY')) {
|
if (stristr($field_flags, 'BINARY')) {
|
||||||
if (!isset($row[$i]) || is_null($row[$i])) {
|
if (!isset($row[$i]) || is_null($row[$i])) {
|
||||||
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
|
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"><i>NULL</i></td>' . "\n";
|
||||||
@@ -2318,7 +2326,6 @@ function PMA_handle_non_printable_contents($category, $content, $transform_funct
|
|||||||
*/
|
*/
|
||||||
function PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $data, $transform_function, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated ) {
|
function PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $data, $transform_function, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated ) {
|
||||||
|
|
||||||
$data_inline_edit_class = 'data_inline_edit';
|
|
||||||
$enum_class = '';
|
$enum_class = '';
|
||||||
if(strpos($meta->flags, 'enum') !== false) {
|
if(strpos($meta->flags, 'enum') !== false) {
|
||||||
$enum_class = ' enum';
|
$enum_class = ' enum';
|
||||||
@@ -2331,7 +2338,7 @@ function PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed
|
|||||||
|
|
||||||
// continue the <td> tag started before calling this function:
|
// continue the <td> tag started before calling this function:
|
||||||
$result = $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . $nowrap
|
$result = $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . $nowrap
|
||||||
. ' ' . $data_inline_edit_class . ($is_field_truncated ? ' truncated' : '')
|
. ' ' . ($is_field_truncated ? ' truncated' : '')
|
||||||
. ($transform_function != $default_function ? ' transformed' : '')
|
. ($transform_function != $default_function ? ' transformed' : '')
|
||||||
. (isset($map[$meta->name]) ? ' relation' : '')
|
. (isset($map[$meta->name]) ? ' relation' : '')
|
||||||
. $enum_class . $mime_type_class . '">';
|
. $enum_class . $mime_type_class . '">';
|
||||||
|
Reference in New Issue
Block a user