The branch, master has been updated
       via  ecb05de4f6a4cb0011f24465fe1985f8e7573986 (commit)
       via  694c1cdf751e1fcbe2435087e3cea0dcd85ca458 (commit)
      from  c0674103719c6b50e9d5abebf03ab70d3cb562b3 (commit)


- Log -----------------------------------------------------------------
commit ecb05de4f6a4cb0011f24465fe1985f8e7573986
Merge: c067410 694c1cd
Author: Marc Delisle <[email protected]>
Date:   Sun Oct 23 10:33:01 2011 -0400

    Fix merge conflicts

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |    1 +
 db_structure.php |   62 ++++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8cbadcc..fbfe496 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,7 @@ phpMyAdmin - ChangeLog
 3.4.8.0 (not yet released)
 - bug #3425230 [interface] enum data split at space char (more space to edit)
 - bug #3426840 [interface] ENUM/SET editor can't handle commas in values
+- bug #3427256 [interface] no links to browse/empty views and tables
 
 3.4.7.0 (2011-10-23)
 - bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = 
false
diff --git a/db_structure.php b/db_structure.php
index e486ce8..326680b 100644
--- a/db_structure.php
+++ b/db_structure.php
@@ -269,31 +269,57 @@ foreach ($tables as $keyname => $each_table) {
             .  htmlspecialchars($each_table['TABLE_NAME']) . '" />';
     }
 
+    /*
+     * Always activate links for Browse, Search and Empty, even if
+     * the icons are greyed, because
+     * 1. for views, we don't know the number of rows at this point
+     * 2. for tables, another source could have populated them since the
+     *    page was generated
+     *
+     * I could have used the PHP ternary conditional operator but I find
+     * the code easier to read without this operator.
+     */
     if ($each_table['TABLE_ROWS'] > 0 || $table_is_view) {
-        $browse_table = '<a href="sql.php?' . $tbl_url_query . '&amp;pos=0">' 
. $titles['Browse'] . '</a>';
-        $search_table = '<a href="tbl_select.php?' . $tbl_url_query . '">' . 
$titles['Search'] . '</a>';
-        $browse_table_label = '<a href="sql.php?' . $tbl_url_query . 
'&amp;pos=0">' . $truename . '</a>';
+        $may_have_rows = true;
+    } else {
+        $may_have_rows = false;
+    }
+    $browse_table = '<a href="sql.php?' . $tbl_url_query . '&amp;pos=0">';
+    if ($may_have_rows) {
+        $browse_table .= $titles['Browse'];
+    } else {
+        $browse_table .= $titles['NoBrowse'];
+    }
+    $browse_table .= '</a>';
+
+    $search_table = '<a href="tbl_select.php?' . $tbl_url_query . '">';
+    if ($may_have_rows) {
+        $search_table .= $titles['Search'];
     } else {
-        $browse_table = $titles['NoBrowse'];
-        $search_table = $titles['NoSearch'];
-        $browse_table_label = '<a href="tbl_structure.php?' . $tbl_url_query . 
'">' . $truename . '</a>';
+        $search_table .= $titles['NoSearch'];
     }
+    $search_table .= '</a>';
+
+    $browse_table_label = '<a href="sql.php?' . $tbl_url_query . 
'&amp;pos=0">' . $truename . '</a>';
 
     if (! $db_is_information_schema) {
-        if (! empty($each_table['TABLE_ROWS'])) {
-            $empty_table = '<a ';
-            if ($GLOBALS['cfg']['AjaxEnable']) {
-                $empty_table .= 'class="truncate_table_anchor"';
-            }
-            $empty_table .= ' href="sql.php?' . $tbl_url_query
-                 . '&amp;sql_query=';
-            $empty_table .= urlencode('TRUNCATE ' . 
PMA_backquote($each_table['TABLE_NAME']))
-                 . '&amp;message_to_show='
-                 . urlencode(sprintf(__('Table %s has been emptied'), 
htmlspecialchars($each_table['TABLE_NAME'])))
-                 .'">' . $titles['Empty'] . '</a>';
+        $empty_table = '<a ';
+        if ($GLOBALS['cfg']['AjaxEnable']) {
+            $empty_table .= 'class="truncate_table_anchor"';
+        }
+        $empty_table .= ' href="sql.php?' . $tbl_url_query
+             . '&amp;sql_query=';
+        $empty_table .= urlencode('TRUNCATE ' . 
PMA_backquote($each_table['TABLE_NAME']))
+             . '&amp;message_to_show='
+             . urlencode(sprintf(__('Table %s has been emptied'), 
htmlspecialchars($each_table['TABLE_NAME'])))
+             .'">';
+        if ($may_have_rows) {
+            $empty_table .= $titles['Empty'];
         } else {
-            $empty_table = $titles['NoEmpty'];
+            $empty_table .= $titles['NoEmpty'];
         }
+        $empty_table .= '</a>';
+
         $drop_query = 'DROP '
             . ($table_is_view ? 'VIEW' : 'TABLE')
             . ' ' . PMA_backquote($each_table['TABLE_NAME']);


hooks/post-receive
-- 
phpMyAdmin

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Phpmyadmin-git mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-git

Reply via email to