]> git.deb.at Git - deb/packages.git/commitdiff
Emply various dark magic, so that the language override works for the homepage
authorFrank Lichtenheld <frank@lichtenheld.de>
Sat, 4 Jul 2009 21:33:22 +0000 (23:33 +0200)
committerFrank Lichtenheld <frank@lichtenheld.de>
Sat, 4 Jul 2009 21:33:22 +0000 (23:33 +0200)
Oh, so many parts of this need a clean rewrite...

conf/apache.conf.sed.in
lib/Packages/Dispatcher.pm
lib/Packages/DoIndex.pm
templates/html/homepage.tmpl

index b0b33e3fbb5c309ce35df5a65ca4bb53a3c220fa..91833a623313e3d87bc44f671ee13ffec8ac828c 100644 (file)
    RewriteRule ^/robots.txt$ - [L]
 
 #   RewriteRule ^/$ http://www.debian.org/distrib/packages
-   RewriteRule ^/$                     /index.html [L]
+   RewriteRule ^/$                     /index [L]
    RewriteRule ^/([^/+]*)([+])([^/]*)$ "/$1%%{%}2B$3" [N]
    RewriteRule ^/changelog:(.+)$       /changelogs/${changelog-url:$1} [R,L,NE]
    RewriteRule ^/src:([^/]+)$          /search?searchon=sourcenames&keywords=$1 [R,L,NE]
    RewriteRule ^/file:(.+)$            /search?searchon=contents&keywords=$1 [R,L,NE]
-   RewriteCond %{QUERY_STRING} ^$ [OR]
-   RewriteCond %{REQUEST_URI} !^/search$
-   RewriteCond %{REQUEST_URI} !^/cgi-bin/search_(contents|packages)\.pl$
-   RewriteRule ^/([^/]+)$              /search?keywords=$1 [R,L,NE]
-
+   
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %TOPDIR%/www%{REQUEST_FILENAME} -f [OR]
    RewriteCond %TOPDIR%/www%{REQUEST_FILENAME}.en.html -f [OR]
    RewriteCond %TOPDIR%/www%{REQUEST_FILENAME} -l
    RewriteRule . - [L]
 
+   RewriteCond %{QUERY_STRING} ^$ [OR]
+   RewriteCond %{REQUEST_URI} !^/search$
+   RewriteCond %{REQUEST_URI} !^/cgi-bin/search_(contents|packages)\.pl$
+   RewriteRule ^/([^/]+)$              /search?keywords=$1 [R,L,NE]
+
    RewriteRule ^/(.+)$ /cgi-bin/dispatcher.pl/$1 [L,PT]
 
 #  In case we need to disable the site again
index 484e222f02bd0e433038c329309fa240a2119beb..08c6f96a1c7cee40a1985e2a88eeb3006908f27f 100755 (executable)
@@ -177,7 +177,11 @@ sub do_dispatch {
        } elsif (@components == 0) {
            fatal_error( "We're supposed to display the homepage here, instead of getting dispatch.pl" );
        } elsif (@components == 1) {
-           $what_to_do = 'search';
+           if ($components[0] eq 'index') {
+               $what_to_do = 'homepage';
+           } else {
+               $what_to_do = 'search';
+           }
        } else {
 
            for ($components[-1]) {
index 5aba6b3b0dc69588320b50a6e0210db114cede79..6af0c3ab34bee37de557845e6a1f9f2a389dc8f9 100644 (file)
@@ -12,7 +12,12 @@ use Packages::Config qw( $TOPDIR );
 use Packages::CGI;
 
 our @ISA = qw( Exporter );
-our @EXPORT = qw( do_index do_allpackages );
+our @EXPORT = qw( do_homepage do_index do_allpackages );
+
+sub do_homepage {
+    $_[1]->{suite} = [];
+    return send_file( 'index', @_ );
+}
 
 sub do_index {
     return send_file( 'index', @_ );
@@ -46,7 +51,7 @@ sub send_file {
     my $wwwdir = "$TOPDIR/www";
     my $path = "";
     $path .= "source/" if $opts->{source};
-    $path .= "$opts->{suite}[0]/";
+    $path .= "$opts->{suite}[0]/" if @{$opts->{suite}};
     $path .= "$opts->{archive}[0]/" if @{$opts->{archive}} == 1;
     $path .= "$opts->{subsection}[0]/" if @{$opts->{subsection}};
     $path .= "$opts->{priority}[0]/" if @{$opts->{priority}};
index 7aa276e08dea9bc4646535777ca2bd1a247cdae5..6dabe9f5b66b39cf28db5823443b2278ec550a8a 100644 (file)
@@ -115,4 +115,4 @@ Distribution:
 </select>
 </form>
 
-[% PROCESS 'html/foot.tmpl' copyright.years = '1997 - 2009' %]
+[% PROCESS 'html/foot.tmpl' page_name=packages_homepage copyright.years = '1997 - 2009' %]