#!/usr/bin/perl -w # -*- perl -*- use P4CGI ; use strict ; # ################################################################# # CONFIGURATION INFORMATION # All config info should be in P4CGI.pm # ################################################################# # # P4 list user # List a p4 user # ################################################################# # Get parameter my $user = P4CGI::cgi()->param("USER") ; unless(defined $user) { &P4CGI::bail("No user specified!") ; } ; # Get user info local *P4 ; &P4CGI::p4call(*P4, "user -o $user" ); my $email ; my $update ; my $access ; my $fullname ; my $jobview ; my $reviews ; while() { chomp ; next if /^#/ ; next if /^\s*$/ ; /^Email:\s(\S+)/ and do { $email=&P4CGI::ahref(-url => "mailto:$1",$1) ; } ; /^Update:\s(.*)$/ and do { $update=$1 ; } ; /^Access:\s(.*)$/ and do { $access=$1 ; } ; /^FullName:\s(.*)$/ and do { $fullname=$1 ; } ; /^JobView:\s(.*)$/ and do { $jobview=$1 ; } ; last if /^Reviews:/ ; } while() { chomp ; $reviews = "" unless defined $reviews ; $reviews .= $_ ; } ; close P4 ; print "", &P4CGI::start_page("User $user ($fullname)", &P4CGI::ul_list("e-mail address -- e-mail user")) ; print &P4CGI::start_table(""), &P4CGI::table_row({-align => "right", -type => "th", -text => "Email:"}, $email), &P4CGI::table_row({-align => "right", -type => "th", -text => "Update:"}, $update), &P4CGI::table_row({-align => "right", -type => "th", -text => "Access:"}, $access), &P4CGI::table_row({-align => "right", -type => "th", -text => "FullName:"}, $fullname), &P4CGI::table_row({-align => "right", -type => "th", -text => "JobView:"}, $jobview) ; if(defined $reviews) { print &P4CGI::table_row({-align => "right", -type => "th", -text => "Reviews:"}, $reviews) ; } ; my $openfiles ; &P4CGI::p4call(*P4, "opened -a" ); while() { chomp ; / by $user\@/ and do { /^(\S*) -.* by \w+\@(\S+)/ or P4CGI::bail("Can not read output from p4") ; my $file = $1 ; my $client = $2 ; $file =~ /(.*)\#(\d+)/ ; my $file = &P4CGI::ahref(-url => &P4CGI::FLV_URL(), &P4CGI::fixspaces("FSPC=$1"), "REV=$2", $file) ; if(defined $openfiles) { $openfiles .= "\n$file as client $client" ; } else { $openfiles = "$file as client $client" ; } ; } ; } ; if(defined $openfiles) { print &P4CGI::table_row({-align => "right", -type => "th", -valign => "top", -text => "Open files:"}, "
$openfiles
") ; } ; print &P4CGI::end_table(), &P4CGI::end_page() ; # # That's it folks #