#!/usr/bin/perl -w
# -*- perl -*-
use P4CGI ;
use strict ;
#
#################################################################
# CONFIGURATION INFORMATION
# All config info should be in the config file
#
#################################################################
#
# P4 view job
# View a job
#
#################################################################
# Get file spec argument
my $job = P4CGI::cgi()->param("JOB") ;
&P4CGI::bail("No job specified") unless defined $job ;
$job = &P4CGI::htmlEncode($job) ; # protect against malicious values
# Get jobspec
my %jobspec ;
&P4CGI::p4readform("jobspec -o",\%jobspec) ;
# Get field types:
my %fieldTypes =
map { /\d+ (\S+) (\S+)/ ; ($1,$2) ; } split("\n",$jobspec{"Fields"}) ;
# Create title
print &P4CGI::start_page("",(&P4CGI::buttonCell("jobList.cgi",
"Select new list of jobs to view",
"View job list"))) ;
my @fields ;
my %fieldData ;
@fields = &P4CGI::p4readform("job -o '$job'",\%fieldData);
# Check that job exist
if($fieldData{"Description"} =~ /<enter description here>/) {
&P4CGI::signalError("Job $job does not exist") ;
}
# Fix user field
if(exists $fieldData{"User"}) {
$fieldData{"User"} = &P4CGI::ahref(-url => "userView.cgi",
"USER=$fieldData{User}",
"HELP=View user info",
$fieldData{"User"}) ;
}
# Fix text fields
my $fld ;
foreach $fld (keys %fieldData) {
if($fieldTypes{$fld} eq "text") {
my $d = &P4CGI::formatDescription($fieldData{$fld}) ;
$fieldData{$fld} = {-text=>"$d",
-class=>"Description"} ;
}
} ;
my @fixes ;
&P4CGI::p4call(\@fixes,"fixes -j $job") ;
if(@fixes > 0) {
push @fields,"Fixed by" ;
$fieldData{"Fixed by"} = join("<br>\n",
map {/change (\d+) on (\S+) by (\S+)\@(\S+)/ ;
my ($ch,$date,$user,$client) = ($1,$2,$3,$4) ;
$ch = &P4CGI::ahref(-url => "changeView.cgi",
"CH=$ch",
"HELP=View change",
$ch) ;
$user = &P4CGI::ahref(-url => "userView.cgi",
"USER=$user",
"HELP=View user info",
$user) ;
$client = &P4CGI::ahref(-url => "clientView.cgi",
"CLIENT=$client",
"HELP=View client info",
$client) ;
"Change $ch on $date by $user\@$client" ; } @fixes ) ;
}
print
&P4CGI::start_framedTable("Job $job") ;
my $f ;
foreach $f (@fields) {
print &P4CGI::table_row({-class=>"\"Prompt\"",
-text => $f},
$fieldData{$f}) ;
} ;
print &P4CGI::end_framedTable() ;
print &P4CGI::end_page();
#
# That's all folks
#
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #5 | 4306 | Fredric Fredricson |
P4DB: Hardened P4DB against malicious parameters (cross site scripting), performed some cleanup and increased version to 3.1.1. |
||
| #4 | 2942 | Fredric Fredricson | P4DB: Fixed bug: Can now handle spaces in label names etc.... | ||
| #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 |