4f15a25efe7a85e207e58bcdc6003f232854818d
[infodrom.org/lists.infodrom.org] / Styles / menu.style
1 <:
2
3   # First the menu definition
4   #
5   @menu = ('Infodrom','Linux','Debian','linx','text','service','zeitungen','News','projects');
6   %menu_name = (
7                 'Infodrom'  => 'Infodrom',
8                 'Linux'     => 'Linux',
9                 'Debian'    => 'Debian',
10                 'linx'      => 'Linx',
11                 'text'     => 'Texte',
12                 'service'   => 'Service',
13                 'zeitungen' => 'Zeitungen',
14                 'News'      => 'News',
15                 'projects'  => 'Projekte',
16                 );
17 # Noch frei: #ba55d3 (dunkelviolett), dann aber die beiden Grüntöne tauschen
18   %menu_colors = (
19                   'Infodrom'  => '0000ff',
20                   'Linux'     => '00bdff',
21                   'Debian'    => 'ff4040',
22 #                 'linx'      => 'ff7f00',
23 #                 'linx'      => 'f6be00',
24 #                 'linx'      => 'f6d629',
25 #                 'linx'      => 'f9bd09',
26                   'linx'      => 'ff8c00',
27 #                 'text'      => 'ffd700',
28                   'text'      => 'ffc125',
29                   'service'   => 'ff00ff',
30                   'zeitungen' => 'ab82ff',
31 #                 'News'      => '32cd05',
32 #                 'projects'  => '3cb371',
33 #                 'News'      => '00ee00',
34 #                 'projects'  => '66cd00',
35                   'News'      => '32cd05',
36 #                 'projects'  => '19c100',
37                   'projects'  => '20b705',
38                   );
39
40
41 sub main_menu
42 {
43   $menucolor = "008dfd"; # Default: <menu-fgcolor> - Infodrom-Blau
44
45   # The main menu
46   print "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" summary=\"\"><tr>";
47   for ($index=0; $index <= $#menu; $index++) {
48     print "<td width=\"1\"> </td>" if ($index > 0);
49     if (("<get-var WML_SRC_DIRNAME>" =~ /src\/$menu[$index]$/) && ("<get-var WML_SRC_BASENAME>" eq "index")) {
50       printf "<td align=\"center\" valign=\"top\" bgcolor=\"#%s\">"
51             ."<font color=\"#ffffff\" face=\"Helvetica,Arial\"><b>%s</b></font></td>",
52              $menu_colors{$menu[$index]},
53              $menu_name{$menu[$index]};
54     } else {
55       printf "<td align=\"center\" valign=\"top\" bgcolor=\"#%s\"><a href=\"%s%s/\" target=\"_top\">"
56             ."<font color=\"#ffffff\" face=\"Helvetica,Arial\"><b>%s</b></font></a></td>",
57              $menu_colors{$menu[$index]},
58              $root_prefix,
59              $menu[$index],
60              $menu_name{$menu[$index]};
61     }
62   } 
63   print "</tr></table>";
64
65   # The second menu
66   for ($index=0; $index <= $#menu; $index++) {
67     if ("<get-var WML_SRC_DIRNAME>" =~ /src\/$menu[$index](\/|$)/) {
68       $menucolor = $menu_colors{$menu[$index]};
69       if (open (MENU, "$root_prefix$menu[$index]/menu.def")) {
70         printf "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" summary=\"\">"
71               ."<tr bgcolor=\"#%s\"><td align=\"center\" valign=\"top\">", $menucolor;
72         $nr = 0;
73         while (<MENU>) {
74           chomp();
75           next if /^\s*#/;
76           next if /^\s*$/;
77           print " <font color=\"#ffffff\" face=\"Helvetica,Arial\"><b>|</b></font> " if ($nr > 0);
78           ($name,$link) = split (/:/);
79           $selected = 0;
80           if ($link =~ /(.*)\/$/) {
81             $dir = $1;
82             "<get-var WML_SRC_DIRNAME>" =~ /.*\/(src\/.*)$/; $wdir = $1;
83             if (($wdir eq "src/$menu[$index]/$dir") && ("<get-var WML_SRC_BASENAME>" eq "index")) {
84               $selected = 1;
85             }
86           # ACHTUNG: Ist etwas unsauber, wegen foo/bar.html != bar.php3
87           } elsif ($link =~ /(.*)\.(html|php3)$/) {
88             if ("<get-var WML_SRC_BASENAME>" eq "$1") {
89               $selected = 1;
90             }
91           }
92
93           if ($selected) {
94             printf "<font size=\"-1\" color=\"#ffffff\" face=\"Helvetica,Arial\"><b>%s</b></font>", $name;
95           } else {
96             printf "<a href=\"%s%s/%s\" target=\"_top\"><font size=\"-1\" color=\"#ffffff\" face=\"Helvetica,Arial\"><b>%s</b></font></a>",
97                    $root_prefix, $menu[$index], $link, $name;
98           }
99           $nr++;
100         }
101         close (MENU);
102         print "</td></tr></table>";
103       }
104     }
105   }
106
107 }
108
109 :>
110
111 # The color of the current 2nd menu (regardless if there is any)
112 <define-tag menucolor><: print $menucolor; :></define-tag>
113
114 # Local variables:
115 # mode: indented-text
116 # mode: auto-fill
117 # end: