c8218256d842143c599614c87088700ebce7d8ed
Andrew Lewman add tbb head include

Andrew Lewman authored 11 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 HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
10) <html>
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) 
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

17)   # begin WML to generate css/js paths
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

18)   <ifneq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/$(STYLESHEET)">">
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

19)   <ifeq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/master.min.css">">
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

20) 
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

21)   <link href="$(DOCROOT)/css/tbbproject.min.css" rel="stylesheet" type="text/css">
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

22)   <!--[if lte IE 8]>
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

23)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie8-and-down.min.css">
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

24)   <![endif]-->
25)   <!--[if lte IE 7]>
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

26)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie7-and-down.min.css">
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

27)   <![endif]-->
28)   <!--[if IE 6]>
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

29)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie6.min.css">
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

30)   <![endif]-->
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

31)   # end WML to generate css/js paths
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

32) 
33)   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
34)   <meta name="author" content="The Tor Project, Inc.">
35)   <meta name="keywords" content="anonymity online, tor, tor project, censorship circumvention, traffic analysis, anonymous communications research">
36) </head>
37) <body>
38) <div id="wrap">
39)   <div id="header">
40)     <h1 id="logo"><a href="<page index>">Tor</a></h1>
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) {
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

59)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

60) 
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

61)               # in directory of active link, set class active
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

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;
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

70) 
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

71)               # translated version
72)               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
73)                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
74)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

75)               }
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

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 {
85)                 warn "$WML_SRC_FILENAME has a [page $key] (parses to
86) docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
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;
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

104)             }
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

105) 
106)             my $page = $WML_SRC_BASENAME;
107)             my $lang = "$(LANG)";
108)             for my $key (@keys) {
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

109)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

110) 
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

111)               # in directory, set active
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

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
122)               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
123)                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
124)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

125)               }
Andrew Lewman add tbb head include

Andrew Lewman authored 11 years ago

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 {
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.";
132)               }
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

133)             }