Compare commits

..

2 Commits

Author SHA1 Message Date
83bdc9bbd7 Cleanup indexes bar 2025-04-21 17:58:02 -07:00
ff375abc90 Highlight primary key 2025-04-21 17:49:07 -07:00

View File

@@ -438,6 +438,9 @@ class PMA_Index
$r .= '<table>';
$r .= '<thead>';
$r .= '<tr>';
if (! $print_mode) {
$r .= '<th colspan="2">' . __('Action') . '</th>';
}
$r .= '<th>' . __('Keyname') . '</th>';
$r .= '<th>' . __('Type') . '</th>';
$r .= '<th>' . __('Unique') . '</th>';
@@ -447,9 +450,6 @@ class PMA_Index
$r .= '<th>' . __('Collation') . '</th>';
$r .= '<th>' . __('Null') . '</th>';
$r .= '<th>' . __('Comment') . '</th>';
if (! $print_mode) {
$r .= '<th colspan="2">' . __('Action') . '</th>';
}
$r .= '</tr>';
$r .= '</thead>';
$r .= '<tbody>';
@@ -460,6 +460,37 @@ class PMA_Index
$r .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
if (! $print_mode) {
$this_params = $GLOBALS['url_params'];
$this_params['index'] = $index->getName();
$r .= '<td ' . $row_span . '>'
. ' <a href="tbl_indexes.php' . PMA_generate_common_url($this_params)
. '">' . PMA_getOnlyIcon('b_edit.png', __('Edit')) . '</a>'
. '</td>' . "\n";
$this_params = $GLOBALS['url_params'];
if ($index->getName() == 'PRIMARY') {
$this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY';
$this_params['message_to_show'] = __('The primary key has been dropped');
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
} else {
$this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP INDEX ' . PMA_backquote($index->getName());
$this_params['message_to_show'] = sprintf(__('Index %s has been dropped'), $index->getName());
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName());
}
$r .= '<td ' . $row_span . '>';
$r .= '<input type="hidden" class="drop_primary_key_index_msg" value="' . $js_msg . '" />';
$r .= ' <a ';
if ($GLOBALS['cfg']['AjaxEnable']) {
$r .= 'class="drop_primary_key_index_anchor" ';
}
$r .= ' href="sql.php' . PMA_generate_common_url($this_params)
. '" >'
. PMA_getOnlyIcon('b_drop.png', __('Drop')) . '</a>'
. '</td>' . "\n";
}
$r .= '<th ' . $row_span . '>' . htmlspecialchars($index->getName()) . '</th>';
$r .= '<td ' . $row_span . '>' . htmlspecialchars($index->getType()) . '</td>';
$r .= '<td ' . $row_span . '>' . $index->isUnique(true) . '</td>';
@@ -482,38 +513,6 @@ class PMA_Index
$r .= '<td ' . $row_span . '>'
. htmlspecialchars($index->getComments()) . '</td>';
}
if (! $print_mode) {
$this_params = $GLOBALS['url_params'];
$this_params['index'] = $index->getName();
$r .= '<td ' . $row_span . '>'
. ' <a href="tbl_indexes.php' . PMA_generate_common_url($this_params)
. '">' . PMA_getOnlyIcon('b_edit.png', __('Edit')) . '</a>'
. '</td>' . "\n";
$this_params = $GLOBALS['url_params'];
if ($index->getName() == 'PRIMARY') {
$this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY';
$this_params['message_to_show'] = __('The primary key has been dropped');
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
} else {
$this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP INDEX ' . PMA_backquote($index->getName());
$this_params['message_to_show'] = sprintf(__('Index %s has been dropped'), $index->getName());
$js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName());
}
$r .= '<td ' . $row_span . '>';
$r .= '<input type="hidden" class="drop_primary_key_index_msg" value="' . $js_msg . '" />';
$r .= ' <a ';
if ($GLOBALS['cfg']['AjaxEnable']) {
$r .= 'class="drop_primary_key_index_anchor" ';
}
$r .= ' href="sql.php' . PMA_generate_common_url($this_params)
. '" >'
. PMA_getOnlyIcon('b_drop.png', __('Drop')) . '</a>'
. '</td>' . "\n";
}
$r .= '</tr>';
} // end foreach $index['Sequences']