#!/usr/local/bin/perl5
# -*- perl -*-
use P4CGI ;
use strict ;
#
#####################################################################
##
##  CONFIGURATION INFORMATION 
##  All config info should be in $configFile (see init() in P4CGI.pm)
##
#####################################################################
##
##  List All Labels
##
#####################################################################

# Set back references
my $homepage="index.cgi";
my $backtohome="Back to Home" ;

# Get labels
my @labels ;
&P4CGI::p4call(\@labels, "labels" );
foreach (@labels) {
    /^Label (\S+)\s+(\S+)\s+'(.*)'/ ;
    my $lab = &P4CGI::ahref(-url => &P4CGI::LV_URL(),
			    "LABEL=$1",
			    $1) ;
    $_ = &P4CGI::table_row(-valign => "top",
			   {-type=>"th",
			    -align=>"left",
			    -text=>$lab},
			   $2,
			   $3) ;
}

# Print title and legend
print
    "",
    &P4CGI::start_page("P4 Labels",
	&P4CGI::ul_list("<b>Label:</b> to view label info"),
	$homepage,$backtohome) ;

# Print page
print
    "",
    "<b>",
    scalar @labels," labels:</b><br>",
    &P4CGI::start_table(""),
    &P4CGI::table_row(-type=>"th",
		      "Label","Date","Description") ;
# Print $_, from above
foreach (@labels) {    
    print ;
}

# End the table, end the page
print 
    &P4CGI::end_table(),
    &P4CGI::end_page() ;