Make language override URLs more robust
authorFrank Lichtenheld <frank@lichtenheld.de>
Wed, 23 Apr 2008 02:45:49 +0000 (04:45 +0200)
committerFrank Lichtenheld <frank@lichtenheld.de>
Wed, 23 Apr 2008 02:45:49 +0000 (04:45 +0200)
Previously they were just specified as "?lang=foo" which
broke horribly when the language was already specified in
the path_info.

Use make(_search)_url and fix all templates to provide the
necessary information.

bin/create_index_pages
bin/parse-debtags-voc
templates/html/download.tmpl
templates/html/filelist.tmpl
templates/html/foot.tmpl
templates/html/newpkg.tmpl
templates/html/show.tmpl
templates/html/suite_index.tmpl
templates/html/tag_index.tmpl

index 8072fa48fec3ca70441b800735b44b98d0617aa3..3e9fc529f63ff74fe27dcc2590370e1e3c0c297c 100755 (executable)
@@ -188,12 +188,18 @@ foreach my $source (("", "source/")) {
     foreach my $s (@SUITES) {
        my %common_vars = ( suite => $s,
                            is_source => $source );
-       close_file("$source$s", \%common_vars, 'allpackages');
-       close_txt_file("$source$s", \%common_vars, 'allpackages');
+       my $page_base = "$source$s/";
+       close_file("$source$s", { %common_vars,
+                                 page_name => "${page_base}allpackages" },
+                  'allpackages');
+       close_txt_file("$source$s", { %common_vars,
+                                     page_name => "{$page_base}allpackages" },
+                      'allpackages');
 
        foreach my $sec (keys %{$sections->{$s}}) {
            close_file("$source$s/$sec",
                       { %common_vars,
+                        page_name => "$page_base$sec/",
                         category => { id => N_('Section'),
                                       name => $sec }});
        }
@@ -201,6 +207,7 @@ foreach my $source (("", "source/")) {
            next if $ssec eq '-';
            close_file("$source$s/$ssec",
                       { %common_vars,
+                        page_name => "$page_base$ssec/",
                         category => { id => N_('Subsection'),
                                       name => $ssec }});
        }
@@ -208,6 +215,7 @@ foreach my $source (("", "source/")) {
            next if $prio eq '-';
            close_file("$source$s/$prio",
                       { %common_vars,
+                        page_name => "$page_base$prio/",
                         category => { id => N_('Priority'),
                                       name => $prio }});
        }
index 4fd49f9e6b2bedb93eb5cec77e57c02e6a871209..7515de118b8357f28a99e9ca4e808351f614c6be 100755 (executable)
@@ -125,7 +125,8 @@ foreach (@tags) {
 }
 my %content = ( vocabulary => \%voc,
                facets => \@facets, tags => \@tags,
-               tags_by_facet => \%tags_by_facet );
+               tags_by_facet => \%tags_by_facet,
+               used_langs => [ 'en' ]);
 print TAGLST $template->page( 'tag_index', \%content );
 close TAGLST or warn "Couldn't close tag list: $!";
 
index c524423d7bee245729a8ff48bf0174e681f21c03..97ef81e054d9d9ecb77499d944facfddbde14e5e 100644 (file)
@@ -110,4 +110,4 @@ deb http://<em>[% mirrors.$archive.europa.0 %]</em> [% suite %] main [% section
 <tr><th>[% g('SHA256 checksum') %]</th>        <td><tt>[% sha256  || g('Not Available') %]</tt></td>
 </table>
 
-[%- PROCESS 'html/foot.tmpl' -%]
+[%- PROCESS 'html/foot.tmpl' page_name="$pkg/download" -%]
index e450d5fc20ffd8e7ad9584323940e81825ee8a39..73fc88358e826fecf7d0bd478c36002b1887010e 100644 (file)
@@ -15,4 +15,4 @@
 [% '</pre></div>' IF loop.last -%]
 [% END %]
 
-[%- PROCESS 'html/foot.tmpl' -%]
+[%- PROCESS 'html/foot.tmpl' page_name="$pkg/filelist" -%]
index a6705db1634019603ddd9ac501cbf936e059fd80..b911d789a3908b5b5408ff2e58c701b2ff7a055c 100644 (file)
@@ -14,7 +14,7 @@ Total page evaluation took [% benchmark %]<br>
 <a href="[% IF keyword_esc;
                make_search_url('',"keywords=$keyword_esc",'lang',l.lang);
            ELSE;
-               "$page_name?lang=$l.lang";
+               make_url(page_name,"",'lang',l.lang);
            END %]" title="[% l.tooltip %]" hreflang="[% l.lang %]" lang="[% l.lang %]" rel="alternate">[% l.selfname %]
 [%- IF l.transliteration %] ([% l.transliteration %])[% END %]</a>
 [% END %]
index aaff0745cf642f4237f585d932e6b7d5310c895b..e8c5d3ee0af12d4aee6ac79dccfe699029f6be7e 100644 (file)
@@ -42,4 +42,4 @@
 [% END %]
 </p>
 
-[%- PROCESS 'html/foot.tmpl' -%]
+[%- PROCESS 'html/foot.tmpl' page_name=section ? "$section/newpkg" : "newpkg" -%]
index eec364b61c8a8c2687069bca031ffce027778f77..3ebc1a1ffabd5193bd5def82c57f62d197f30cc7 100644 (file)
 
 [%# <script type="text/javascript">init_tab_list("ptablist")</script> %]
 
-[%- PROCESS 'html/foot.tmpl' -%]
+[%- PROCESS 'html/foot.tmpl' page_name=pkg -%]
index aaa971c05d13c88b5e4802c5b02ee5a52d6c2db7..9be0784c1a8dcf33ece9ceab0d21cbdabb03e31f 100644 (file)
@@ -45,4 +45,4 @@
        (<a href="allpackages?format=txt.gz">[% g('compact compressed textlist') %]</a>)
 </p>
 
-[%- PROCESS 'html/foot.tmpl' -%]
+[%- PROCESS 'html/foot.tmpl' page_name= source ? "source/$suite/" : "$suite/" -%]
index 5f84c5e608c7a79ceb443b37e4082ae8f1602fce..5b29df4e8b0c73bda9337b083621d1bb309ef557 100644 (file)
@@ -22,4 +22,4 @@
 
 [% END %]
 
-[%- PROCESS 'html/foot.tmpl' -%]
+[%- PROCESS 'html/foot.tmpl' page_name="about/debtags" -%]