#!/usr/bin/perl -w # -*- perl -*- use P4CGI ; use strict ; # ################################################################# # CONFIGURATION INFORMATION # All config info should be in P4CGI.pm # ################################################################# # # View labels # ################################################################# # Get label my $label = P4CGI::cgi()->param("LABEL") ; &P4CGI::bail("No label specified") unless defined $label ; my $found ; # Get list of all labels and also check that supplied label exists my @labels ; &P4CGI::p4call(\@labels, "labels" ); foreach (@labels) { $_ =~ s/^Label (\S+).*$/$1/ ; if($_ eq $label) { $found = "Yes" ; } ; } # Print header print "", &P4CGI::start_page("Label $label", &P4CGI::ul_list("owner -- view user info", "view -- View changes for view")) ; &P4CGI::signalError("Label $label not in depot") unless $found ; my @otherLabels ; foreach (@labels) { next if ($_ eq $label) ; push @otherLabels,$_ ; } ; ### ### "Sort" otherlabels after "closeness" ### { my $lab=uc($label) ; my $len = length($lab) ; my @labs ; while($len > 3) { my @tmp ; my $l ; $len-- ; $lab = substr($lab,0,$len) ; foreach $l (@otherLabels) { if(uc(substr($l,0,$len)) eq $lab) { push @labs,$l ; } else { push @tmp,$l ; } } @otherLabels = @tmp ; } ; @otherLabels = (@labs,@otherLabels) ; } # Get label info print "", &P4CGI::start_table("") ; my %values ; my @fields = &P4CGI::p4readform("label -o \"$label\"",\%values) ; # Fix description field if(exists $values{"Description"}) { my $d = $values{"Description"} ; $values{"Description"} = "
$d" ; } # Fix owner field if (exists $values{"Owner"}) { # Get real user names... my %userCvt ; { my @users ; &P4CGI::p4call(\@users, "users" ); %userCvt = map { /^(\S+).*> \((.+)\) .*$/ ; ($1,$2) ; } @users ; } my $u = $values{"Owner"} ; if(exists $userCvt{$u}) { $values{"Owner"} = &P4CGI::ahref(-url=>"userView.cgi", "USER=$u", "$u") . " (" . $userCvt{$u} . ")" ; } else { $values{"Owner"} = "$u (Unknown user)" ; } } # Fix view field my $viewFSPC = $values{"View"} ; my $view ; foreach (split("\n",$values{"View"})) { my $t = &P4CGI::ahref(-url => "depotTreeBrowser.cgi", "FSPC=$_", "$_") ; if (defined $view) { $view .= "