9ecbc33244bc0cb3d51a351d1f09f98f4cff5752
Andrew Lewman add tbb head include

Andrew Lewman authored 10 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 6 years ago

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

Andrew Lewman authored 10 years ago

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

hiromipaw authored 6 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 10 years ago

20) 
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

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

Andrew Lewman authored 10 years ago

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

hiromipaw authored 6 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 10 years ago

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

hiromipaw authored 6 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 10 years ago

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

hiromipaw authored 6 years ago

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

Andrew Lewman authored 10 years ago

30)   <![endif]-->
31) #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

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

Andrew Lewman authored 10 years ago

33) 
34)   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
35)   <meta name="author" content="The Tor Project, Inc.">
36)   <meta name="keywords" content="anonymity online, tor, tor project, censorship circumvention, traffic analysis, anonymous communications research">
37) </head>
38) <body>
39) <div id="wrap">
40)   <div id="header">
41)     <h1 id="logo"><a href="<page index>">Tor</a></h1>
42)       # navigation menu generation
43)       <div id="nav">
44)         <ul>
45)         <:{
46)             # create a hash and maintain order of keys
47)             my %navigation;
48)             my @keys;
49)             while (@navigation) {
50)               my $key = shift @navigation;
51)               my $val = shift @navigation;
52)               push @keys, $key;
53)               $navigation{$key} = $val;
54)             }
55) 
56)             my $page = $WML_SRC_BASENAME;
57)             my $lang = "$(LANG)";
58) 
59)             for my $key (@keys) {
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

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

Andrew Lewman authored 10 years ago

61) 
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

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

Andrew Lewman authored 10 years ago

63)               my $class;
64)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
65)                 $class = 'class="active"';
66)               } else {
67)                 $class = '';
68)               }
69) 
70) 	            $dir = '.' unless defined $dir;
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

71) 
Andrew Lewman add tbb head include

Andrew Lewman authored 10 years ago

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

hiromipaw authored 6 years ago

76)               }
Andrew Lewman add tbb head include

Andrew Lewman authored 10 years ago

77)               # english version
78)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
79)               	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
80)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $navigation{$key};
81)               }
82)               # full url
83)               elsif ($key =~/^http/) {
84)                 printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
85)               } else {
86)                 warn "$WML_SRC_FILENAME has a [page $key] (parses to
87) docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
88)               }
89)             }
90)         }:>
91)         </ul>
92)       </div>
93)       <!-- END NAV -->
94)      # end navigation generation
95)       <div id="calltoaction">
96)         <ul>
97)           <:{
98)             my %calltoaction;
99)             my @keys;
100)             while (@calltoaction) {
101)               my $key = shift @calltoaction;
102)               my $val = shift @calltoaction;
103)               push @keys, $key;
104)               $calltoaction{$key} = $val;
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

105)             }
Andrew Lewman add tbb head include

Andrew Lewman authored 10 years ago

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

hiromipaw authored 6 years ago

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

Andrew Lewman authored 10 years ago

111) 
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

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

Andrew Lewman authored 10 years ago

113)               my $class;
114)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
115)               #if ($WML_SRC_BASENAME eq $base) {
116)                 $class = 'class="active"';
117)               } else {
118)                 $class = '';
119)               }
120) 
121) 	          $dir = '.' unless defined $dir;
122)               # try to use a translated version
123)               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
124)                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
125)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

126)               }
Andrew Lewman add tbb head include

Andrew Lewman authored 10 years ago

127)               # default to english version
128)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
129)               	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
130)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
131)               } else {
132)                 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.";
133)               }
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

134)             }