branchList.cgi #6

  • //
  • guest/
  • fredric_fredricson/
  • P4DB/
  • main/
  • branchList.cgi
  • View
  • Commits
  • Open Download .zip Download (3 KB)
#!/usr/bin/perl -w
# -*- perl -*-
use P4CGI ;
use strict ;
#
#################################################################
#  CONFIGURATION INFORMATION 
#  All config info should be in P4CGI.pm
#
#################################################################
#
#  List all branches
#
#################################################################

my $SORTBY=&P4CGI::cgi()->param("SORTBY") ;
$SORTBY="DATE" unless defined $SORTBY ;

my $otherSort = ""  ;
my $sortedBy = "" ;
if($SORTBY ne "NAME") {
    $otherSort .= &P4CGI::buttonCell($ENV{SCRIPT_NAME},
				    "Sort list of branchesby name",
				    "SORTBY=NAME",
				    "Sort by name") ;
} else { $sortedBy = "name" } ;
if($SORTBY ne "DATE") {
    $otherSort .= &P4CGI::buttonCell($ENV{SCRIPT_NAME},
				    "Sort list of branches by update date",
				    "SORTBY=DATE",
				    "Sort by date") ;
} else { $sortedBy = "date" } ;
if($SORTBY ne "OWNER") {
    $otherSort .= &P4CGI::buttonCell($ENV{SCRIPT_NAME},
				    "Sort list of branches by owner",
				    "SORTBY=OWNER",
				    "Sort by owner") ;
} else { $sortedBy = "owner" } ;

# Print header
print "",
    &P4CGI::start_page("List branches",$otherSort) ;

# Get list of all brances

local *P4 ;

&P4CGI::p4call(*P4, "branches" );
my %rows ;
my $noBranches=0 ;
while(<P4>) {
    if(/^Branch (\S+)\s+(\S+)\s+\'([^\']*)\'/) {
	$noBranches++ ;
	my ($name,$cdate,$desc) = ($1,$2,$3) ;
	my %branchData ;
	&P4CGI::p4readform("branch -o '$name'",\%branchData) ;
	$desc = $branchData{"Description"} if exists $branchData{"Description"}  ;
	$cdate = $branchData{"Update"} if exists $branchData{"Update"} ;
	my $owner = "--" ;
	$owner = $branchData{"Owner"} if exists $branchData{"Owner"} ;
	$name = &P4CGI::ahref(-url => "branchView.cgi" ,
			      "BRANCH=$name",
			      "HELP=View branch info",
			      $name) ;
	my $s = $SORTBY eq "NAME"? uc("$name $cdate $owner") : "$cdate $name $owner" ;
	if($SORTBY eq "OWNER") {
	    $s = uc("$owner $name $cdate") ;
	} ;
	$rows{$s} = join("\n",( &P4CGI::table_row(undef,
						  {-text=>$name,
						   -class=>"Prompt"},
						  {-text=>$owner,
						   -class=>"Prompt"},
						  {-text=>$cdate,
						   -class=>"Prompt"}),
				&P4CGI::table_row({-text=>" ",
						   -style=>"width: 20pt"},
						  undef,
						  undef,
						  undef,
						  {-class=>"Description",
						   -text=>
						       &P4CGI::formatDescription($desc)}))) ;
    }
}

print 
    &P4CGI::start_framedTable("$noBranches branches (sorted by $sortedBy)"),
    &P4CGI::start_table(""),
    &P4CGI::table_header("Name","","Owner","Updated") ;

my $s ;
if($SORTBY eq "NAME") {
    foreach $s (sort keys %rows) {
	print $rows{$s} ;
    }
}
else {
    foreach $s (sort { $b cmp $a } keys %rows) {
	print $rows{$s} ;
    }
} ;
print "",
    &P4CGI::end_table(""),
    &P4CGI::end_framedTable(),
    &P4CGI::end_page("") ;
#
# That's all folks
#
# Change User Description Committed
#6 4973 Fredric Fredricson P4DB: Worked around some IE CSS-bugs.   
Improved page layout for branch, client and job lists.
#5 4239 Fredric Fredricson P4DB: Improved branch list and fixed text in label list
#4 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.......
#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