include/head.wmi
2a9aaa80
 #! /usr/bin/wml
 <: use strict; :>
 <: use warnings; :>
 #use "perl-globals.wmi"
 #use "links.wmi"
 #use "versions.wmi"
 #use "navigation.wmi"
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
   <title>$(TITLE)</title>
   <link rel="shortcut icon" type="image/x-icon" href="$(IMGROOT)/favicon.ico" />
   <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)" />">
   <ifneq "$(REDIRECT_GLOBAL)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT_GLOBAL)" />">
   <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" />">
 
   # begin WML to generate css/js paths 
   <ifneq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/$(STYLESHEET)" />">
   <ifeq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/master.css" />">
 
   #<link href="css/master.css" rel="stylesheet" type="text/css" />
   <!--[if lte IE 7]>
   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie7-and-down.css" />
   <![endif]-->
   <!--[if IE 6]>
   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie6.css" />
   <![endif]-->
8f0bf3ab
 #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
2a9aaa80
   # end WML to generate css/js paths 
 
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
ad607e43
   <meta name="author" content="The Tor Project, Inc." />
   <meta name="keywords" content="anonymity online, tor, tor project, traffic analysis, anonymous communications research" />
   <meta name="description" content="truth" />
2a9aaa80
 </head>
 <body>
 <div id="wrap">
   <div id="header">
91897007
     <h1 id="logo"><a href="<page index>">Tor</a></h1>
2a9aaa80
       # navigation menu generation
       <div id="nav">
         <ul>
         <:{
             # create a hash and maintain order of keys
             my %navigation;
             my @keys;
             while (@navigation) {
               my $key = shift @navigation;
               my $val = shift @navigation;
               push @keys, $key;
               $navigation{$key} = $val;
             }
 
             my $page = $WML_SRC_BASENAME;
             my $lang = "$(LANG)";
 
             for my $key (@keys) {
               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
 
               # in directory of active link, set class active 
               my $class;
               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
                 $class = 'class="active"';
               } else {
                 $class = '';
               }
 
 	            $dir = '.' unless defined $dir;
                 
               # translated version
3bc6e418
               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
2a9aaa80
                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
               } 
               # english version
               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
               	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $navigation{$key};
               }
               # full url
               elsif ($key =~/^http/) {
                 printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
               } else {
236d67ee
                 warn "$WML_SRC_FILENAME has a [page $key] (parses to
3bc6e418
 docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
2a9aaa80
               }
             }
         }:>
         </ul>
       </div>
       <!-- END NAV -->
      # end navigation generation
       <div id="calltoaction">
         <ul>
           <:{
             my %calltoaction;
             my @keys;
             while (@calltoaction) {
               my $key = shift @calltoaction;
               my $val = shift @calltoaction;
               push @keys, $key;
               $calltoaction{$key} = $val;
             } 
 
             my $page = $WML_SRC_BASENAME;
             my $lang = "$(LANG)";
             for my $key (@keys) {
               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
 
               # in directory, set active 
               my $class;
               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
               #if ($WML_SRC_BASENAME eq $base) {
                 $class = 'class="active"';
               } else {
                 $class = '';
               }
 
 	          $dir = '.' unless defined $dir;
               # try to use a translated version
3bc6e418
               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
2a9aaa80
                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
               } 
               # default to english version
               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
               	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
               } else {
3bc6e418
                 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.";
2a9aaa80
               }
             }    
           }:>
         </ul>
       </div>
       <!-- END CALLTOACTION -->
   </div>
   <!-- END HEADER -->
 
 #<ifneq "$(REDIRECT)" "" "Redirecting to <a href="$(DOCROOT)/$(REDIRECT)">$(DOCROOT)/$(REDIRECT)</a>.">
 #<ifneq "$(REDIRECT_GLOBAL)" "" "Redirecting to <a href="$(REDIRECT_GLOBAL)">$(REDIRECT_GLOBAL)</a>.">