open $pages{$key}{$lang}{index}{fh}, '>', "$wwwdir/$key/index.$lang.html.new"
or die "can't open index file for output: $!";
my $index_title = sprintf( _g( "List of sections in \"%s\"" ),
- $s );
+ $key );
print {$pages{$key}{$lang}{index}{fh}} header( title => $index_title,
title_keywords => "debian, $s",
desc => encode_entities( $index_title, '"' ),
or die "can't open index file for output: $!";
my $title = sprintf( _g( "Software Packages in \"%s\"" ),
- $s );
+ $key );
print {$pages{$key}{fh}} header( title => $title,
title_keywords => "debian, $s",
desc => encode_entities( $title, '"' ),
open $pages{$key}{$sec}{fh}, '>', "$wwwdir/$key/$sec/index.en.html.new"
or die "can't open index file for output: $!";
$title = sprintf( _g( "Software Packages in \"%s\", section %s" ),
- $s, $sec );
+ $key, $sec );
print {$pages{$key}{$sec}{fh}} header( title => $title,
title_keywords => "debian, $s, $sec",
desc => encode_entities( $title, '"' ),
open $pages{$key}{$ssec}{fh}, '>', "$wwwdir/$key/$ssec/index.en.html.new"
or die "can't open index file for output: $!";
$title = sprintf( _g( "Software Packages in \"%s\", subsection %s" ),
- $s, $ssec );
+ $key, $ssec );
print {$pages{$key}{$ssec}{fh}} header( title => $title,
title_keywords => "debian, $s, $ssec",
desc => encode_entities( $title, '"' ),
open $pages{$key}{$prio}{fh}, '>', "$wwwdir/$key/$prio/index.en.html.new"
or die "can't open index file for output: $!";
$title = sprintf( _g( "Software Packages in \"%s\", priority %s" ),
- $s, $prio );
+ $key, $prio );
print {$pages{$key}{$prio}{fh}} header( title => $title,
title_keywords => "debian, $s, $prio",
desc => encode_entities( $title, '"' ),
use Packages::DoSearch;
use Packages::DoSearchContents;
use Packages::DoShow;
+use Packages::DoIndex;
use Packages::DoDownload;
use Packages::DoFilelist;
if (my $path = $input->path_info() || $input->param('PATH_INFO')) {
my @components = grep { $_ } map { lc $_ } split /\/+/, $path;
- debug( "components[0]=$components[0]", 2 ) if @components>0;
+ push @components, 'index' if $path =~ m,/$,;
+
+ debug( "components[0]=$components[0]", 2 ) if DEBUG and @components>0;
if (@components > 0 and $components[0] eq 'source') {
shift @components;
$input->param( 'source', 1 );
}
- if (@components > 0 and $components[0] eq 'search') {
+ if (@components > 1 and $components[0] eq 'search') {
shift @components;
$what_to_do = 'search';
# Done
fatal_error( _g( "search doesn't take any more path elements" ) )
- if @components > 0;
+ if @components;
} elsif (@components == 0) {
fatal_error( _g( "We're supposed to display the homepage here, instead of getting dispatch.pl" ) );
} elsif (@components == 1) {
} else {
for ($components[-1]) {
- /^(changelog|copyright|download|filelist)$/ && do {
+ /^(index|changelog|copyright|download|filelist)$/ && do {
pop @components;
$what_to_do = $1;
last;
my $petd = timediff($pet1, $pet0);
debug( "Parameter evaluation took ".timestr($petd) ) if DEBUG;
-print $input->header( -charset => $charset );
-
my (%html_header, $menu, $page_content);
unless (@Packages::CGI::fatal_errors) {
no strict 'refs';
);
}
+print $input->header( -charset => $charset );
+
print Packages::HTML::header( %html_header );
print $menu||'';
RewriteEngine on
RewriteLog /var/log/apache/rewrite.log
- RewriteLogLevel 9
+ RewriteLogLevel 0
# we never want to rewrite those URLs
RewriteRule ^/cgi-(bin|old)/ - [L]
RewriteRule ^/Pics/ - [L]
RewriteRule ^/[^/]+\.css - [L]
- RewriteCond %{DOCUMENT_ROOT}/%{SCRIPT_FILENAME} "-f"
- RewriteRule ^. - [L]
-
- RewriteCond %{DOCUMENT_ROOT}/%{SCRIPT_FILENAME}.en.html "-f"
- RewriteRule ^. - [L]
-
- RewriteCond %{DOCUMENT_ROOT}/%{SCRIPT_FILENAME} "-d"
- RewriteRule ^. - [L]
-
# RewriteRule ^/$ http://www.debian.org/distrib/packages
RewriteRule ^/([^/+]*)([+])([^/]*)$ "/$1%%{%}2B$3" [N]
RewriteRule ^/src:([^/]+)$ /search/source/$1 [R,L,NE]
--- /dev/null
+package Packages::DoIndex;
+
+use strict;
+use warnings;
+
+use CGI qw( :cgi );
+use Exporter;
+
+use Deb::Versions;
+use Packages::Config qw( $TOPDIR );
+use Packages::I18N::Locale;
+use Packages::CGI;
+
+our @ISA = qw( Exporter );
+our @EXPORT = qw( do_index );
+
+sub do_index {
+ my ($params, $opts, $html_header) = @_;
+
+ if ($params->{errors}{suite}) {
+ fatal_error( _g( "suite not valid or not specified" ) );
+ }
+ if (@{$opts->{suite}} > 1) {
+ fatal_error( sprintf( _g( "more than one suite specified for show_static (%s)" ), "@{$opts->{suite}}" ) );
+ }
+ if (@{$opts->{subsection}} > 1) {
+ fatal_error( sprintf( _g( "more than one suite specified for show_static (%s)" ), "@{$opts->{suite}}" ) );
+ }
+
+ my $wwwdir = "$TOPDIR/www";
+ my $path = "$opts->{suite}[0]/";
+ $path .= "$opts->{archive}[0]/" if @{$opts->{archive}} == 1;
+ $path .= "$opts->{subsection}[0]/" if @{$opts->{subsection}};
+ # we don't have translated index pages for subsections yet
+ $opts->{lang} = 'en' if @{$opts->{subsection}};
+ $path .= "index.$opts->{lang}.html";
+
+ unless (@Packages::CGI::fatal_errors) {
+ my $buffer;
+ if (open( INDEX, '<', "$wwwdir/$path" )) {
+ my $charset = get_charset( $opts->{lang} );
+ print header( -charset => $charset );
+
+ binmode INDEX;
+ while (read INDEX, $buffer, 4096) {
+ print $buffer;
+ }
+ close INDEX;
+ exit;
+ } else {
+ fatal_error( sprintf( _g( "couldn't read index file %s: %s" ),
+ $path, $! ) );
+ }
+ }
+
+ %$html_header = ( title => _g('Error'),
+ lang => $opts->{lang},
+ print_title => 1,
+ print_search_field => 'packages',
+ search_field_values => {
+ keywords => _g('search for a package'),
+ searchon => 'default',
+ arch => 'any',
+ suite => 'all',
+ section => 'all',
+ exact => 1,
+ debug => $Packages::Search::debug,
+ },
+ );
+}
+
+1;
+
my $v_str = $version;
my $multiple_versions = grep { $_ ne $version } values %$versions;
- $v_str .= " (and others)" if $multiple_versions;
+ $v_str .= _g(" and others") if $multiple_versions;
my $title .= sprintf( _g( "Package: %s (%s)" ), $pkg, $v_str );
$title .= " ".marker( $archive ) if $archive ne 'us';
$title .= " ".marker( $subsection ) if $subsection eq 'non-US'