8f0bf3ab3b71d8c9788af9bf1255d3955d55b443
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

1) #! /usr/bin/wml
2) <: use strict; :>
3) <: use warnings; :>
4) #use "perl-globals.wmi"
5) #use "links.wmi"
6) #use "versions.wmi"
7) #use "navigation.wmi"
8) 
9) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
10) <html xmlns="http://www.w3.org/1999/xhtml">
11) <head>
12)   <title>$(TITLE)</title>
13)   <link rel="shortcut icon" type="image/x-icon" href="$(IMGROOT)/favicon.ico" />
14)   <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)" />">
15)   <ifneq "$(REDIRECT_GLOBAL)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT_GLOBAL)" />">
16)   <ifeq "$(ANNOUNCE_RSS)" "yes" "<link rel="alternate" title="Tor Project OR-announce" href="http://rss.gmane.org/gmane.network.onion-routing.announce" type="application/rss+xml" />">
17) 
18)   # begin WML to generate css/js paths 
19)   <ifneq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/$(STYLESHEET)" />">
20)   <ifeq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/master.css" />">
21) 
22)   #<link href="css/master.css" rel="stylesheet" type="text/css" />
23)   <!--[if lte IE 7]>
24)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie7-and-down.css" />
25)   <![endif]-->
26)   <!--[if IE 6]>
27)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie6.css" />
28)   <![endif]-->
Andrew Lewman fix the press links so they...

Andrew Lewman authored 14 years ago

29) #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

30)   # end WML to generate css/js paths 
31) 
32)   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Andrew Lewman update meta tags, add robot...

Andrew Lewman authored 14 years ago

33)   <meta name="author" content="The Tor Project, Inc." />
34)   <meta name="keywords" content="anonymity online, tor, tor project, traffic analysis, anonymous communications research" />
35)   <meta name="description" content="truth" />
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

36) </head>
37) <body>
38) <div id="wrap">
39)   <div id="header">
Andrew Lewman it's called index, not home

Andrew Lewman authored 14 years ago

40)     <h1 id="logo"><a href="<page index>">Tor</a></h1>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

41)       # navigation menu generation
42)       <div id="nav">
43)         <ul>
44)         <:{
45)             # create a hash and maintain order of keys
46)             my %navigation;
47)             my @keys;
48)             while (@navigation) {
49)               my $key = shift @navigation;
50)               my $val = shift @navigation;
51)               push @keys, $key;
52)               $navigation{$key} = $val;
53)             }
54) 
55)             my $page = $WML_SRC_BASENAME;
56)             my $lang = "$(LANG)";
57) 
58)             for my $key (@keys) {
59)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
60) 
61)               # in directory of active link, set class active 
62)               my $class;
63)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
64)                 $class = 'class="active"';
65)               } else {
66)                 $class = '';
67)               }
68) 
69) 	            $dir = '.' unless defined $dir;
70)                 
71)               # translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 14 years ago

72)               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

73)                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
74)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
75)               } 
76)               # english version
77)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
78)               	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
79)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $navigation{$key};
80)               }
81)               # full url
82)               elsif ($key =~/^http/) {
83)                 printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
84)               } else {
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 14 years ago

85)                 warn "$WML_SRC_FILENAME has a [page $key] (parses to
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 14 years ago

86) docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

87)               }
88)             }
89)         }:>
90)         </ul>
91)       </div>
92)       <!-- END NAV -->
93)      # end navigation generation
94)       <div id="calltoaction">
95)         <ul>
96)           <:{
97)             my %calltoaction;
98)             my @keys;
99)             while (@calltoaction) {
100)               my $key = shift @calltoaction;
101)               my $val = shift @calltoaction;
102)               push @keys, $key;
103)               $calltoaction{$key} = $val;
104)             } 
105) 
106)             my $page = $WML_SRC_BASENAME;
107)             my $lang = "$(LANG)";
108)             for my $key (@keys) {
109)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
110) 
111)               # in directory, set active 
112)               my $class;
113)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
114)               #if ($WML_SRC_BASENAME eq $base) {
115)                 $class = 'class="active"';
116)               } else {
117)                 $class = '';
118)               }
119) 
120) 	          $dir = '.' unless defined $dir;
121)               # try to use a translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 14 years ago

122)               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

123)                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
124)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
125)               } 
126)               # default to english version
127)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
128)               	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
129)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
130)               } else {
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 14 years ago

131)                 warn "$WML_SRC_FILENAME has a [page $key] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";