#!/usr/bin/perl -w # -*- perl -*- use P4CGI ; use strict ; use CGI::Carp ; # ################################################################# # CONFIGURATION INFORMATION # All config info should be in P4CGI.pm # ################################################################# # # List open files # ################################################################# # File argument my $FSPC = P4CGI::cgi()->param("FSPC") ; $FSPC = "//..." unless defined $FSPC ; $FSPC = &P4CGI::htmlEncode($FSPC) ; my $fspc=$FSPC ; my @FSPC = split(/\s*\+?\s*(?=\/\/)/,$FSPC) ; $FSPC = "<tt>".join("</tt> and <tt>",@FSPC)."</tt>" ; my $FSPCcmd = "\"" . join("\" \"",@FSPC) . "\"" ; my $SORTBY = P4CGI::cgi()->param("SORTBY") ; $SORTBY="USER" unless defined $SORTBY and $SORTBY eq "NAME" ; my $err2null = &P4CGI::REDIRECT_ERROR_TO_NULL_DEVICE() ; # Get info about opened status my @opened ; &P4CGI::p4call(\@opened,"opened -a $FSPCcmd $err2null") ; map { /(.*)\#(\d+) - (\S+) (\S+\s\S+) \S+ by (\S+)@(\S+)/ ; $_ = [$1,$2, $3,$4, $5,$6] ; } @opened ; # file status user # rev change client my @options ; my $noFiles=@opened ; if($SORTBY eq "USER") { my @tmp = sort { my @a = @$a ; my @b = @$b ; uc("$a[4] $a[5]").$a[0] cmp uc("$b[4] $b[5]").$b[0] ; } @opened ; @opened = @tmp ; push @options, &P4CGI::buttonCell($ENV{SCRIPT_NAME}, "Sort list by file name", "FSPC=$fspc", "SORTBY=NAME", "Sort by file") ; } else { push @options, &P4CGI::buttonCell($ENV{SCRIPT_NAME}, "Sort list by user", "FSPC=$fspc", "SORTBY=USER", "Sort by user") ; } ; @options = () if $noFiles == 0 ; print &P4CGI::start_page("List open files for<br>$FSPC",@options) ; # Create conversion hash for user -> fullname my %userCvt ; &P4CGI::p4user2name(\%userCvt ); my $filet = "$noFiles files" ; $filet = "No files found" if $noFiles == 0 ; $filet = "One file" if $noFiles == 1 ; print &P4CGI::start_framedTable($filet) ; my ($lastFile,$lastRev,$lastUser,$lastClient) = ("","","","") ; sub printLine(@) { my ($file,$rev,$status,$change,$user,$client) = @_ ; $change =~ s/\s*change\s*// ; my $Puser = &P4CGI::ahref(-url => "userView.cgi", -title=> "\"View user $userCvt{$user}\"", "USER=$user", "$user") . "/" ; my $Pclient = &P4CGI::ahref(-url => "clientView.cgi", -title =>"\"View client\"", "CLIENT=$client", "$client") ; my $Pfile = &P4CGI::ahref(-url => "fileLogView.cgi", -title => "\"View file log\"", "FSPC=$file", "$file") ; my $Prev = &P4CGI::ahref(-url => "fileViewer.cgi", -title => "\"View file\"", "FSPC=$file", "REV=$rev", "#$rev") ; if($change =~ /^\d+$/) { $change = &P4CGI::ahref(-url => "changeView.cgi", -title => "\"View change $change\"", "CH=$change", "$change") ; } if($SORTBY eq "NAME") { if($file eq $lastFile) { $Pfile = "" ; if($rev eq $lastRev) { $Prev = "" ; } } print &P4CGI::table_row("${Pfile}$Prev",$status,$change,"$Puser$Pclient") ; } elsif ($SORTBY eq "USER") { if($user eq $lastUser) { $Puser = "" ; if($client eq $lastClient) { $Pclient = "" ; } } print &P4CGI::table_row("$Puser$Pclient",$status,$change,"${Pfile}$Prev") ; } ; ($lastFile,$lastRev,$lastUser,$lastClient) = ($file,$rev,$user,$client) ; } ; print &P4CGI::start_table("") ; if($SORTBY eq "NAME") { print &P4CGI::table_header("File","Status","Change","User/Client") ; } elsif($SORTBY eq "USER") { print &P4CGI::table_header("User/Client","Status","Change","File") ; } ; map { printLine(@$_) ; } @opened ; print &P4CGI::end_table() ; print &P4CGI::end_framedTable() ; print &P4CGI::end_page() ; # # That's all folks #
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 4998 | Fredric Fredricson |
P4DB: cleaned up some code. Added p4users(), p4client() and p4user2name() to P4CGI.pm and modified all cgi:s to use these, |
||
#4 | 4306 | Fredric Fredricson |
P4DB: Hardened P4DB against malicious parameters (cross site scripting), performed some cleanup and increased version to 3.1.1. |
||
#3 | 4046 | Fredric Fredricson |
P4DB: First submit for 3.1. * Removed frame-stuff and some related files * Added new page header * Started update of documentation * Changed a lot of CGI:s to conform to new "look and feel" Still a lot to do: - clean up stuff (especially the javascript) - Fix the file list to use new annotate-command - Clean up and document css-file - and more....... |
||
#2 | 2875 | Fredric Fredricson | P4DB 3.0 first beta... | ||
#1 | 1638 | Fredric Fredricson | P4DB: Added all (I think) files for P4DB |