Make package mode more useful
authorJamie Cameron <jcameron@webmin.com>
Tue, 5 Jan 2010 08:22:35 +0000 (00:22 -0800)
committerJamie Cameron <jcameron@webmin.com>
Tue, 5 Jan 2010 08:22:35 +0000 (00:22 -0800)
package-updates/index.cgi
package-updates/lang/en
software/yum-lib.pl

index f05f382..6d57b0f 100755 (executable)
@@ -21,7 +21,7 @@ else {
 
 # Show mode selector (all, updates only, updates and new)
 @grid = ( );
-foreach $m ('all', 'updates', 'new', 'both',
+foreach $m ('current', 'updates', 'new',
            $sec ? ( 'security' ) : ( )) {
        $mmsg = $text{'index_mode_'.$m};
        if ($in{'mode'} eq $m) {
@@ -67,16 +67,16 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) {
                       &text('index_new', $a->{'version'})."</font></b>";
                $need = 1;
                next if ($in{'mode'} eq 'security' && !$a->{'security'});
-               next if ($in{'mode'} ne 'both' && $in{'mode'} ne 'updates' &&
-                        $in{'mode'} ne 'all' && $in{'mode'} ne 'security');
+               next if ($in{'mode'} ne 'updates' &&
+                        $in{'mode'} ne 'current' &&
+                        $in{'mode'} ne 'security');
                }
        elsif ($a && !$c) {
                # Could be installed, but isn't currently
                next if (!&installation_candiate($a));
                $msg = "<font color=#00aa00>$text{'index_caninstall'}</font>";
                $need = 0;
-               next if ($in{'mode'} ne 'both' && $in{'mode'} ne 'new' &&
-                        $in{'mode'} ne 'all');
+               next if ($in{'mode'} ne 'new');
                }
        elsif (!$a->{'version'} && $c->{'updateonly'}) {
                # No update exists, and we don't care unless there is one
@@ -87,13 +87,13 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) {
                $msg = "<font color=#ffaa00><b>".
                        &text('index_noupdate', $c->{'version'})."</b></font>";
                $need = 0;
-               next if ($in{'mode'} ne 'all');
+               next if ($in{'mode'} ne 'current');
                }
        else {
                # We have the latest
                $msg = &text('index_ok', $c->{'version'});
                $need = 0;
-               next if ($in{'mode'} ne 'all');
+               next if ($in{'mode'} ne 'current');
                }
        $source = ucfirst($a->{'source'});
        if ($a->{'security'}) {
@@ -149,6 +149,12 @@ print &ui_form_columns_table(
        $text{'index_none_'.$in{'mode'}},
        1
        );
+if (!@rows) {
+       print &ui_form_start("update.cgi");
+       print &ui_hidden("mode", $in{'mode'});
+       print &ui_hidden("search", $in{'search'});
+       print &ui_form_end([ [ "refresh", $text{'index_refresh'} ] ]);
+       }
 
 # Show scheduled report form
 print "<hr>\n";
index cb58991..03be72f 100644 (file)
@@ -29,9 +29,8 @@ index_caninstall=Available for installation
 index_webmin=Webmin module $1
 index_webmintheme=Webmin theme $1
 index_mode=States to display:
-index_mode_all=Everything
+index_mode_current=Installed
 index_mode_updates=Only updates
-index_mode_both=Updates and new
 index_mode_new=Only new
 index_mode_security=Only security updates
 index_allsel=Packages to show:
index 3de2eec..d8de7df 100755 (executable)
@@ -236,7 +236,7 @@ while(<PKG>) {
                if ($pkg->{'version'} =~ s/^(\S+)://) {
                        $pkg->{'epoch'} = $1;
                        }
-               $done{$pkg} = $pkg->{'name'};
+               $done{$pkg->{'name'}} = $pkg;
                push(@rv, $pkg);
                }
        }