]> git.deb.at Git - deb/packages.git/commitdiff
Hilight the keyword in contents searches
authorJeroen van Wolffelaar <jeroen@wolffelaar.nl>
Fri, 3 Mar 2006 02:29:25 +0000 (02:29 +0000)
committerJeroen van Wolffelaar <jeroen@wolffelaar.nl>
Fri, 3 Mar 2006 02:29:25 +0000 (02:29 +0000)
lib/Packages/DoSearchContents.pm
static/packages.css

index b30352575bda686da4579ec2c343aff1be1b67e0..bf0b435e40e0ad9157b53b03bbcabfe34a97aff6 100644 (file)
@@ -190,9 +190,11 @@ sub do_search_contents {
                                         scalar keys %results )."</p>";
        $$page_content .= '<div
        id="pcontentsres"><table><colgroup><col><col></colgroup><tr><th>'._g('File').'</th><th>'._g('Packages')
-           .'</th></tr>';
+           ."</th></tr>\n";
        foreach my $file (sort keys %results) {
-           $$page_content .= "<tr><td class=\"file\">/$file</td><td>";
+               my $file_enc = encode_entities($file);
+               $file_enc =~ s#(\Q$keyword_enc\E)#<span class=keyword>$1</span>#g;
+           $$page_content .= "<tr><td class=\"file\">/$file_enc</td><td>";
            my @pkgs;
            foreach my $pkg (sort keys %{$results{$file}}) {
                my $arch_str = '';
@@ -209,9 +211,9 @@ sub do_search_contents {
                push @pkgs, "<a href=\"".make_url($pkg,'',{suite=>$suite})."\">$pkg</a>$arch_str";
            }
            $$page_content .= join( ", ", @pkgs);
-           $$page_content .= '</td>';
+           $$page_content .= "</td></tr>\n";
        }
-       $$page_content .= '<tr><th>'._g('File').'</th><th>'._g('Packages').'</th></tr>' if @results > 20;
+       $$page_content .= '<tr><th>'._g('File').'</th><th>'._g('Packages')."</th></tr>\n" if @results > 20;
        $$page_content .= '</table></div>';
     }
 } # sub do_search_contents
index 73542cc1ad9b4179171e56d37ecb10bc10c81862..017ab8f22acf0e0354c98a5f83bc8c7801b8f6e4 100644 (file)
@@ -166,3 +166,6 @@ table#pdeplegend, #pdownload table {
        border-top: solid #BFC3DC thin;
        padding: .5em;
 }
+.keyword {
+       background-color: #bdf;
+}