X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;ds=inline;f=clearadm%2Fviewager.cgi;h=150237a06a641f332101e9e5fc1392059f5e50dc;hb=a9acda90df2ba4a4777fe263005a5d45ffd869e0;hp=9ac1b1e71b15107317cdbc116edec19f344cbf73;hpb=0c802537ec02d6cfea4c41b3138535c09a319489;p=clearscm.git diff --git a/clearadm/viewager.cgi b/clearadm/viewager.cgi old mode 100755 new mode 100644 index 9ac1b1e..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); @@ -239,8 +239,6 @@ sub GenerateRegion ($) { # Compute age $age = Age ($modified_date); $ageSuffix = $age != 1 ? 'days' : 'day'; - #} else { - # $modified_date = 'Unknown'; } # if my %oldView = $clearadm->GetView($view->tag, $view->region); @@ -248,7 +246,6 @@ sub GenerateRegion ($) { my ($err, $msg); my %viewRec = ( - system => $view->shost, region => $view->region, tag => $view->tag, owner => $ownerid, @@ -264,11 +261,11 @@ sub GenerateRegion ($) { $viewRec{modified} = $modified_date if $modified_date; if (%oldView) { - ($err, $msg) = $clearadm->UpdateView($view->tag, $view->region, %viewRec); + ($err, $msg) = $clearadm->UpdateView(%viewRec); 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 @@ -282,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; @@ -347,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; @@ -366,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, @@ -528,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";