Added classes to data fields that are truncated/transformed/relation keys so that they can be distinguished while handling ajax inline edit
This commit is contained in:
@@ -1199,6 +1199,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
for ($i = 0; $i < $fields_cnt; ++$i) {
|
for ($i = 0; $i < $fields_cnt; ++$i) {
|
||||||
$meta = $fields_meta[$i];
|
$meta = $fields_meta[$i];
|
||||||
$pointer = $i;
|
$pointer = $i;
|
||||||
|
$is_field_truncated = false;
|
||||||
// See if this column should get highlight because it's used in the
|
// See if this column should get highlight because it's used in the
|
||||||
// where-query.
|
// where-query.
|
||||||
if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
|
if (isset($highlight_columns) && (isset($highlight_columns[$meta->name]) || isset($highlight_columns[PMA_backquote($meta->name)]))) {
|
||||||
@@ -1272,7 +1273,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
$nowrap = ' nowrap';
|
$nowrap = ' nowrap';
|
||||||
$where_comparison = ' = ' . $row[$i];
|
$where_comparison = ' = ' . $row[$i];
|
||||||
|
|
||||||
$vertical_display['data'][$row_no][$i] = '<td align="right"' . PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options);
|
$vertical_display['data'][$row_no][$i] = '<td align="right"' . PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
|
||||||
} else {
|
} else {
|
||||||
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ' nowrap' . ($condition_field ? ' condition' : '') . '"> </td>' . "\n";
|
$vertical_display['data'][$row_no][$i] = ' <td align="right"' . $mouse_events . ' class="' . $class . ' nowrap' . ($condition_field ? ' condition' : '') . '"> </td>' . "\n";
|
||||||
}
|
}
|
||||||
@@ -1345,6 +1346,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
// if a transform function for blob is set, none of these replacements will be made
|
// if a transform function for blob is set, none of these replacements will be made
|
||||||
if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P') {
|
if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P') {
|
||||||
$row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
|
$row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
|
||||||
|
$is_field_truncated = true;
|
||||||
}
|
}
|
||||||
// displays all space characters, 4 space
|
// displays all space characters, 4 space
|
||||||
// characters for tabulations and <cr>/<lf>
|
// characters for tabulations and <cr>/<lf>
|
||||||
@@ -1367,6 +1369,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
// (unless it's a link-type transformation)
|
// (unless it's a link-type transformation)
|
||||||
if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' && !strpos($transform_function, 'link') === true) {
|
if (PMA_strlen($row[$i]) > $GLOBALS['cfg']['LimitChars'] && $_SESSION['tmp_user_values']['display_text'] == 'P' && !strpos($transform_function, 'link') === true) {
|
||||||
$row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
|
$row[$i] = PMA_substr($row[$i], 0, $GLOBALS['cfg']['LimitChars']) . '...';
|
||||||
|
$is_field_truncated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// displays special characters from binaries
|
// displays special characters from binaries
|
||||||
@@ -1400,7 +1403,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
// do not wrap if date field type
|
// do not wrap if date field type
|
||||||
$nowrap = ((preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap) ? ' nowrap' : '');
|
$nowrap = ((preg_match('@DATE|TIME@i', $meta->type) || $bool_nowrap) ? ' nowrap' : '');
|
||||||
$where_comparison = ' = \'' . PMA_sqlAddslashes($row[$i]) . '\'';
|
$where_comparison = ' = \'' . PMA_sqlAddslashes($row[$i]) . '\'';
|
||||||
$vertical_display['data'][$row_no][$i] = '<td ' . PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options);
|
$vertical_display['data'][$row_no][$i] = '<td ' . PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $row[$i], $transform_function, $default_function, $nowrap, $where_comparison, $transform_options, $is_field_truncated);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$vertical_display['data'][$row_no][$i] = ' <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"> </td>' . "\n";
|
$vertical_display['data'][$row_no][$i] = ' <td' . $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . '"> </td>' . "\n";
|
||||||
@@ -2329,11 +2332,14 @@ function PMA_handle_non_printable_contents($category, $content, $transform_funct
|
|||||||
* @param string $where_comparison
|
* @param string $where_comparison
|
||||||
* @return string formatted data
|
* @return string formatted data
|
||||||
*/
|
*/
|
||||||
function PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed_sql, $meta, $map, $data, $transform_function, $default_function, $nowrap, $where_comparison, $transform_options) {
|
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';
|
$data_inline_edit_class = 'data_inline_edit';
|
||||||
// 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 . ' ' . $data_inline_edit_class . '">';
|
$result = $mouse_events . ' class="' . $class . ($condition_field ? ' condition' : '') . $nowrap
|
||||||
|
. ' ' . $data_inline_edit_class . ($is_field_truncated ? ' truncated' : '')
|
||||||
|
. ($transform_function != $default_function ? ' transformed' : '')
|
||||||
|
. (isset($map[$meta->name]) ? ' relation' : '') . '">';
|
||||||
|
|
||||||
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
|
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
|
||||||
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
|
foreach ($analyzed_sql[0]['select_expr'] AS $select_expr_position => $select_expr) {
|
||||||
|
Reference in New Issue
Block a user