From bbce998c2f39176255548e86f66a2a2c320218c8 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 15 Feb 2008 02:24:17 +0000 Subject: [PATCH] Option to show just database names: --- mysql/CHANGELOG | 2 ++ mysql/config.info | 2 +- mysql/edit_dbase.cgi | 19 ++++++++++++++++++- mysql/index.cgi | 14 +++++++++++++- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/mysql/CHANGELOG b/mysql/CHANGELOG index 6e019df47..da5887f7d 100644 --- a/mysql/CHANGELOG +++ b/mysql/CHANGELOG @@ -66,3 +66,5 @@ When there are too many databases, huge lists of all databases and tables are no System variables can now be searched using a new field, making it easier to find the one you want from the large list on some systems. Re-designed the Execute SQL page to use tabs. Converted all user interface code to use the new Webmin UI library, for a more consistent look. +---- Changes since 1.400 ---- +Added a Module Config option to show databases and tables using just their names, which is much faster under MySQL 5 as it avoids the need to count their tables, fields and rows. diff --git a/mysql/config.info b/mysql/config.info index 5da1d0eb3..11a90fa71 100644 --- a/mysql/config.info +++ b/mysql/config.info @@ -2,7 +2,7 @@ line1=Configurable options,11 login=Administration login,0 pass=Administration password,12 perpage=Number of rows to display per page,0,5 -style=Show databases and tables as,1,1-List,0-Icons +style=Show databases and tables as,1,1-List,0-Icons,2-Names only add_mode=Use vertical row editing interface,1,1-Yes,0-No blob_mode=Show blob and text fields as,1,0-Data in table,1-Links to download nodbi=Use DBI to connect if available?,1,0-Yes,1-No diff --git a/mysql/edit_dbase.cgi b/mysql/edit_dbase.cgi index 01b83d4d2..9cf463761 100755 --- a/mysql/edit_dbase.cgi +++ b/mysql/edit_dbase.cgi @@ -64,6 +64,10 @@ elsif (@titles || @indexes) { ( map { "edit_view.cgi?db=$in{'db'}&view=".&urlize($_) } @views ), ); + @descs = ( ( map { "" } @titles ), + ( map { " ($text{'dbase_index'})" } @indexes), + ( map { " ($text{'dbase_view'})" } @views), + ); #&show_buttons(); print &ui_form_start("drop_tables.cgi"); print &ui_hidden("db", $in{'db'}); @@ -74,7 +78,8 @@ elsif (@titles || @indexes) { ( map { "!".$_ } @indexes ), ( map { "*".$_ } @views ), ); - if ($displayconfig{'style'}) { + if ($displayconfig{'style'} == 1) { + # Show table names, fields and row counts foreach $t (@titles) { local $c = &execute_sql($in{'db'}, "select count(*) from ".quotestr($t)); @@ -98,7 +103,19 @@ elsif (@titles || @indexes) { \@checks, \@links, \@dtitles, \@rows, \@fields) if (@titles); } + elsif ($displayconfig{'style'} == 2) { + # Just show table names + @grid = ( ); + @all = ( @titles, @indexes, @views ); + for(my $i=0; $i<@links; $i++) { + push(@grid, &ui_checkbox("d", $checks[$i]). + " ". + &html_escape($all[$i])." ".$descs[$i].""); + } + print &ui_grid_table(\@grid, 4, 100, undef, undef, ""); + } else { + # Show table icons @checks = map { &ui_checkbox("d", $_) } @checks; @titles = map { &html_escape($_) } ( @titles, @indexes, @views); &icons_table(\@links, \@titles, \@icons, 5, undef, undef, undef, diff --git a/mysql/index.cgi b/mysql/index.cgi index 369baae6e..51c739fb1 100755 --- a/mysql/index.cgi +++ b/mysql/index.cgi @@ -165,7 +165,8 @@ else { } print &ui_links_row(\@rowlinks); @checks = @titles; - if ($config{'style'}) { + if ($displayconfig{'style'} == 1) { + # Show as DB names and table counts @tables = map { @t = &list_tables($_); scalar(@t) } @titles; @titles = map { &html_escape($_) } @titles; @@ -174,7 +175,18 @@ else { \@checks, \@links, \@titles, \@tables) if (@titles); } + elsif ($displayconfig{'style'} == 2) { + # Show just DB names + @grid = ( ); + for(my $i=0; $i<@links; $i++) { + push(@grid, &ui_checkbox("d", $titles[$i]). + " ". + &html_escape($titles[$i]).""); + } + print &ui_grid_table(\@grid, 4, 100, undef, undef, ""); + } else { + # Show name icons @checks = map { &ui_checkbox("d", $_) } @checks; @titles = map { &html_escape($_) } @titles; &icons_table(\@links, \@titles, \@icons, 5,