index.cgi #1

  • //
  • guest/
  • fredric_fredricson/
  • P4DB/
  • rel/
  • 2.1/
  • index.cgi
  • View
  • Commits
  • Open Download .zip Download (7 KB)
#!/usr/bin/perl -w
# -*- perl -*-
use P4CGI ;
use strict ;
#
#################################################################
#  CONFIGURATION INFORMATION 
#  All config info should be in P4CGI.pm
#
#################################################################
#
#  P4 depot browser, top
#
#################################################################

print "",
    &P4CGI::start_page("P4DB<br> P4 Depot Browser",
		       "<CENTER><SMALL>Hint:".
		       "You can bookmark any page you want to get back to later</SMALL></CENTER>") ;

				# Read and parse shortcut file

my $shortcut_file = &P4CGI::SHORTCUT_FILE() ;
my $SHORTCUTS="" ;

if(defined $shortcut_file and -r $shortcut_file) {	
				# Read file
    local *D ;
    open(*D, "<$shortcut_file") or &P4CGI::bail("Failed to open $shortcut_file for read") ;
    my $tmps = join("\n",<D>) ;
    $tmps =~ s/^#.*$//gm ;
    close *D ;
    my $shortcut_text = "" ;
				# Find all <P4DB [par=data...]>...</P4DB> 
    while($tmps =~ s/^(.*?)<p4db\s+(.*?)\s*>(.*?)<\/P4DB>//is) {
	$shortcut_text .= $1 ;
	my $pars = $2 ;
	my $text = $3 ;	
				# Extract arguments for <P4DB>
	my %pars ;
	while($pars =~ s/(\S+)\s*=\s*(?:"(.*?)"|(\S+))\s*//) {
	    my $par = $1 ;
	    my $val ;
	    if(defined $2) {
		$val = $2 ;
	    }
	    else {
		$val = $3 ;
	    } ;
	    $pars{uc($par)} = $val;	    
	} ;
	my $type = "" ;
	if ( defined $pars{"TYPE"} ) {
	    $type = uc($pars{"TYPE"});
	    delete $pars{"TYPE"};
	}
	my $url ;
	if($type eq "CHANGELIST") { 
	    $url = "changeList.cgi" ; 
	} ;
	if($type eq "BROWSE") { 
	    $url = "depotTreeBrowser.cgi" ;
	} ;
	if($type eq "JOBLIST")    { 
	    $url = "jobList.cgi" ; 
	    my %flds ;
	    &P4CGI::p4readform("jobspec -o",\%flds) ;
	    my %fldtrans = map { /\s*(\d+) (\S+)/ ; (uc($2),"FLD$1") ;} split("\n",$flds{"Fields"}) ;
	    my @pars = keys %pars ;
	    while(@pars) {
		my $p = shift @pars ;
		if(exists $fldtrans{$p}) {
		    $pars{$fldtrans{$p}} = $pars{$p} ;
		    delete $pars{$p} ;
		}
	    }
	    $pars{"LIST"}="Y" ;
	} ;
	if(defined $url) {
	    my @pars = map { "$_=$pars{$_}" ; }  keys %pars ;
	    $shortcut_text .= &P4CGI::ahref(-url=>$url,
					    @pars,
					    $text) ;
	} ;
    }
    $shortcut_text .= $tmps;
    $SHORTCUTS = join("\n",(&P4CGI::start_table("align=center cellpadding=10 bgcolor=".&P4CGI::HDRFTR_BGCOLOR()),
			    &P4CGI::table_row($shortcut_text),
			    &P4CGI::end_table())) ;
} ;

if(&P4CGI::SHORTCUTS_ON_TOP()) {
    print "$SHORTCUTS",
} ;
    
my @MENU = (&P4CGI::ahrefWithArrow(-url => "depotTreeBrowser.cgi","Browse Depot"),
	    &P4CGI::ahrefWithArrow(-url => "changeList.cgi",
				   "FSPC=//...",
				   "Submitted Changes"),

	    &P4CGI::ahrefWithArrow(-url => "changeList.cgi",
				   "FSPC=//...",
				   "STATUS=pending",
				   "Pending Changes"),
	    
	    &P4CGI::ahrefWithArrow(-url => "changeByUsers.cgi",
				   "Changes by User or Group"),
	    &P4CGI::ahrefWithArrow(-url => "searchPattern.cgi",
				   "Search Descriptions"),
	    &P4CGI::ahrefWithArrow(-url => "filesChangedSince.cgi",
				   "List Recently Modified Files"),
	    
	    
	    &P4CGI::ahrefWithArrow(-url => "fileOpen.cgi",
				   "Open files"),
	    &P4CGI::ahrefWithArrow(-url => "branchList.cgi",
				   "Branches"),
	    &P4CGI::ahrefWithArrow(-url => "labelList.cgi",
				   "Labels"),
	    
	    &P4CGI::ahrefWithArrow(-url => "jobList.cgi",
				   "Jobs"),
	    &P4CGI::ahrefWithArrow(-url => "userList.cgi",
				   "Users and Groups"),
	    &P4CGI::ahrefWithArrow(-url => "clientList.cgi",
				   "Clients"),
	    
	    &P4CGI::ahrefWithArrow(-url => "depotStats.cgi",
				   "Depot Statistics")
	    ) ;

