#!/usr/bin/perl -w # -*- perl -*- use P4CGI ; use strict ; # ################################################################# # CONFIGURATION INFORMATION # All config info should be in P4CGI.pm # ################################################################# # # View a p4 client # ################################################################# # Get parameter my $client = P4CGI::cgi()->param("CLIENT") ; unless(defined $client) { &P4CGI::bail("No client specified!") ; } ; $client = &P4CGI::htmlEncode($client) ; # Get list of users and full names my %users ; &P4CGI::p4user2name(\%users ); # Get client info my %values ; my @fields = &P4CGI::p4readform("client -o '$client'",\%values); # Fix owner field if(exists $users{$values{"Owner"}}) { $values{"Owner"} = &P4CGI::ahref(-url => "userView.cgi" , "USER=$values{Owner}", "HELP=View user info", $values{"Owner"}) . " ($users{$values{Owner}})" ; } else { $values{"Owner"} .= " No such user" ; } ; # Fix up description { my @referenced ; $values{"Description"} = &P4CGI::formatDescription($values{"Description"}, \@referenced) ; } # Fix Root if(exists $values{"Root"}) { $values{"Root"} = "$values{Root}" ; } ; # Fix Options if(exists $values{"Options"}) { $values{"Options"} = "$values{Options}" ; } ; # Fix view { my $view = &P4CGI::start_table("border=0 cellspacing=0 cellpadding=0") ; foreach (split("\n",$values{"View"})) { last if /^\s*$/ ; my ($tmp,$lead1,$d,$lead2,$c) = split(/(\"?\/\/)/,$_) ; $d = "$lead1$d" ; $c = "$lead2$c" ; $view .= &P4CGI::table_row("$d"," $c") ; } ; $view .= &P4CGI::end_table() ; $values{"View"} = $view ; } $| = 1 ; print "", &P4CGI::start_page("", &P4CGI::buttonCell("changeList.cgi", "List changes by client $client", "CLIENT=$client", "FSPC=//...", "List changes")) ; # Check that client exist unless(exists $values{"Client"}) { &P4CGI::signalError("Client $client does not exist") ; } print &P4CGI::start_framedTable("Client $client"), &P4CGI::start_table("") ; my $f ; foreach $f (@fields) { my %xopt ; $xopt{"class"} = "Description" if $f eq "Description" ; $xopt{"class"} = "Description" if $f eq "View" ; print &P4CGI::table_row({-class => "Prompt", -text => $f}, {%xopt, -text => $values{$f}}) ; } ; my @openfiles ; &P4CGI::p4call(*P4, "opened -a " . &P4CGI::REDIRECT_ERROR_TO_NULL_DEVICE() ); while() { chomp ; /^(.+\#\d+) - (\S+) .* by (\S+)\@(\S+)/ and do { my $f = $1 ; my $u = $3 ; my $r = $2 ; my $c = $4 ; if($c eq $client) { $f =~ /(.*)\#(\d+)/ ; if($r ne "add") { $f = &P4CGI::ahref(-url => "fileLogView.cgi", "FSPC=$1", "REV=$2", "HELP=View file log", "$f") ; } $u = &P4CGI::ahref(-url => "userView.cgi", "USER=$u", "HELP=View user info", "$u") ; push @openfiles,&P4CGI::table_row({-class=>"ListC", -text => $r}, {-class=>"List", -text => $f}, {-class=>"ListC", -text => $u}) ; } ; } ; } ; if(@openfiles > 0) { print &P4CGI::table_row({-class => "Prompt", -text => "Open files:"}, &P4CGI::start_table(""). &P4CGI::table_header("Action","File","User") . join("\n",@openfiles) . &P4CGI::end_table()) ; } ; print &P4CGI::end_table(), &P4CGI::end_framedTable(), &P4CGI::end_page() ; # # That's all folks #