Option to show just DB and table names
authorJamie Cameron <jcameron@webmin.com>
Fri, 15 Feb 2008 06:18:03 +0000 (06:18 +0000)
committerJamie Cameron <jcameron@webmin.com>
Fri, 15 Feb 2008 06:18:03 +0000 (06:18 +0000)
postgresql/CHANGELOG
postgresql/config.info
postgresql/edit_dbase.cgi
postgresql/edit_index.cgi
postgresql/edit_seq.cgi
postgresql/edit_view.cgi
postgresql/index.cgi
postgresql/lang/en

index e13da54..7334a3d 100644 (file)
@@ -62,3 +62,5 @@ Re-wrote the backup form to use the new Webmin UI library.
 Improved support for Debian/Ubuntu systems that can have different PostgreSQL versions.
 ---- Changes since 1.380 ----
 Fixed a bug that prevented 'Jump to row' from working properly.
+---- Changes since 1.400 ----
+Added a Module Config option to show databases and tables using just their names.
index 0a39c6d..5819f09 100644 (file)
@@ -3,7 +3,7 @@ login=Administration login,0
 pass=Administration password,12
 sameunix=Unix user to connect to database as,1,1-Same as Administration login,0-root
 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
index 02ed562..9bd1e92 100755 (executable)
@@ -79,6 +79,11 @@ elsif (@titles || @indexes || @views || @seqs) {
                   ( map { "edit_seq.cgi?db=$in{'db'}&seq=".&urlize($_) }
                          @seqs ),
                 );
+        @descs = ( ( map { "" } @titles ),
+                   ( map { " ($text{'dbase_index'})" } @indexes),
+                   ( map { " ($text{'dbase_view'})" } @views),
+                   ( map { " ($text{'dbase_seq'})" } @seqs),
+                 );
        #&show_buttons();
        @rowlinks = ( );
        if ($access{'tables'}) {
@@ -94,7 +99,7 @@ elsif (@titles || @indexes || @views || @seqs) {
                }
        print &ui_links_row(\@rowlinks);
        @dtitles = map { &html_escape($_) } ( @titles, @indexes, @views,@seqs );
-       if ($displayconfig{'style'}) {
+       if ($displayconfig{'style'} == 1) {
                # Show as table
                foreach $t (@titles) {
                        local $c = &execute_sql($in{'db'},
@@ -122,6 +127,18 @@ elsif (@titles || @indexes || @views || @seqs) {
                             \@checks, \@links, \@dtitles,
                             \@rows, \@fields) if (@titles);
                }
+        elsif ($displayconfig{'style'} == 2) {
+                # Just show table names
+                @grid = ( );
+                @all = ( @titles, @indexes, @views, @seqs );
+                for(my $i=0; $i<@links; $i++) {
+                        push(@grid, &ui_checkbox("d", $checks[$i]).
+                          " <a href='$links[$i]'>".
+                          &html_escape($all[$i])." ".$descs[$i]."</a>");
+                        }
+                print &ui_grid_table(\@grid, 4, 100, undef, undef,
+                                    $text{'dbase_header'});
+                }
        else {
                # Show as icons
                @checks = map { &ui_checkbox("d", $_) } @checks;
index 98e0a01..e507de3 100755 (executable)
@@ -24,7 +24,7 @@ print &ui_form_start("save_index.cgi", "post");
 print &ui_hidden("db", $in{'db'}),"\n";
 print &ui_hidden("table", $table),"\n";
 print &ui_hidden("old", $in{'index'}),"\n";
-print &ui_table_start($text{'index_header1'}, undef, 2);
+print &ui_table_start($text{'index_header1'}, undef, 2, [ "width=30%" ]);
 
 # Index name
 print &ui_table_row($text{'index_name'},
index 2c89209..41a20fe 100755 (executable)
@@ -22,7 +22,7 @@ $desc = "<tt>$in{'db'}</tt>";
 print &ui_form_start("save_seq.cgi", "post");
 print &ui_hidden("db", $in{'db'}),"\n";
 print &ui_hidden("old", $in{'seq'}),"\n";
-print &ui_table_start($text{'seq_header1'}, undef, 2);
+print &ui_table_start($text{'seq_header1'}, undef, 2, [ "width=30%" ]);
 
 # Sequence name
 print &ui_table_row($text{'seq_name'},
index 3731db9..fd8a38d 100755 (executable)
@@ -18,7 +18,7 @@ $desc = "<tt>$in{'db'}</tt>";
 print &ui_form_start("save_view.cgi", "post");
 print &ui_hidden("db", $in{'db'}),"\n";
 print &ui_hidden("old", $in{'view'}),"\n";
-print &ui_table_start($text{'view_header1'}, undef, 2);
+print &ui_table_start($text{'view_header1'}, undef, 2, [ "width=30%" ]);
 
 # View name
 print &ui_table_row($text{'view_name'},
index 797a919..33b3644 100755 (executable)
@@ -202,7 +202,8 @@ else {
                        }
                print &ui_links_row(\@rowlinks);
                @checks = @titles;
-               if ($config{'style'}) {
+               if ($config{'style'} == 1) {
+                       # Show as DB names and table counts
                        @tables = map { if (&accepting_connections($_)) {
                                                my @t = &list_tables($_);
                                                scalar(@t);
@@ -217,6 +218,16 @@ else {
                                     \@checks, \@links, \@titles, \@tables)
                                if (@titles);
                        }
+               elsif ($config{'style'} == 2) {
+                        # Show just DB names
+                        @grid = ( );
+                        for(my $i=0; $i<@links; $i++) {
+                                push(@grid, &ui_checkbox("d", $titles[$i]).
+                                  " <a href='$links[$i]'>".
+                                  &html_escape($titles[$i])."</a>");
+                                }
+                        print &ui_grid_table(\@grid, 4, 100, undef, undef, "");
+                       }
                else {
                        # Show databases as icons
                        @checks = map { &ui_checkbox("d", $_) } @checks;
index 5722089..1bb488f 100644 (file)
@@ -54,6 +54,7 @@ login_epass=Incorrect administration username or password
 
 dbase_title=Edit Database
 dbase_noconn=This database is not currently accepting connections, so no actions can be performed in it.
+dbase_header=Database tables, indexes, views and sequences
 dbase_tables=Database Tables
 dbase_add=Create Table
 dbase_vadd=Create View