if(uc(&P4CGI::USE_JAVA()) eq "YES") {
    push @MENU, ("<APPLET CODE=\"p4jdb/P4DirTreeApplet.class\" WIDTH=100 HEIGHT=30>\n".
		 "<param name=File value=\"javaDataView.cgi\">\n".
		 "</APPLET>") ;
} ;

print "",
    &P4CGI::start_table("width=100%  cellspacing=0 cellpadding=0"),
    "<tr><td>\n" ;

my $COLS = 1 ;
print "",
    &P4CGI::start_table("cellspacing=3 cellpadding=0") ;

my $colorCnt=0 ;
while(@MENU > 0) {
    my $n ;
    my @alts ;
    for($n = 0;($n < $COLS) and (@MENU > 0);$n++) {
	my $t =  shift @MENU ;
	push @alts, "$t"; 
    } ;
    my $tmp = @alts ;
    my @color = (&P4CGI::BGCOLOR(),&P4CGI::BGCOLOR()) ;
#    my @color = (&P4CGI::BGCOLOR(),&P4CGI::HDRFTR_BGCOLOR()) ;
    print &P4CGI::table_row(-align => "left",
			    map { 
				{
				    -bgcolor => $color[$colorCnt++ & 1],
				    -text => "$_" } ; } @alts) ."\n" ;

} ;   

print &P4CGI::end_table() ;

if(!&P4CGI::SHORTCUTS_ON_TOP()) {    
    print "$SHORTCUTS\n"
} ;
    

print "</td><td>" ;

print "",
    &P4CGI::start_table("bgcolor=".&P4CGI::HDRFTR_BGCOLOR()." align=center cellpadding=0 cellspacing=2"),
    "<tr><td>\n" ;


sub prSelection($$$$ )
{
    my $cgitarget  = shift @_ ;
    my $desc       = shift @_ ;
    my $fields     = shift @_ ;
    my $helpTarget = shift @_ ;
    
    print "", &P4CGI::table_row(-valign=>"bottom",
				{-align=>"center",
				 -valign=>"bottom",				 
				 -text => 
				     join("\n",
					  &P4CGI::cgi()->startform(-action => $cgitarget,
								   -method => "GET"),
					  "<font size=+0>$desc</font>")},
				{-align=>"left",
				 -valign=>"bottom",
				 -text => $fields},
				{-align=>"left",
				 -text => " "},
				{-align=>"left",
				 -valign=>"bottom",
				 -width=>"1",
				 -text =>  &P4CGI::cgi()->submit(-name  => "ignore",
								 -value => "GO!")
				 },
				{ -text => &P4CGI::cgi()->endform()
				  }
				) ;
} ;

print "",  &P4CGI::start_table("width=100% cellspacing=4") ;

my $limiter="<tr><td colspan=5><hr></td></tr>\n" ;

prSelection("changeList.cgi",
	    "List changes for<br>file spec",
	    join("","File spec:<font face=fixed>",
		 &P4CGI::cgi()->textfield(-name      => "FSPC",
					  -default   => "//...",
					  -size      => 50,
					  -maxlength => 256),
		 "</font>"),
	    "listCh") ;

print $limiter ;

prSelection("fileSearch.cgi",
	    "Search for file",
	    join("","File spec:<font face=fixed>",
		 &P4CGI::cgi()->textfield(-name      => "FSPC",
					  -default   => "//...",
					  -size      => 50,
					  -maxlength => 256),
		 "</font>"),
	    "fileSrch") ;

print $limiter ;

prSelection("changeView.cgi",
	    "View change",
	    join("","Change number:<font face=fixed>",
		 &P4CGI::cgi()->textfield(-name      => "CH",
					  -default   => "1",
					  -size      => 10,
					  -maxlength => 10),    
		 "</font>"),
	    "viewCh") ;

		
print &P4CGI::end_table() ;
		
print  "</tr></td>",&P4CGI::end_table() ;

print  "</tr></td>",&P4CGI::end_table() ;


print
    "<hr>",
    &P4CGI::start_table("width=100% cols=3"),
    &P4CGI::table_row(-align => "left",
		      &P4CGI::ahref(-url => &P4CGI::HELPFILE_PATH() . "/README.html",
				    "Readme file<br>for admin"),
		      {-align => "center",
		       -text =>  &P4CGI::ahref(-url => "SetPreferences.cgi",
					       "<FONT SIZE=+0>Set Preferences</FONT>"),
		      },
		      { -text => &P4CGI::ahref(-url => "p4race.cgi",
					       "<font size=-1>The Great<br>Submit Race</font>"),
			-align => "right" }),
    &P4CGI::end_table() ;

print "<hr>" ;

print    
    &P4CGI::end_page() ;

#
# That's all folks
#




# Change User Description Committed
#1 1933 Fredric Fredricson P4DB: Created 2.1 "release branch".
(The quotation marks are
there because this is not really a release. Yet. Perhaps.)
//guest/fredric_fredricson/P4DB/main/index.cgi
#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