diff --git a/ChangeLog b/ChangeLog index 36c1ab444..59654499a 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,14 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-02-14 Michal Čihař + * tbl_printview.php, libraries/tbl_indexes.lib.php: Fix displaying + indexes for print view, use same function as for normal view (bug + #1119388). + * css/print.css, libraries/tbl_indexes.lib.php, + libraries/header_meta_style.inc.php: Use CSS for hiding print button + rather than javascript. + 2005-02-14 Marc Delisle * tbl_properties_table_info.php: avoid errors #1046, no database selected in MySQL 5.0.2 diff --git a/css/print.css b/css/print.css new file mode 100644 index 000000000..ada52c82c --- /dev/null +++ b/css/print.css @@ -0,0 +1,3 @@ +.print_ignore { + display: none; +} diff --git a/libraries/header_meta_style.inc.php b/libraries/header_meta_style.inc.php index b5c82072c..d9d77c52f 100644 --- a/libraries/header_meta_style.inc.php +++ b/libraries/header_meta_style.inc.php @@ -67,3 +67,4 @@ if (!empty($GLOBALS['cfg']['PmaAbsoluteUri'])) { + diff --git a/libraries/tbl_indexes.lib.php b/libraries/tbl_indexes.lib.php index fff7b2a6b..9359a4802 100644 --- a/libraries/tbl_indexes.lib.php +++ b/libraries/tbl_indexes.lib.php @@ -136,12 +136,16 @@ * @return array Index collection array * @author Garvin Hicking (pma@supergarv.de) */ - function PMA_show_indexes($table, &$indexes, &$indexes_info, &$indexes_data, $display_html = true) { + function PMA_show_indexes($table, &$indexes, &$indexes_info, &$indexes_data, $display_html = true, $print_mode = false) { $idx_collection = array(); foreach ($indexes AS $index_no => $index_name) { if ($display_html) { - $cell_bgd = (($index_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']); - $index_td = ' ' . "\n"; + if ($print_mode) { + $index_td = ' ' . "\n"; + } else { + $cell_bgd = (($index_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']); + $index_td = ' ' . "\n"; + } echo ' ' . "\n"; echo $index_td . ' ' . htmlspecialchars($index_name) . "\n" @@ -168,9 +172,11 @@ . ' ' . (isset($indexes_info[$index_name]['Cardinality']) ? $indexes_info[$index_name]['Cardinality'] : $GLOBALS['strNone']) . ' ' . "\n" . ' ' . "\n"; - echo $index_td - . ' ' . $GLOBALS['edit_link_text'] . '' . "\n" - . ' ' . "\n"; + if (!$print_mode) { + echo $index_td + . ' ' . $GLOBALS['edit_link_text'] . '' . "\n" + . ' ' . "\n"; + } if ($index_name == 'PRIMARY') { $local_query = urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY'); @@ -182,9 +188,11 @@ $zero_rows = urlencode(sprintf($GLOBALS['strIndexHasBeenDropped'], htmlspecialchars($index_name))); } - echo $index_td - . ' ' . $GLOBALS['drop_link_text'] . '' . "\n" - . ' ' . "\n"; + if (!$print_mode) { + echo $index_td + . ' ' . $GLOBALS['drop_link_text'] . '' . "\n" + . ' ' . "\n"; + } } foreach ($indexes_info[$index_name]['Sequences'] AS $row_no => $seq_index) { @@ -208,16 +216,22 @@ echo ' ' . "\n"; } + if ($print_mode) { + $bgcolor = 'class="print"'; + } else { + $bgcolor = 'bgcolor="' . $cell_bgd . '"'; + } + if (!empty($indexes_data[$index_name][$seq_index]['Sub_part'])) { - echo ' ' . "\n" + echo ' ' . "\n" . ' ' . $col_name . "\n" . ' ' . "\n"; - echo ' ' . "\n" + echo ' ' . "\n" . ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n" . ' ' . "\n"; echo ' ' . "\n"; } else { - echo ' ' . "\n" + echo ' ' . "\n" . ' ' . htmlspecialchars($col_name) . "\n" . ' ' . "\n"; echo ' ' . "\n"; @@ -260,4 +274,4 @@ $output .= "\n\n"; return $output; } -?> \ No newline at end of file +?> diff --git a/tbl_printview.php b/tbl_printview.php index 647481a8d..cc950aad8 100644 --- a/tbl_printview.php +++ b/tbl_printview.php @@ -21,6 +21,7 @@ if (!isset($the_tables) || !is_array($the_tables)) { */ require_once('./libraries/relation.lib.php'); require_once('./libraries/transformations.lib.php'); +require_once('./libraries/tbl_indexes.lib.php'); $cfgRelation = PMA_getRelationsParam(); @@ -86,47 +87,13 @@ foreach ($the_tables AS $key => $table) { PMA_DBI_free_result($result); - /** - * Gets table keys and retains them - */ - $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';'); - $primary = ''; + // Gets table keys and store them in arrays $indexes = array(); - $lastIndex = ''; $indexes_info = array(); $indexes_data = array(); - $pk_array = array(); // will be use to emphasis prim. keys in the table - // view - while ($row = PMA_DBI_fetch_assoc($result)) { - // Backups the list of primary keys - if ($row['Key_name'] == 'PRIMARY') { - $primary .= $row['Column_name'] . ', '; - $pk_array[$row['Column_name']] = 1; - } - // Retains keys informations - if ($row['Key_name'] != $lastIndex ){ - $indexes[] = $row['Key_name']; - $lastIndex = $row['Key_name']; - } - $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index']; - $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique']; - if (isset($row['Cardinality'])) { - $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality']; - } -// I don't know what does following column mean.... -// $indexes_info[$row['Key_name']]['Packed'] = $row['Packed']; - $indexes_info[$row['Key_name']]['Comment'] = $row['Comment']; - - $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name']; - if (isset($row['Sub_part'])) { - $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part']; - } - - } // end while - if ($result) { - PMA_DBI_free_result($result); - } + $ret_keys = PMA_get_indexes($table, $err_url_0); + PMA_extract_indexes($ret_keys, $indexes, $indexes_info, $indexes_data); /** * Gets fields properties @@ -311,51 +278,7 @@ foreach ($the_tables AS $key => $table) { $index_name) { - $cell_bgd = (($index_no % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']); - $index_td = ' ' . "\n"; - echo ' ' . "\n"; - echo $index_td - . ' ' . htmlspecialchars($index_name) . "\n" - . ' ' . "\n"; - - if ($indexes_info[$index_name]['Comment'] == 'FULLTEXT') { - $index_type = 'FULLTEXT'; - } else if ($index_name == 'PRIMARY') { - $index_type = 'PRIMARY'; - } else if ($indexes_info[$index_name]['Non_unique'] == '0') { - $index_type = 'UNIQUE'; - } else { - $index_type = 'INDEX'; - } - echo $index_td - . ' ' . $index_type . "\n" - . ' ' . "\n"; - - echo $index_td - . ' ' . (isset($indexes_info[$index_name]['Cardinality']) ? $indexes_info[$index_name]['Cardinality'] : $strNone) . "\n" - . ' ' . "\n"; - - foreach ($indexes_info[$index_name]['Sequences'] AS $row_no => $seq_index) { - if ($row_no > 0) { - echo ' ' . "\n"; - } - if (!empty($indexes_data[$index_name][$seq_index]['Sub_part'])) { - echo ' ' . "\n" - . ' ' . $indexes_data[$index_name][$seq_index]['Column_name'] . "\n" - . ' ' . "\n"; - echo ' ' . "\n" - . ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n" - . ' ' . "\n"; - echo ' ' . "\n"; - } else { - echo ' ' . "\n" - . ' ' . $indexes_data[$index_name][$seq_index]['Column_name'] . "\n" - . ' ' . "\n"; - echo ' ' . "\n"; - } - } // end while - } // end while + PMA_show_indexes($table, $indexes, $indexes_info, $indexes_data, true, true); echo "\n"; ?> @@ -615,17 +538,15 @@ echo "\n";
 ' . "\n"; +echo '

 ' . "\n"; require_once('./footer.inc.php'); ?>