X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=clearadm%2Fviewager.cgi;h=150237a06a641f332101e9e5fc1392059f5e50dc;hb=83737e59d30d46e80259f07dd8d528b06dd43858;hp=1b978d9541b9877b0057950248b2b774ec140227;hpb=c8ff289be5d7e6a63d08eca398cc7be875a4978b;p=clearscm.git diff --git a/clearadm/viewager.cgi b/clearadm/viewager.cgi old mode 100755 new mode 100644 index 1b978d9..150237a --- a/clearadm/viewager.cgi +++ b/clearadm/viewager.cgi @@ -120,7 +120,7 @@ use warnings; use FindBin; use Getopt::Long; -use CGI qw (:standard :cgi-lib *table start_Tr end_Tr); +use CGI qw(:standard :cgi-lib *table start_Tr end_Tr); use CGI::Carp 'fatalsToBrowser'; use File::stat; use Time::localtime; @@ -162,7 +162,7 @@ my $script = 'http://' my %total; my $nbrThreshold; # Number of views threshold - think top 10 -sub GenerateRegion ($) { +sub GenerateRegion($) { my ($region) = @_; verbose "Processing region $region"; @@ -185,7 +185,7 @@ sub GenerateRegion ($) { verbose_nolf '.'; }# if - my $view = Clearcase::View->new ($name, $region); + my $view = Clearcase::View->new($name, $region); my $gpath; @@ -207,13 +207,13 @@ sub GenerateRegion ($) { # Note if the view server is unreachable (e.g. user puts view on laptop and # the laptop is powered off), then these fields will be undef. Change them # to Unknown. (Should Clearcase::View.pm do this instead?). - my $type = $view->type; - $type ||= 'Unknown'; + my $type = $view->type; + $type ||= 'dynamic'; + my $ownerid = $view->owner; + $ownerid ||= 'Unknown'; my $user; - my $ownerid = $view->owner; - if ($ownerid =~ /^\w+(\\|\/)(\w+)/) { # TODO: Handle user identification better #$user = User->new ($ownerid); @@ -246,7 +246,6 @@ sub GenerateRegion ($) { my ($err, $msg); my %viewRec = ( - system => $view->shost, region => $view->region, tag => $view->tag, owner => $ownerid, @@ -266,7 +265,7 @@ sub GenerateRegion ($) { error "Unable to update view $name in Clearadm\n$msg", $err if $err; } else { - ($err, $msg) = $clearadm->AddView (%viewRec); + ($err, $msg) = $clearadm->AddView(%viewRec); error "Unable to add view $name to Clearadm\n$msg", $err if $err; } # if @@ -280,12 +279,10 @@ sub GenerateRegion ($) { sub Generate ($) { my ($region) = @_; - if ($region =~ /all/i) { - for ($Clearcase::CC->regions) { - GenerateRegion $_; - } # for - } else { + if ($region) { GenerateRegion $region; + } else { + GenerateRegion $_ for $Clearcase::CC->regions; } # if return; @@ -345,7 +342,7 @@ $view{tag},$view{owner},$view{type},$view{modified},$view{age},$view{ageSuffix} return; } # Report -sub FormatTable ($@) { +sub FormatTable($@) { my ($style, @views) = @_; my $table; @@ -364,12 +361,12 @@ sub FormatTable ($@) { my $caption; - my $regionDropdown = start_form ( + my $regionDropdown = start_form( -action => $script, ); $regionDropdown .= font {-class => 'captionLabel'}, 'Region: '; - $regionDropdown .= popup_menu ( + $regionDropdown .= popup_menu( -name => 'region', -values => [$Clearcase::CC->regions], -default => $Clearcase::CC->region, @@ -526,12 +523,12 @@ sub FormatTable ($@) { # TODO: Add an option to remove views older than a certain date -sub EmailUser ($@) { +sub EmailUser($@) { my ($emailTo, @oldViews) = @_; @oldViews = sort { $$b{age} <=> $$a{age} } @oldViews; - my $msg = ''; + my $msg = ''; $msg .= <<"END";