+ if (-f $home_text) {
+ print "<div class=\"index_include\">\n";
+ open (my $fd, $home_text);
+ print <$fd>;
+ close $fd;
+ print "</div>\n";
+ }
+ print "<div class=\"page_body\"><br/>\n" .
+ "<table cellspacing=\"0\">\n" .
+ "<tr>\n" .
+ "<th>Project</th>\n" .
+ "<th>Description</th>\n" .
+ "<th>Owner</th>\n" .
+ "<th>last change</th>\n" .
+ "<th></th>\n" .
+ "</tr>\n";
+ foreach my $pr (@list) {
+ my %proj = %$pr;
+ my $head = git_read_hash("$proj{'path'}/HEAD");
+ if (!defined $head) {
+ next;
+ }
+ $ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$proj{'path'}/objects";
+ $ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$proj{'path'}/objects";
+ my %co = git_read_commit($head);
+ if (!%co) {
+ next;
+ }
+ my $descr = git_read_description($proj{'path'}) || "";
+ # get directory owner if not already specified
+ if (!defined $proj{'owner'}) {
+ $proj{'owner'} = get_file_owner("$projectroot/$proj{'path'}") || "";
+ }
+ print "<tr>\n" .
+ "<td>" . $cgi->a({-href => "$my_uri?p=" . $proj{'path'} . ";a=summary"}, escapeHTML($proj{'path'})) . "</td>\n" .
+ "<td>$descr</td>\n" .
+ "<td><i>$proj{'owner'}</i></td>\n";
+ my $colored_age;
+ if ($co{'age'} < 60*60*2) {
+ $colored_age = "<span style =\"color: #009900;\"><b><i>$co{'age_string'}</i></b></span>";
+ } elsif ($co{'age'} < 60*60*24*2) {
+ $colored_age = "<span style =\"color: #009900;\"><i>$co{'age_string'}</i></span>";
+ } else {
+ $colored_age = "<i>$co{'age_string'}</i>";
+ }
+ print "<td>$colored_age</td>\n" .
+ "<td class=\"link\">" .
+ $cgi->a({-href => "$my_uri?p=$proj{'path'};a=summary"}, "summary") .
+ " | " . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=log"}, "log") .
+ " | " . $cgi->a({-href => "$my_uri?p=$proj{'path'};a=tree"}, "tree") .
+ "</td>\n";
+ }
+ print "</table>\n" .
+ "<br/>\n" .
+ "</div>\n";
+ git_footer_html();
+}
+
+sub git_read_tags {
+ my @taglist;
+
+ opendir my $dh, "$projectroot/$project/refs/tags";
+ my @tags = grep !m/^\./, readdir $dh;
+ closedir($dh);
+ foreach my $tag_file (@tags) {
+ my $tag_id = git_read_hash("$project/refs/tags/$tag_file");
+ my $type = git_get_type($tag_id) || next;
+ my %tag_item;
+ my %co;
+ if ($type eq "tag") {
+ my %tag = git_read_tag($tag_id);
+ if ($tag{'type'} eq "commit") {
+ %co = git_read_commit($tag{'object'});
+ }
+ $tag_item{'type'} = $tag{'type'};
+ $tag_item{'name'} = $tag{'name'};
+ $tag_item{'id'} = $tag{'object'};
+ } elsif ($type eq "commit"){
+ %co = git_read_commit($tag_id);
+ $tag_item{'type'} = "commit";
+ $tag_item{'name'} = $tag_file;
+ $tag_item{'id'} = $tag_id;
+ }
+ $tag_item{'epoch'} = $co{'author_epoch'} || 0;
+ $tag_item{'age'} = $co{'age_string'} || "unknown";
+
+ push @taglist, \%tag_item;
+ }
+ # sort tags by age
+ @taglist = sort {$b->{'epoch'} <=> $a->{'epoch'}} @taglist;
+ return \@taglist;
+}
+
+sub git_summary {
+ my $descr = git_read_description($project) || "none";
+ my $head = git_read_hash("$project/HEAD");
+ $ENV{'GIT_OBJECT_DIRECTORY'} = "$projectroot/$project/objects";
+ $ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$project/objects";
+ my %co = git_read_commit($head);
+ my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
+
+ my $owner;
+ if (-f $projects_list) {
+ open (my $fd , $projects_list);
+ while (my $line = <$fd>) {
+ chomp $line;
+ my ($pr, $ow) = split ':', $line;
+ if ($pr eq $project) {
+ $owner = $ow;
+ last;