#!/usr/bin/perl -w # -*- perl -*- use P4CGI ; use strict ; # ################################################################# # CONFIGURATION INFORMATION # All config info should be in P4CGI.pm # ################################################################# # # P4 search for file # Search depot for files matching spec # ################################################################# # Get file spec argument my $filespec = P4CGI::cgi()->param("FSPC") ; $filespec = "" unless defined $filespec ; $filespec = &P4CGI::htmlEncode($filespec) ; my $label = P4CGI::cgi()->param("LABEL") ; $label = "" unless defined $label ; $label = &P4CGI::htmlEncode($label) ; my $filedesc ; my $showDiffSelection="Y" ; if($filespec eq "") { $filedesc = "Label \"$label\"" ; $showDiffSelection= undef ; } else { $filedesc = "File spec \"$filespec\"" ; if($label ne "") { $filedesc .= " in label \"$label\"" ; } } if($label ne "") { $label = "\@$label" ; } # Add //... if not there if($filespec !~ /^\/\//) { $filespec = "//...$filespec" ; } while($filespec =~ s/\.\.\.\.\.\./\.\.\./) { ; } ; while($filespec =~ s/\*\*/\*/) { ; } ; my $MAX_RESTART=100 ; # Restart table after this number of lines... # Check if file exists my @matches ; &P4CGI::p4call(\@matches, "files \"$filespec$label\" " . P4CGI::REDIRECT_ERROR_TO_NULL_DEVICE() ); my $tableStart ; $tableStart = &P4CGI::start_table("cellpadding=1") . "\n" . &P4CGI::table_header("Rev","Action","Change","File"); my $tableSize = 0 ; print &P4CGI::start_page(""), "<br>", &P4CGI::start_framedTable("Search result for:<br>$filedesc") ; if(scalar(@matches) == 0) { print "No files found.\n" ; } else { print scalar(@matches)," files found\n" ; if(@matches > $MAX_RESTART) { my $n = 2 ; # Compute a value for $MAX_RESTART that does not leave widows.. while(@matches/$n > $MAX_RESTART) { $n++ ; } ; $MAX_RESTART = int(@matches/$n) ; } ; my $f ; foreach $f (@matches) { $f =~ /([^\#]+)\#(\d+) - (\w+) change (\d+)/ ; my ($name,$rev,$act,$change)=($1,$2,$3,$4) ; print $tableStart if $tableSize == 0 ; $tableSize++ ; print "", &P4CGI::table_row(&P4CGI::ahref("-url","fileViewer.cgi", "FSPC=$name", "REV=$rev", "HELP=View file", $rev), &P4CGI::ahref("-url","fileDiffView.cgi", "FSPC=$name", "REV=$rev", "ACT=$act", ($act eq "edit")?"HELP=View diff":"", $act), &P4CGI::ahref("-url","changeView.cgi", "CH=$change", "HELP=View change", $change), &P4CGI::ahref("-url","fileLogView.cgi", "FSPC=$name", "HELP=View file log", $name)) ; if($tableSize > $MAX_RESTART) { print "",&P4CGI::end_table() ; $tableSize = 0 ; } ; } ; print "",&P4CGI::end_table() if $tableSize > 0 ; my @files ; my %filesToFiles ; foreach $f (@matches) { $f =~ /([^\#]+)\#(\d+) - (\w+) change (\d+)/ ; my ($name,$rev,$act,$change)=($1,$2,$3,$4) ; if($act ne "delete"){ push @files,"$name\#$rev" ; } } ; if(defined $showDiffSelection and @files > 1) { print &P4CGI::cgi()->startform("-action","fileDiffView.cgi", "-method","GET"), &P4CGI::cgi()->hidden("-name","ACT", "-value","edit"), &P4CGI::cgi()->hidden("-name","DP", "-value",&P4CGI::CURR_DEPOT_NO()), "View diff between:<br>", &P4CGI::cgi()->popup_menu(-name => "FSPC", -values => \@files), "and<br>", &P4CGI::cgi()->popup_menu(-name => "FSPC2", -values => \@files), &P4CGI::cgi()->submit("-name","go", "-value"=>"Go"), &P4CGI::cgi()->endform() ; } ; } ; print &P4CGI::end_framedTable(), &P4CGI::end_page() ; # # That's all folks #
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 4306 | Fredric Fredricson |
P4DB: Hardened P4DB against malicious parameters (cross site scripting), performed some cleanup and increased version to 3.1.1. |
||
#4 | 4152 | Fredric Fredricson | P4DB: Some more work on tha way to version 3.1.... | ||
#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 |