e5bead59ddd73f6037faaa9fca380af96aee0ed4
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 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>
Andrew Lewman fix up the missing close ta...

Andrew Lewman authored 13 years ago

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"
17) type="application/rss+xml" //>">
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

18) 
19)   # begin WML to generate css/js paths 
Andrew Lewman fix up the missing close ta...

Andrew Lewman authored 13 years ago

20)   <ifneq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/$(STYLESHEET)" //>">
21)   <ifeq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/master.css" //>">
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

22) 
Andrew Lewman fix up the missing close ta...

Andrew Lewman authored 13 years ago

23)   #<link href="css/master.css" rel="stylesheet" type="text/css" //>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

24)   <!--[if lte IE 7]>
Andrew Lewman fix up the missing close ta...

Andrew Lewman authored 13 years ago

25)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie7-and-down.css" //>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

26)   <![endif]-->
27)   <!--[if IE 6]>
Andrew Lewman fix up the missing close ta...

Andrew Lewman authored 13 years ago

28)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie6.css" //>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

29)   <![endif]-->
Andrew Lewman fix the press links so they...

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

31)   # end WML to generate css/js paths 
32) 
Andrew Lewman fix up the missing close ta...

Andrew Lewman authored 13 years ago

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)   <meta name="description" content="truth" //>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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) {
60)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
61) 
62)               # in directory of active link, set class active 
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;
71)                 
72)               # translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

74)                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
75)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
76)               } 
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 {
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

87) 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 13 years ago

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;
105)             } 
106) 
107)             my $page = $WML_SRC_BASENAME;
108)             my $lang = "$(LANG)";
109)             for my $key (@keys) {
110)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
111) 
112)               # in directory, set active 
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
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

124)                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
125)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
126)               } 
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 {
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

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.";