labelList.cgi #5

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

##
#
# Parameters:
#
# SORTBY defines sort order
#    One of "NAME" and "DATE"
#
#

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

# Get list of all label
my @labels ;
&P4CGI::p4call(\@labels, "labels" );

map { /^Label (\S+)\s+(\S+)\s+'(.*)'/ ; $_ = [$1,$2,$3] ; } @labels ;

# Print header
my @options ;

my @lab ;
if($SORTBY eq "DATE") {
    @lab = sort { my @b = @$a ;
		  my @a = @$b ;
		  $a[1] cmp $b[1] ; } @labels ;
    push @options,&P4CGI::buttonCell("labelList.cgi",
				     "Sort labels by name",
				     "SORTBY=NAME",
				     "Sort by name") ;

}
else {
    @lab = sort { my @a = @$a ;
		  my @b = @$b ;
		  uc($a[0]) cmp uc($b[0]) ; } @labels ;
    push @options,&P4CGI::buttonCell("labelList.cgi",
				     "Sort labels by date",
				     "SORTBY=DATE",
				     "Sort by date") ;
}


print "",
    &P4CGI::start_page("List Labels",@options) ;

my $nolabels= scalar @labels ;

print "",
    &P4CGI::start_framedTable("$nolabels labels"),
    &P4CGI::start_table(""),
    &P4CGI::table_header("Label","Date","Desc.") ;

foreach (@lab) {    
    my ($name,$date,$desc) = @{$_} ;
    $desc = &P4CGI::formatDescription($desc) ;
    my $lab = 
	print &P4CGI::table_row({-class=>"Prompt",
				 -text=>&P4CGI::ahref(-url => "labelView.cgi",
						      "LABEL=$name",
						      "HELP=View label",
						      $name)},
				{-class=>"Prompt",
				 -text=>$date},
				{-class=>"Description",
				 -text =>$desc}) ;
}

print 
    &P4CGI::end_table(),
    &P4CGI::end_framedTable(),
    &P4CGI::end_page() ;

#
# That's all folks
#
# Change User Description Committed
#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