Runa A. Sandvik
oh look, right-to-left is working
Runa A. Sandvik commited 969889618 at 2011-03-17 14:58:21
#! /usr/bin/wml
<: use strict; :>
<: use warnings; :>
#use "perl-globals.wmi"
#use "links.wmi"
#use "versions.wmi"
#use "sidenav.wmi"
<div class="img-shadow">
<div id="sidenav">
<:
# recursively search menu structure to see if it contains a given page
sub containsSub($$);
sub containsSub($$) {
my ($elements, $page) = @_;
for my $ele (@{$elements}) {
if (containsSub($ele->{'subelements'},$page)){
return 1;
} elsif ($page eq $ele->{'url'}) {
return 1;
}
}
return 0;
}
# generate navigation menu
sub printNavMenu($$$);
sub printNavMenu($$$) {
my ($navmenu, $page, $lang) = @_;
print '<ul>'."\n";
for my $navmenu (@{$navmenu}) {
# this menu entry is the current (active) page
if ($navmenu->{'url'} eq $page) {
# the current page has nested menu elements
if ($navmenu->{'subelements'}) { # menu has dropdown
printf '<li class="dropdown active"><a class="active" href="%s">%s</a></li>'."\n",
pageToURL($navmenu->{'url'}, $lang), $navmenu->{'txt'};
print '<li>'."\n";
printNavMenu($navmenu->{'subelements'},$page,$lang);
print '</li>'."\n";
# the current (active) page does not have sub elements
} else {
printf '<li class="active"><a class="active" href="%s">%s</a></li>'."\n",
pageToURL($navmenu->{'url'}, $lang), $navmenu->{'txt'};
}
# a subelement of this menu item is the current (active) page
} elsif (containsSub($navmenu->{'subelements'}, $page)) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX