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 #1186511 [inrerface] Add link to reload navigation frame.
+ rfe #2936156 [auth] Signon authentication forwards error message through session data. + rfe #2936156 [auth] Signon authentication forwards error message through session data.
+ rfe #2835109 [interface] Move ^1 to the end of message. + 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) 3.3.0.0 (not yet released)
+ rfe #2308632 [edit] Use hex for (var)binary fields, + rfe #2308632 [edit] Use hex for (var)binary fields,

View File

@@ -1,7 +1,7 @@
<?php <?php
/* vim: set expandtab sw=4 ts=4 sts=4: */ /* vim: set expandtab sw=4 ts=4 sts=4: */
/** /**
* holds the datasbe index class * holds the database index class
* *
* @version $Id$ * @version $Id$
* @package phpMyAdmin * @package phpMyAdmin
@@ -308,6 +308,11 @@ class PMA_Index
return $this->_type; return $this->_type;
} }
public function getChoice()
{
return $this->_choice;
}
/** /**
* Return a list of all index choices * 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() // @todo should be: $server->db($db)->table($table)->primary()
$primary = PMA_Index::getPrimary($table, $db); $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 // 3. Get fields
$fields_rs = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE); $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_encoded = urlencode($row['Field']);
$field_name = htmlspecialchars($row['Field']); $field_name = htmlspecialchars($row['Field']);
$displayed_field_name = $field_name;
// garvin: underline commented fields and display a hover-title (CSS only) // garvin: underline commented fields and display a hover-title (CSS only)
$comment_style = ''; $comment_style = '';
if (isset($comments_map[$row['Field']])) { 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)) { if ($primary && $primary->hasColumn($field_name)) {
$field_name = '<u>' . $field_name . '</u>'; $displayed_field_name = '<u>' . $field_name . '</u>';
} }
echo "\n"; echo "\n";
?> ?>
@@ -334,7 +345,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
<td align="right"> <td align="right">
<?php echo $rownum; ?> <?php echo $rownum; ?>
</td> </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 $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><?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> <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>
<td align="center"> <td align="center">
<?php <?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"; echo $titles['NoPrimary'] . "\n";
} else { } else {
echo "\n"; echo "\n";
@@ -383,7 +394,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
</td> </td>
<td align="center"> <td align="center">
<?php <?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"; echo $titles['NoUnique'] . "\n";
} else { } else {
echo "\n"; echo "\n";