- #!/usr/bin/perl -w
- # -*- perl -*-
- use P4CGI ;
- use strict ;
- #
- #################################################################
- # CONFIGURATION INFORMATION
- # All config info should be in P4CGI.pm
- #
- #################################################################
- #
- # View a branch
- #
- #################################################################
- ###
- ### Get branch name
- ###
- my $branch = &P4CGI::cgi()->param("BRANCH") ;
- &P4CGI::bail("No branch specified") unless defined $branch ;
- $branch = &P4CGI::htmlEncode($branch) ;
- ###
- ### Get info about branch
- ###
- my %values ;
- my @fields = &P4CGI::p4readform("branch -o '$branch'",\%values) ;
- # Get real user names...
- my %userCvt ;
- &P4CGI::p4user2name(\%userCvt);
- # Fix owner field
- if (exists $values{"Owner"}) {
- my $u = $values{"Owner"} ;
- if(exists $userCvt{$u}) {
- $values{"Owner"} = &P4CGI::ahref(-url=>"userView.cgi",
- "USER=$u",
- "HELP=View user info",
- "$u") . " (" . $userCvt{$u} . ")" ;
- }
- else {
- $values{"Owner"} = "$u (Unknown user)" ;
- }
- }
- # Fix description field
- if(exists $values{"Description"}) {
- $values{"Description"} = &P4CGI::formatDescription($values{"Description"});
- }
- # Fix up view info
- my $viewFrom ="";
- my $viewTo ="";
- my $allfrom ="";
- my $allto ="";
- foreach (split("\n",$values{"View"})) {
- /^\s*\/\/(.+)\s+\/\/(.+)/ ;
- my ($from,$to) = ($1,$2) ;
- $allfrom .= "//$from" ;
- $allto .= "//$to" ;
- my @from = split /\//,$from ;
- my @to = split /\//,$to ;
- my $common = "//" ;
- while(@from != 0 and @to != 0 and ($from[0] eq $to[0])) {
- $common .= shift @from ;
- $common .= "/" ;
- shift @to ;
- }
- my $tmp = join("/",@from) ;
- $from = $common . &P4CGI::ahref(-url=>"depotTreeBrowser.cgi",
- "HELP=Browse $common"."$tmp",
- "FSPC=$common$tmp",
- "$tmp") ;
- $tmp = join("/",@to) ;
- $to = $common . &P4CGI::ahref(-url=>"depotTreeBrowser.cgi",
- "HELP=Browse $common"."$tmp",
- "FSPC=$common$tmp",
- "$tmp") ;
- if (length($viewFrom) > 0) {
- $viewFrom .= "<br>" ;
- $viewTo .= "<br>" ;
- }
- $viewFrom .= "<tt>$from </tt>" ;
- $viewTo .= "<tt>$to</tt>" ;
- } ;
- $allto =~ s/^\+// ;
- my @frb ;
- my @tob ;
- push @tob,&P4CGI::buttonCell("changeList.cgi",
- "List changes in branch destination",
- "FSPC=$allto",
- "Changes") ;
- push @frb,&P4CGI::buttonCell("changeList.cgi",
- "List changes in branch source",
- "FSPC=$allfrom",
- "Changes") ;
- push @tob,&P4CGI::buttonCell("fileOpen.cgi",
- "List open files in branch destination",
- "FSPC=$allto",
- "Open files") ;
- push @frb,&P4CGI::buttonCell("fileOpen.cgi",
- "List open files in branch source",
- "FSPC=$allfrom",
- "Open files") ;
- push @tob,&P4CGI::buttonCell("findFiles.cgi",
- "Fild files in branch destination",
- "FSPC=$allto",
- "Find files") ;
- push @frb,&P4CGI::buttonCell("findFiles.cgi",
- "Find files in branch source",
- "FSPC=$allfrom",
- "Find files") ;
- my @labels ;
- &P4CGI::p4call(*P4, "labels" );
- while(<P4>) {
- chomp ;
- /^Label\s+(\S+)\s/ and do { push @labels,$1 ; } ;
- }
- close P4 ;
- my $chnotinlabel= join("\n",(&P4CGI::cgi()->startform(-action => "changeList.cgi",
- -method => "GET"),
- &P4CGI::cgi()->hidden(-name=>"FSPC",
- -value=>"$allto"),
- &P4CGI::cgi()->hidden(-name=>"DP",
- -value=>&P4CGI::CURR_DEPOT_NO()),
- "View changes not in label:<br>",
- &P4CGI::cgi()->popup_menu(-name => "EXLABEL",
- -value => \@labels),
- &P4CGI::cgi()->submit(-name => "Go",
- -value => "Go"),
- "</font>",
- &P4CGI::cgi()->endform())) ;
- $values{"View"} =
- join("\n",
- (&P4CGI::start_table("border=0 cellspacing=0 cellpadding=0"),
- &P4CGI::table_row($viewFrom,$viewTo),
- &P4CGI::table_row({ -text => "<hr>In source:".&P4CGI::buttonVMenuTable(@frb),
- -valign=>"Top"
- },
- { -text => "<hr>In destination:".
- &P4CGI::buttonVMenuTable(@tob).
- $chnotinlabel,
- -valign=>"Top"
- }
- ),
- &P4CGI::end_table())) ;
- ###
- ### Print html
- ###
- print &P4CGI::start_page("Branch \"$branch\"") ;
- "<br>",
- &P4CGI::start_framedTable(""),
- &P4CGI::start_table("") ;
- my $f ;
- foreach $f (@fields) {
- my %xopt ;
- $xopt{"class"} = "Description" if $f eq "Description" ;
- print &P4CGI::table_row({-class => "Prompt",
- -text => "$f"},
- {%xopt,
- -text => $values{$f}}) ;
- } ;
- &P4CGI::end_table(),
- "<hr>";
- print &P4CGI::end_framedTable() ;
- &P4CGI::end_page() ;
- #
- # That's all folks
- #
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#9 | 4998 | Fredric Fredricson | P4DB: cleaned up some code. Added p4users(), p4client() and p4user2name() to P4CGI.pm and... modified all cgi:s to use these, « |
20 years ago | |
#8 | 4306 | Fredric Fredricson | P4DB: Hardened P4DB against malicious parameters (cross site scripting), performed some c...leanup and increased version to 3.1.1. « |
21 years ago | |
#7 | 4299 | Fredric Fredricson | P4DB: Bug in branch view fixed | 21 years ago | |
#6 | 4237 | Fredric Fredricson | P4DB: Maybe the final submit for P4DB 3.1.0 | 21 years ago | |
#5 | 4152 | Fredric Fredricson | P4DB: Some more work on tha way to version 3.1.... | 21 years ago | |
#4 | 2942 | Fredric Fredricson | P4DB: Fixed bug: Can now handle spaces in label names etc.... | 22 years ago | |
#3 | 2875 | Fredric Fredricson | P4DB 3.0 first beta... | 22 years ago | |
#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. « |
23 years ago | |
#1 | 1638 | Fredric Fredricson | P4DB: Added all (I think) files for P4DB | 23 years ago |