#!/usr/local/bin/perl5 # -*- perl -*- use P4CGI ; use strict ; # ##################################################################### ## ## CONFIGURATION INFORMATION ## All config info should be in $configFile (see init() in P4CGI.pm) ## ##################################################################### ## ## List All Users ## ##################################################################### # Set back references my $homepage="index.cgi"; my $backtohome="Back to Home" ; # Get users my @users ; &P4CGI::p4call(\@users, "users" ); my $emailall ; my $usertable ; $usertable = &P4CGI::start_table("cellpadding=4") ; $usertable .= &P4CGI::table_row("-type","th", "-align","left", "User","Name","Email address","Last access"); my $userinfo ; foreach $userinfo (sort { uc($a) cmp uc($b) } @users) { $userinfo =~ /(\w+)\s+\<(.*)\>\s+\((.*)\) accessed (\S+)/ and do { my ($user,$email,$name,$lastaccess) = ($1,$2,$3,$4) ; $user = &P4CGI::ahref(-url => &P4CGI::LU_URL(), "USER=$user", $user) ; $email =~ /\w+\@\w+/ and do { if(defined $emailall) { $emailall .= ",$email" ; } else { $emailall .= "mailto:$email" ; } ; $email = &P4CGI::ahref(-url => "mailto:$email", $email) ; } ; $usertable .= &P4CGI::table_row($user, $name, $email, $lastaccess) ; } } $usertable .= &P4CGI::end_table() ; # Print out the page print "", &P4CGI::start_page("P4 Users", &P4CGI::ul_list( "User: to see P4 user info", "Email address: to send mail to user", "
", &P4CGI::ahref(-url => $emailall, "Mail all users",)),$homepage,$backtohome), "", scalar(@users), " users:
", $usertable, &P4CGI::end_page() ;