#!/usr/bin/perl -w
# -*- perl -*-
use P4CGI ;
use strict ;
#
#################################################################
# CONFIGURATION INFORMATION
# All config info should be in P4CGI.pm
#
#################################################################
#
# View a user
#
#################################################################
# Get parameter
my $user = P4CGI::cgi()->param("USER") ;
unless(defined $user) {
&P4CGI::bail("No user specified!") ;
} ;
# List all users
my %userData ;
&P4CGI::p4user2name(\%userData) ;
# Get user info
my %values ;
my @fields ;
if(exists $userData{$user}) {
@fields = &P4CGI::p4readform("user -o '$user'",\%values);
}
# Fix email
if(exists $values{"Email"}) {
my $em = &P4CGI::htmlEncode($values{"Email"}) ;
$values{"Email"}=&P4CGI::ahref(-url => "mailto:$values{Email}",
"HELP=Send email",
$em) ;
}
# Fix fullname
if(exists $values{"FullName"}) {
$values{"FullName"} = &P4CGI::htmlEncode( $values{"FullName"}) ;
}
# Fix job view
if(exists $values{"JobView"}) {
my $v = $values{"JobView"} ;
$values{"JobView"} = &P4CGI::ahref(-url => "jobList.cgi",
"JOBVIEW=$v",
"LIST=Y",
"HELP=List matching jobs",
$v) ;
}
# Fix group view
{
my @groups ;
&P4CGI::p4call(\@groups,"groups $user") ;
if(@groups > 0) {
my $p = "In group" ;
if(@groups > 1) { $p .="s" ; } ;
push @fields,$p ;
$values{$p} = join(",", map { &P4CGI::ahref(-url => "groupView.cgi",
"GROUP=$_",
"HELP=View group info",
$_) ; } @groups) ;
}
}
my @buttons ;
push @buttons, &P4CGI::buttonCell("clientList.cgi",
"Show clients for user $user",
"USER=$user",
"List Clients") ;
push @buttons, &P4CGI::buttonCell("changeList.cgi",
"List changes by user $user",
"USER=$user",
"FSPC=//...",
"List changes") ;
print
&P4CGI::start_page("",@buttons) ;
unless(exists $userData{$user}) {
&P4CGI::signalError("User \"$user\" does not exist. ") ;
}
print
&P4CGI::start_framedTable("User $user"),
&P4CGI::start_table("") ;
my $f ;
foreach $f (@fields) {
print &P4CGI::table_row({-class => "Prompt",
-text => "$f"},
$values{$f}) ;
} ;
my @openfiles ;
&P4CGI::p4call(*P4, "opened -a " . &P4CGI::REDIRECT_ERROR_TO_NULL_DEVICE() );
my $line=0 ;
while(<P4>) {
chomp ;
/ by $user\@/ and do {
$line++ ;
/^(.*\#\d+) - (\S+) .* by \w+\@(\S+)/ or do { &P4CGI::ERROR("Unable to parse line $line ($_)") ;
next ; } ;
my $file = $1 ;
my $action = $2 ;
my $client = $3 ;
$client = &P4CGI::ahref(-url => "clientView.cgi",
"CLIENT=$client",
"HELP=View client info",
"<tt>$client</tt>") ;
$file =~ /(.*)\#(\d+)/ ;
if($action ne "add") {
$file = &P4CGI::ahref(-url => "fileLogView.cgi",
"FSPC=$1",
"REV=$2",
"HELP=File log",
"$file") ;
}
push @openfiles,&P4CGI::table_row({-class=>"ListC",
-text => $action},
{-class=>"List",
-text => $file},
{-class=>"ListC",
-text => $client}) ;
} ;
} ;
if(@openfiles > 0) {
my $cnt = @openfiles;
my $s = "" ;
$s = "s" if $cnt > 1 ;
print &P4CGI::table_row({-class => "Prompt",
-text => "Open files<br>($cnt file$s)"},
&P4CGI::start_table("").
&P4CGI::table_header("Action","File","Client") .
join("\n",@openfiles) .
&P4CGI::end_table()) ;} ;
print
&P4CGI::end_table(),
&P4CGI::end_framedTable(),
&P4CGI::end_page() ;
#
# That's all folks
#
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #6 | 4998 | Fredric Fredricson |
P4DB: cleaned up some code. Added p4users(), p4client() and p4user2name() to P4CGI.pm and modified all cgi:s to use these, |
||
| #5 | 4313 | Fredric Fredricson |
P4DB: - Removed some error messages (that clobbers the error log for the web server) - Added a CSS file that works for people with color vision deficiency - Fixed minor bug in the scripts that creates the tarball and zip-file |
||
| #4 | 2942 | Fredric Fredricson | P4DB: Fixed bug: Can now handle spaces in label names etc.... | ||
| #3 | 2875 | Fredric Fredricson | P4DB 3.0 first beta... | ||
| #2 | 1920 | Fredric Fredricson |
P4DB: Mainly some user interface fixes: * Added a small arrow that points to selection in list of options * Added tooltip help * Added user prefereces to turn the above off (or on) * Some other user interface fixes And fixed a bug in jobList.cgi and some minor bugs in label and branch viewers. |
||
| #1 | 1638 | Fredric Fredricson | P4DB: Added all (I think) files for P4DB |