diff --git a/db_central_columns.php b/db_central_columns.php index aaf3de92c4..6a0369641c 100644 --- a/db_central_columns.php +++ b/db_central_columns.php @@ -22,7 +22,7 @@ if (isset($_POST['edit_save']) || isset($_POST['add_new_column'])) { if ($col_default == 'NONE' && $_POST['col_default_sel'] != 'USER_DEFINED') { $col_default = ""; } - $col_extra = $_POST['col_extra']; + $col_extra = isset($_POST['col_extra']) ? $_POST['col_extra'] : ''; $col_isNull = isset($_POST['col_isNull'])?1:0; $col_length = $_POST['col_length']; $col_attribute = $_POST['col_attribute']; diff --git a/js/db_central_columns.js b/js/db_central_columns.js index 42499fde67..16c8ab07f4 100644 --- a/js/db_central_columns.js +++ b/js/db_central_columns.js @@ -76,12 +76,6 @@ AJAX.registerOnload('db_central_columns.js', function () { PMA_ajaxShowMessage(); $.post('db_central_columns.php', multi_column_edit_data, AJAX.responseHandler); }); - $('#multi_edit_central_columns #cancel_multi_edit').click(function(event){ - event.preventDefault(); - var cancel_edit = 'ajax_request=true&ajax_page_request=true&token='+PMA_commonParams.get('token')+'&db='+PMA_commonParams.get('db'); - PMA_ajaxShowMessage(); - $.get('db_central_columns.php', cancel_edit, AJAX.responseHandler); - }); $('#add_new td').each(function(){ if ($(this).attr('name') !== 'undefined') { $(this).find('input,select:first').attr('name', $(this).attr('name')); @@ -104,10 +98,8 @@ AJAX.registerOnload('db_central_columns.js', function () { $(this).hide(); $('#f_' + rownum + ' td span').hide(); $('#f_' + rownum + ' input, #f_' + rownum + ' select, #f_' + rownum + ' .open_enum_editor').show(); - var extra_val = $('#f_' + rownum + ' td[name=col_extra] span').html(); var attribute_val = $('#f_' + rownum + ' td[name=col_attribute] span').html(); $('#f_' + rownum + ' select[name=field_attribute\\['+ rownum +'\\] ] option[value="' + attribute_val + '"]').attr("selected","selected"); - $('#f_' + rownum + ' select[name=col_extra] option[value="' + extra_val + '"]').attr("selected","selected"); if($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') { $('#f_' + rownum + ' .default_type').siblings('.default_value').show(); } else { @@ -174,7 +166,7 @@ AJAX.registerOnload('db_central_columns.js', function () { $('#f_' + rownum + ' td[name=collation] span').text($('#f_' + rownum + ' select[name=collation]').val()).html(); $('#f_' + rownum + ' td[name=col_attribute] span').text($('#f_' + rownum + ' select[name=col_attribute]').val()).html(); $('#f_' + rownum + ' td[name=col_isNull] span').text($('#f_' + rownum +' input[name=col_isNull]').is(":checked")?"Yes":"No").html(); - $('#f_' + rownum + ' td[name=col_extra] span').text($('#f_' + rownum + ' select[name=col_extra]').val()).html(); + $('#f_' + rownum + ' td[name=col_extra] span').text($('#f_' + rownum + ' input[name=col_extra]').is(":checked") ? "auto_increment" : "").html(); $('#f_' + rownum + ' td[name=col_default] span').text($('#f_' + rownum + ' :input[name=col_default]').val()).html(); } $('#save_' + rownum).hide(); diff --git a/libraries/central_columns.lib.php b/libraries/central_columns.lib.php index e0807fa6c1..b69e937008 100644 --- a/libraries/central_columns.lib.php +++ b/libraries/central_columns.lib.php @@ -579,6 +579,9 @@ function PMA_updateMultipleColumn() } else if ($col_default[$i] == 'USER_DEFINED') { $col_default[$i] = $_POST['field_default_value'][$i]; } + if (! isset($_POST['col_extra'][$i])) { + $col_extra[$i] = ''; + } $message = PMA_updateOneColumn( $db, $orig_col_name[$i], $col_name[$i], $col_type[$i], $col_attribute[$i], $col_length[$i], $col_isNull[$i], $collation[$i], @@ -692,6 +695,8 @@ function PMA_getCentralColumnsTableHeader($class='', $title='', $actionCount=0) . __('Type') . '
' . '| ' - . '' . htmlspecialchars($row['col_collation']) . '' - . PMA_getHtmlForColumnCollation( - $row_num, 3, 0, array('Collation'=>$row['col_collation']) - ) - . ' | '; - $tableHtml .= - '' - . '' . - ($row['col_attribute'] - ? htmlspecialchars($row['col_attribute']) : "" ) - . '' - . PMA_getHtmlForColumnAttribute( - $row_num, 4, 0, array(), $row['col_attribute'], false, null - ) - . ' | '; - $tableHtml .= - '' - . '' . ($row['col_isNull'] ? __('Yes') : __('No')) - . '' - . PMA_getHtmlForColumnNull($row_num, 5, 0, array('Null'=>$row['col_isNull'])) - . ' | '; - - $tableHtml .= - '' - . htmlspecialchars($row['col_extra']) . '' - . '' - . ' | '; $meta = array(); if (!isset($row['col_default']) || $row['col_default'] == '') { $meta['DefaultType'] = 'NONE'; @@ -924,10 +897,44 @@ function PMA_getHTMLforCentralColumnsTableRow($row, $odd_row, $row_num, $db) ? htmlspecialchars($row['col_default']) : 'None') . '' . PMA_getHtmlForColumnDefault( - $row_num, 6, 0, /*overload*/mb_strtoupper($row['col_type']), '', $meta + $row_num, 3, 0, /*overload*/mb_strtoupper($row['col_type']), '', $meta ) . ''; + + $tableHtml .= + '' + . '' . htmlspecialchars($row['col_collation']) . '' + . PMA_getHtmlForColumnCollation( + $row_num, 4, 0, array('Collation'=>$row['col_collation']) + ) + . ' | '; + $tableHtml .= + '' + . '' . + ($row['col_attribute'] + ? htmlspecialchars($row['col_attribute']) : "" ) + . '' + . PMA_getHtmlForColumnAttribute( + $row_num, 5, 0, array(), $row['col_attribute'], false, null + ) + . ' | '; + $tableHtml .= + '' + . '' . ($row['col_isNull'] ? __('Yes') : __('No')) + . '' + . PMA_getHtmlForColumnNull($row_num, 6, 0, array('Null'=>$row['col_isNull'])) + . ' | '; + + $tableHtml .= + '' + . htmlspecialchars($row['col_extra']) . '' + . PMA_getHtmlForColumnExtra( + $row_num, 7, 0, array('Extra'=>$row['col_extra']) + ) + . ' | '; + $tableHtml .= '' . PMA_getHtmlForColumnLength($row_num, 2, 0, 8, $row['col_length']) . ' | '; - - $tableHtml .= - '' - . PMA_getHtmlForColumnCollation( - $row_num, 3, 0, array('Collation'=>$row['col_collation']) - ) - . ' | '; - $tableHtml .= - '' - . PMA_getHtmlForColumnAttribute( - $row_num, 4, 0, array("attribute"=>$row['col_attribute']), - array(), false, null - ) - . ' | '; - $tableHtml .= - '' - . PMA_getHtmlForColumnNull($row_num, 5, 0, array('Null'=>$row['col_isNull'])) - . ' | '; - $extra_val = $row['col_extra']; - $tableHtml .= - '' - . '' - . ' | '; $meta = array(); if (!isset($row['col_default']) || $row['col_default'] == '') { $meta['DefaultType'] = 'NONE'; } else { if ($row['col_default'] == 'CURRENT_TIMESTAMP' - || $row['col_default'] == 'NULL' + || $row['col_default'] == 'NULL' ) { $meta['DefaultType'] = $row['col_default']; } else { @@ -1006,7 +985,31 @@ function PMA_getHTMLforCentralColumnsEditTableRow($row, $odd_row, $row_num) $tableHtml .= '' . PMA_getHtmlForColumnDefault( - $row_num, 6, 0, /*overload*/mb_strtoupper($row['col_type']), '', $meta + $row_num, 3, 0, /*overload*/mb_strtoupper($row['col_default']), '', $meta + ) + . ' | '; + $tableHtml .= + '' + . PMA_getHtmlForColumnCollation( + $row_num, 4, 0, array('Collation'=>$row['col_collation']) + ) + . ' | '; + $tableHtml .= + '' + . PMA_getHtmlForColumnAttribute( + $row_num, 5, 0, array("attribute"=>$row['col_attribute']), + array(), false, null + ) + . ' | '; + $tableHtml .= + '' + . PMA_getHtmlForColumnNull($row_num, 6, 0, array('Null'=>$row['col_isNull'])) + . ' | '; + $extra_val = $row['col_extra']; + $tableHtml .= + '' + . PMA_getHtmlForColumnExtra( + $row_num, 7, 0, array('Extra' => $row['col_extra']) ) . ' | '; $tableHtml .= ''; @@ -1077,7 +1080,7 @@ function PMA_getCentralColumnsTableFooter($pmaThemeImage, $text_dir) $html_output .= PMA_Util::getButtonOrImage( 'delete_central_columns', 'mult_submit', 'submit_mult_central_columns_remove', - __('Delete'), 'centralColumns_delete.png', + __('Delete'), 'b_drop.png', 'remove_from_central_columns' ); return $html_output; @@ -1091,11 +1094,9 @@ function PMA_getCentralColumnsTableFooter($pmaThemeImage, $text_dir) */ function PMA_getCentralColumnsEditTableFooter() { - $html_output = '