lu.cgi #1

  • //
  • guest/
  • perforce_software/
  • utils/
  • p4db/
  • P4DB_0/
  • lu.cgi
  • View
  • Commits
  • Open Download .zip Download (3 KB)
#!/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(<P4>) {
    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(<P4>) {
    chomp ;
    $reviews = "" unless defined $reviews ;    
    $reviews .= $_ ;
} ;
close P4 ;

print "",
    &P4CGI::start_page("User $user ($fullname)",
		       &P4CGI::ul_list("<b>e-mail address</b> -- 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(<P4>) {
    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(),
				 "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&nbsp;files:"},
			     "<pre>$openfiles</pre>") ;
} ;


print 
    &P4CGI::end_table(),
    &P4CGI::end_page() ;

#
# That's it folks
#




# Change User Description Committed
#2 5416 michael Provide pointers to P4DB in //guest branch
and remove from //public. Provide link to
security notice in Bugtraq.
#1 1885 rmg For posterity:
Make the old version appear in a "P4DB_0" subdirectory.
(I'd have called it 0.99, but I'm not sure it really *is*
0.99!)
//guest/perforce_software/utils/p4db/lu.cgi
#1 11 Perforce maintenance Add Fredric Fredricson's depot browser, P4DB.