#!/usr/bin/perl -w # -*- perl -*- use P4CGI ; use strict ; # ################################################################# # CONFIGURATION INFORMATION # All config info should be in P4CGI.pm # ################################################################# # # View labels # ################################################################# # Get label my $label = P4CGI::cgi()->param("LABEL") ; &P4CGI::bail("No label specified") unless defined $label ; my $found ; # Get list of all labels and also check that supplied label exists my @labels ; &P4CGI::p4call(\@labels, "labels" ); foreach (@labels) { $_ =~ s/^Label (\S+).*$/$1/ ; if($_ eq $label) { $found = "Yes" ; } ; } # Print header print "", &P4CGI::start_page("Label $label", &P4CGI::ul_list("<b>owner</b> -- view user info", "<b>view</b> -- View changes for view")) ; &P4CGI::signalError("Label $label not in depot") unless $found ; my @otherLabels ; foreach (@labels) { next if ($_ eq $label) ; push @otherLabels,$_ ; } ; ### ### "Sort" other labels after "closeness" ### { my $lab=uc($label) ; my $len = length($lab) ; my @labs ; while($len > 3) { my @tmp ; my $l ; $len-- ; $lab = substr($lab,0,$len) ; foreach $l (@otherLabels) { if(uc(substr($l,0,$len)) eq $lab) { push @labs,$l ; } else { push @tmp,$l ; } } @otherLabels = @tmp ; } ; @otherLabels = (@labs,@otherLabels) ; } # Get label info print "", &P4CGI::start_table("") ; my %values ; my @fields = &P4CGI::p4readform("label -o \"$label\"",\%values) ; # Fix description field if(exists $values{"Description"}) { my $d = &P4CGI::fixSpecChar($values{"Description"}) ; $d =~ s/\n/<br>/g ; $values{"Description"} = "<tt>$d</tt>" ; } # Fix owner field if (exists $values{"Owner"}) { # Get real user names... my %userCvt ; { my @users ; &P4CGI::p4call(\@users, "users" ); %userCvt = map { /^(\S+).*> \((.+)\) .*$/ ; ($1,$2) ; } @users ; } my $u = $values{"Owner"} ; if(exists $userCvt{$u}) { $values{"Owner"} = &P4CGI::ahref(-url=>"userView.cgi", "USER=$u", "HELP=View user info", "$u") . " (" . $userCvt{$u} . ")" ; } else { $values{"Owner"} = "$u (Unknown user)" ; } } # Fix view field my $viewFSPC = $values{"View"} ; my $view ; foreach (split("\n",$values{"View"})) { my $t = &P4CGI::ahref(-url => "depotTreeBrowser.cgi", "FSPC=$_", "HELP=Go to depot browswer", "<tt>$_</tt>") ; if (defined $view) { $view .= "<br>$t" ; } else { $view .= "$t" ; } ; } ; $values{"View"} = $view ; print &P4CGI::start_table("") ; my $f ; foreach $f (@fields) { print &P4CGI::table_row({-align => "right", -valign => "top", -type => "th", -text => "$f"}, {-type => "td", -valign => "top", -text => $values{$f}}) ; } ; $viewFSPC =~ s/\n//ig ; print &P4CGI::table_row(undef, "<hr>" . join("<br>", &P4CGI::ahrefWithArrow(-url => "changeList.cgi", "FSPC=$viewFSPC", "EXLABEL=$label", "List changes in label view not included in label"), &P4CGI::ahrefWithArrow(-url => "changeList.cgi", "LABEL=$label", "View changes for label $label"), &P4CGI::ahrefWithArrow(-url => "fileSearch.cgi", "LABEL=$label", "List files in label $label"))) ; print &P4CGI::end_table() ; print "<hr>", &P4CGI::cgi()->startform(-action => "labelDiffView.cgi" , -method => "GET"), &P4CGI::cgi()->hidden(-name=>"LABEL1", -value=>"$label"), "Diff with label: ", &P4CGI::cgi()->popup_menu(-name => "LABEL2", -value => \@otherLabels), "<br>Show files that: ", &P4CGI::cgi()->checkbox(-name => "SHOWSAME", -value => "Y", -label => " are not modified"), &P4CGI::cgi()->checkbox(-name => "SHOWNOTSAME", -checked => "Y", -value => "Y", -label => " are modified"), &P4CGI::cgi()->checkbox(-name => "SHOWDIFF", -checked => "Y", -value => "Y", -label => " differ"), &P4CGI::cgi()->submit(-name => "Go", -value => "Go"), &P4CGI::cgi()->endform() ; print "<hr>", &P4CGI::cgi()->startform(-action => "changeList.cgi", -method => "GET"), &P4CGI::cgi()->hidden(-name=>"LABEL", -value=>"$label"), "View changes for label $label excluding label: ", &P4CGI::cgi()->popup_menu(-name => "EXLABEL", -value => \@otherLabels), &P4CGI::cgi()->submit(-name => "Go", -value => "Go"), &P4CGI::cgi()->endform() ; print "<hr>", &P4CGI::cgi()->startform(-action => "fileSearch.cgi", -method => "GET"), &P4CGI::cgi()->hidden(-name=>"LABEL", -value=>"$label"), &P4CGI::cgi()->submit(-name => "ignore", -value => "Search in label for:"), &P4CGI::cgi()->textfield(-name => "FSPC", -default => "//...", -size => 50, -maxlength => 256), &P4CGI::cgi()->endform() ; print "", &P4CGI::end_page() ; # # That's all folks #
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#11 | 4998 | Fredric Fredricson |
P4DB: cleaned up some code. Added p4users(), p4client() and p4user2name() to P4CGI.pm and modified all cgi:s to use these, |
||
#10 | 4306 | Fredric Fredricson |
P4DB: Hardened P4DB against malicious parameters (cross site scripting), performed some cleanup and increased version to 3.1.1. |
||
#9 | 4237 | Fredric Fredricson | P4DB: Maybe the final submit for P4DB 3.1.0 | ||
#8 | 4152 | Fredric Fredricson | P4DB: Some more work on tha way to version 3.1.... | ||
#7 | 4070 | Fredric Fredricson |
P4DB: Updated labelView and labelDiffView cgi:s to "3.1 standard". Added the function to view diff between label and current depot files in label view. These scripts are still a bit ancient though. Should be re-implemented. Some day... |
||
#6 | 4069 | Fredric Fredricson | P4DB: More changes on the way to 3.1 | ||
#5 | 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....... |
||
#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 |