+platform
authorshort <>
Tue, 7 Oct 2003 19:41:24 +0000 (19:41 +0000)
committershort <>
Tue, 7 Oct 2003 19:41:24 +0000 (19:41 +0000)
Project.pm
Web.pm

index 2b916af..d67f978 100644 (file)
@@ -30,6 +30,10 @@ our @EXPORT=qw();
 our @ISA=qw(My::Web Exporter);
 
 
+use constant ENTRIES    =>top_dir()."/project/CVS/Entries";
+use constant ENTRIES_LOG=>top_dir()."/project/CVS/Entries.Log";
+
+
 sub print_project ($)
 {
 my($class,$ListItem)=@_;
@@ -191,4 +195,30 @@ table.print_project td { vertical-align: top; }
        return $W;
 }
 
+sub item_hash_read ()
+{
+       my %dirs;
+       for my $ENTRIES (ENTRIES,ENTRIES_LOG) {
+               local *E;
+               next if !open E,$ENTRIES;
+               while (<E>) {
+                       chomp;
+                       do { $dirs{$1}=1; next; } if m#^(?:A )?D/([^/]*)/#;
+                       next if m#^/([^/]*)/# ;
+                       next if /^D$/;
+                       warn "File $ENTRIES contains invalid line \"$_\": $!";
+                       }
+               close E;
+               }
+
+       my %item;
+       for my $dir (keys(%dirs)) {
+               Wrequire "project::${dir}::ListItem";
+               my $item=eval('\@project::'.$dir.'::ListItem::ListItem');
+               do { warn "Broken project/$dir/ListItem.pm"; next; } if !defined $item;
+               $item{$dir}={ My::Project::project_arr_to_hash(@$item) };
+               }
+       return %item;
+}
+
 1;
diff --git a/Web.pm b/Web.pm
index 3d4104e..6ec9d59 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -328,6 +328,8 @@ my($url,$contents,%args)=@_;
 
        do { $$_=1 if !defined $$_; } for (\$args{"size"});
        $contents=CGI::escapeHTML($url) if !defined $contents;
+       $contents=~s#<a\b[^>]*>##gi;
+       $contents=~s#</a>##gi;
 
        my $r='<a href="';
        my $urlent=CGI::escapeHTML($url);
@@ -341,6 +343,8 @@ my($url,$contents,%args)=@_;
                { $r.=$urlent; }
        else    # unknown client, &CGI::escapeHTML should not be needed here
                { $r.=CGI::escapeHTML(top_dir()."/Redirect.pl?location=".uri_escape($url)); }
+       $r.='"';
+       do { $r.=" $_" if $_; } for ($args{"attr"});
        $r.='">'.$contents.'</a>';
        if ($args{"size"} && url_is_local($url) && $url=~/[.](?:gz|Z|rpm|zip|deb|lha)/) {       # Downloadable?
                if (!-r $url)