modified to sort names

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1258 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2002-11-20 20:03:51 +00:00
parent 5236122088
commit 1c8b83e86e
2 changed files with 14 additions and 6 deletions

View File

@ -13,6 +13,7 @@ push @EXPORT, '&getJobsFile';
push @EXPORT, '&getRptFile';
push @EXPORT, '&getRptURL';
push @EXPORT, '&getLines';
push @EXPORT, '&getLocation';
sub new {
my $self = {};

View File

@ -78,7 +78,7 @@ sub getTimeUntil() {
}
sub loadProjectList() {
my $result="<table><tr><th>Project</th><th></th><th>Home page</th><th>Problems found</th></tr>";
my @projects = ();
opendir(DIR, "jobs/") or return "can't open jobs directory!";
while (defined($file=readdir(DIR))) {
if ($file =~ /txt/) {
@ -86,13 +86,20 @@ sub loadProjectList() {
my $jobdata=<FILE>;
close(FILE);
my $project = PMD::Project->new($jobdata);
my $jobtext=$project->getTitle();
if (-e $project->getRptFile()) {
$jobtext="<a href=\"@{[$project->getRptURL]}\">@{[$project->getTitle()]}</a>";
}
$result="${result}<tr><td>${jobtext}</td><td></td><td>@{[$project->getHomePage()]}</td><td>@{[$project->getLines()]}</td>";
push(@projects, $project);
}
}
@newprojects = sort { $a->getLocation() cmp $b->getLocation() || $a->getTitle() cmp $b->getTitle() } @projects;
my $result="<table><tr><th>Project</th><th></th><th>Home page</th><th>Problems found</th></tr>";
foreach $project (@newprojects) {
my $jobtext=$project->getTitle();
if (-e $project->getRptFile()) {
$jobtext="<a href=\"@{[$project->getRptURL]}\">@{[$project->getTitle()]}</a>";
}
$result="${result}<tr><td>${jobtext}</td><td></td><td>@{[$project->getHomePage()]}</td><td>@{[$project->getLines()]}</td>";
}
$result = "${result}</table>";
return $result;
}