|;
-
- foreach my $category (@menu) { #FIXME: insert appropriate classnames for styles when they're finished.
- $menu_html .='
-
'.mt($category->{'categorytitle'}).'
-
';
- foreach my $item ( @{ $category->{items} } ) {
- next unless $item->{'permission'};
- $menu_html .= qq|';
- }
- $menu_html .= '
';
+ # subs for specific html elements
+ my ($h3, $div, $ul, $li, $a, $img) = inittags( qw(h3 div ul li a img) );
+
+ my @categories; # each element represents the entire markup for a category
+
+ foreach my $category (@menu) {
+ my @links; # contains the links for the current $category
+ foreach my $link (@{$$category{items}}) {
+ next unless $$link{permission};
+
+ # create the markup for the current $link and push it into @links.
+ # each entry consists of an image and a text optionally followed
+ # by a help link.
+ push @links, $li->(
+ $a->(
+ $img->("", {
+ class => "LC_noBorder LC_middle",
+ src => "/res/adm/pages/$$link{icon}",
+ alt => mt(defined($$link{alttext}) ?
+ $$link{alttext} : $$link{linktext})
+ }), {
+ href => $$link{url},
+ title => mt($$link{linktitle})
+ }).
+ $a->(mt($$link{linktext}), {
+ href => $$link{url},
+ title => mt($$link{linktitle}),
+ class => "LC_menubuttons_link"
+ }).
+ (defined($$link{help}) ?
+ Apache::loncommon::help_open_topic($$link{help}) : ''),
+ {class => "LC_menubuttons_inline_text"});
+ }
+
+ # wrap categorytitle in
, concatenate with
+ # joined and in tags wrapped @links
+ # and wrap everything in an enclosing and push it into
+ # @categories
+ # such that each element looks like:
+ #
+ # the category won't be added if there aren't any links
+ push @categories,
+ $div->($h3->(mt($$category{categorytitle}), {class=>"LC_hcell"}).
+ $ul->(join('' ,@links), {class =>"LC_ListStyleNormal" }),
+ {class=>"LC_ContentBoxSpecial LC_400Box"}) if scalar(@links);
}
- $menu_html .= qq|
|;
- return $menu_html;
-}
+ # wrap the joined @categories in another (column layout)
+ return $div->(join('', @categories), {class => "LC_columnSection"});
+}
1;