Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.421 and 1.422

version 1.421, 2025/03/06 16:51:36 version 1.422, 2025/03/25 01:02:59
Line 3964  sub list_from_array { Line 3964  sub list_from_array {
 # Inputs:  # Inputs:
 # An array of following structure:  # An array of following structure:
 #   ({ categorytitle => 'Categorytitle',  #   ({ categorytitle => 'Categorytitle',
   #       listclass=>'class to use for <ul> tag for listed items in category (optional)
   #       boxclass=>'a class to use for the div which provides the box for the category (optional),
 # items => [  # items => [
 #    {  #    {
 #           linktext    => 'Text to be displayed',  #           linktext    => 'Text to be displayed',
Line 3981  sub list_from_array { Line 3983  sub list_from_array {
 #   ...  #   ...
 #   )  #   )
 #  #
   # if listclass is not provided, LC_ListStyleNormal will be used.  
   # if box class is not provided, LC_Box will be used.
 # Outputs: A scalar containing the html markup for the menu.  # Outputs: A scalar containing the html markup for the menu.
   
 sub generate_menu {  sub generate_menu {
     my @menu = @_;      my @menu = @_;
     # subs for specific html elements      # subs for specific html elements
     my ($h2, $div, $ul, $li, $a, $img) = inittags( qw(h2 div ul li a img) );      my ($h2, $div, $ul, $li, $a, $img, $span) = inittags( qw(h2 div ul li a img span) );
       
     my @categories; # each element represents the entire markup for a category      my @categories; # each element represents the entire markup for a category
         
     foreach my $category (@menu) {      foreach my $category (@menu) {
Line 4009  sub generate_menu { Line 4013  sub generate_menu {
                                 src   => $src,                                  src   => $src,
                                 alt   => mt(defined($$link{alttext}) ?                                  alt   => mt(defined($$link{alttext}) ?
                                 $$link{alttext} : $$link{linktext})                                  $$link{alttext} : $$link{linktext})
                             }).mt($$link{linktext}), {                              }).$span->(mt($$link{linktext}), {
                                          class => "LC_menu_text",}), {
                             href  => $$link{url},                              href  => $$link{url},
                             title => mt($$link{linktitle}),                              title => mt($$link{linktitle}),
                             class => "LC_menubuttons_link"                              class => "LC_menubuttons_link"
Line 4018  sub generate_menu { Line 4023  sub generate_menu {
                          Apache::loncommon::help_open_topic($$link{help}) : ''),                           Apache::loncommon::help_open_topic($$link{help}) : ''),
                          {class => "LC_menubuttons_inline_text"}));                           {class => "LC_menubuttons_inline_text"}));
         }          }
           my $ulclass = 'LC_ListStyleNormal';
           if ($category->{'listclass'} ne '') {
               $ulclass = $category->{'listclass'};
           }
           my $boxclass = 'LC_Box';
           if ($category->{'boxclass'} ne '') {
               $boxclass = $category->{'boxclass'};
           }
   
         # wrap categorytitle in <h2>, concatenate with           # wrap categorytitle in <h2>, concatenate with 
         # joined and in <ul> tags wrapped @links          # joined and in <ul> tags wrapped @links
Line 4028  sub generate_menu { Line 4041  sub generate_menu {
         # the category won't be added if there aren't any links          # the category won't be added if there aren't any links
         push(@categories,           push(@categories, 
             $div->($h2->(mt($$category{categorytitle}), {class=>'LC_hcell LC_heading_2'}).              $div->($h2->(mt($$category{categorytitle}), {class=>'LC_hcell LC_heading_2'}).
             $ul->(join('' ,@links),  {class =>"LC_ListStyleNormal" }),              $ul->(join('' ,@links),  {class =>"$ulclass" }),
             {class=>"LC_Box LC_400Box"})) if scalar(@links);              {class=>"$boxclass LC_400Box"})) if scalar(@links);
     }      }
   
     # wrap the joined @categories in another <div> (column layout)      # wrap the joined @categories in another <div> (column layout)

Removed from v.1.421  
changed lines
  Added in v.1.422


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>