diff options
author | Thilina Buddika <thilinaabeyrathna@gmail.com> | 2012-08-06 21:43:24 +0400 |
---|---|---|
committer | Thilina Buddika <thilinaabeyrathna@gmail.com> | 2012-08-06 21:43:24 +0400 |
commit | 831e847d04802d6dbb3c8139b9de0a56b1a17b3d (patch) | |
tree | 26401f115c2cce6059ed69d48999184693c71927 /db_structure.php | |
parent | 51482c02edebdf32d5a51ad2d7ecad43f0c79433 (diff) |
implementation of PMA_getHtmlForActionLinks()
Diffstat (limited to 'db_structure.php')
-rw-r--r-- | db_structure.php | 71 |
1 files changed, 12 insertions, 59 deletions
diff --git a/db_structure.php b/db_structure.php index ceb281d9c3..8aef7883a3 100644 --- a/db_structure.php +++ b/db_structure.php @@ -10,6 +10,11 @@ */ require_once 'libraries/common.inc.php'; +/** + * Function implementations for this script + */ +require_once 'libraries/structure.lib.php'; + $response = PMA_Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); @@ -337,51 +342,14 @@ foreach ($tables as $keyname => $each_table) { * 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) { - $may_have_rows = true; - } else { - $may_have_rows = false; - } - $browse_table = '<a href="sql.php?' . $tbl_url_query . '&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 { - $search_table .= $titles['NoSearch']; - } - $search_table .= '</a>'; - - $browse_table_label = '<a href="sql.php?' . $tbl_url_query . '&pos=0">' . $truename . '</a>'; - + list($browse_table, $search_table, $browse_table_label, $empty_table, + $tracking_icon + ) = PMA_getHtmlForActionLinks( + $each_table, $table_is_view, $tbl_url_query, + $titles, $truename, $db_is_information_schema, $url_query + ); + if (! $db_is_information_schema) { - $empty_table = '<a '; - if ($GLOBALS['cfg']['AjaxEnable']) { - $empty_table .= 'class="truncate_table_anchor"'; - } - $empty_table .= ' href="sql.php?' . $tbl_url_query - . '&sql_query='; - $empty_table .= urlencode('TRUNCATE ' . $common_functions->backquote($each_table['TABLE_NAME'])) - . '&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 .= '</a>'; - // truncating views doesn't work - if ($table_is_view) { - $empty_table = ' '; - } - $drop_query = 'DROP ' . (($table_is_view || $each_table['ENGINE'] == null) ? 'VIEW' : 'TABLE') . ' ' . $common_functions->backquote($each_table['TABLE_NAME']); @@ -391,21 +359,6 @@ foreach ($tables as $keyname => $each_table) { ); } - $tracking_icon = ''; - if (PMA_Tracker::isActive()) { - if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) { - $tracking_icon = '<a href="tbl_tracking.php?' . $url_query - . '&table=' . $truename . '">' - . $common_functions->getImage('eye.png', __('Tracking is active.')) - . '</a>'; - } elseif (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) { - $tracking_icon = '<a href="tbl_tracking.php?' . $url_query - . '&table=' . $truename . '">' - . $common_functions->getImage('eye.png', __('Tracking is not active.')) - . '</a>'; - } - } - if ($num_columns > 0 && $num_tables > $num_columns && ($row_count % $num_columns) == 0 |