rfe #854911 [interface] Grey out non applicable actions in structure

This commit is contained in:
Marc Delisle
2010-01-21 21:29:10 +00:00
parent 1a6e594442
commit be348f66cc
3 changed files with 23 additions and 6 deletions

View File

@@ -26,6 +26,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
+ rfe #1186511 [inrerface] Add link to reload navigation frame.
+ rfe #2936156 [auth] Signon authentication forwards error message through session data.
+ rfe #2835109 [interface] Move ^1 to the end of message.
+ rfe #854911 [interface] Grey out non applicable actions in structure
3.3.0.0 (not yet released)
+ rfe #2308632 [edit] Use hex for (var)binary fields,

View File

@@ -1,7 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* holds the datasbe index class
* holds the database index class
*
* @version $Id$
* @package phpMyAdmin
@@ -308,6 +308,11 @@ class PMA_Index
return $this->_type;
}
public function getChoice()
{
return $this->_choice;
}
/**
* Return a list of all index choices
*

View File

@@ -111,6 +111,16 @@ require_once './libraries/Index.class.php';
// @todo should be: $server->db($db)->table($table)->primary()
$primary = PMA_Index::getPrimary($table, $db);
$columns_with_unique_index = array();
foreach (PMA_Index::getFromTable($table, $db) as $index) {
if ($index->isUnique() && $index->getChoice() == 'UNIQUE') {
$columns = $index->getColumns();
foreach ($columns as $column_name => $dummy) {
$columns_with_unique_index[$column_name] = 1;
}
}
}
unset($index, $columns, $column_name, $dummy);
// 3. Get fields
$fields_rs = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
@@ -314,16 +324,17 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
$field_encoded = urlencode($row['Field']);
$field_name = htmlspecialchars($row['Field']);
$displayed_field_name = $field_name;
// garvin: underline commented fields and display a hover-title (CSS only)
$comment_style = '';
if (isset($comments_map[$row['Field']])) {
$field_name = '<span style="border-bottom: 1px dashed black;" title="' . htmlspecialchars($comments_map[$row['Field']]) . '">' . $field_name . '</span>';
$displayed_field_name = '<span style="border-bottom: 1px dashed black;" title="' . htmlspecialchars($comments_map[$row['Field']]) . '">' . $field_name . '</span>';
}
if ($primary && $primary->hasColumn($field_name)) {
$field_name = '<u>' . $field_name . '</u>';
$displayed_field_name = '<u>' . $field_name . '</u>';
}
echo "\n";
?>
@@ -334,7 +345,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<td align="right">
<?php echo $rownum; ?>
</td>
<th nowrap="nowrap"><label for="checkbox_row_<?php echo $rownum; ?>"><?php echo $field_name; ?></label></th>
<th nowrap="nowrap"><label for="checkbox_row_<?php echo $rownum; ?>"><?php echo $displayed_field_name; ?></label></th>
<td<?php echo $type_nowrap; ?>><bdo dir="ltr" xml:lang="en"><?php echo $type; echo $type_mime; ?></bdo></td>
<td><?php echo (empty($field_charset) ? '' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>'); ?></td>
<td nowrap="nowrap" style="font-size: 70%"><?php echo $attribute; ?></td>
@@ -368,7 +379,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
</td>
<td align="center">
<?php
if ($type == 'text' || $type == 'blob' || 'ARCHIVE' == $tbl_type) {
if ($type == 'text' || $type == 'blob' || 'ARCHIVE' == $tbl_type || ($primary && $primary->hasColumn($field_name))) {
echo $titles['NoPrimary'] . "\n";
} else {
echo "\n";
@@ -383,7 +394,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
</td>
<td align="center">
<?php
if ($type == 'text' || $type == 'blob' || 'ARCHIVE' == $tbl_type) {
if ($type == 'text' || $type == 'blob' || 'ARCHIVE' == $tbl_type || isset($columns_with_unique_index[$field_name])) {
echo $titles['NoUnique'] . "\n";
} else {
echo "\n";