--- loncom/interface/lonhtmlcommon.pm 2024/10/21 14:16:11 1.415 +++ loncom/interface/lonhtmlcommon.pm 2025/03/25 01:02:59 1.422 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.415 2024/10/21 14:16:11 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.422 2025/03/25 01:02:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -542,7 +542,14 @@ sub date_setter { my ($formname,$dname,$currentvalue,$special,$includeempty,$state, $no_hh_mm_ss,$defhour,$defmin,$defsec,$nolink,$no_mm_ss,$no_ss) = @_; my $now = time; - + my %labels = &Apache::lonlocal::texthash( + day => 'day', + month => 'month', + year => 'year', + sec => 'seconds', + min => 'minutes', + hour => 'hours', + ); my $tzname; my ($sec,$min,$hour,$mday,$month,$year) = ('', '', undef,''.''.''); #other potentially useful values: wkday,yrday,is_daylight_savings @@ -643,7 +650,7 @@ document.$formname.$dname\_year.value, ENDJS $result .= ' '; - my $monthselector = qq{}; # Month my @Months = qw/January February March April May June July August September October November December/; @@ -657,11 +664,11 @@ ENDJS } $monthselector.= ' '; # Day - my $dayselector = qq{}; + my $dayselector = qq{}; # Year - my $yearselector = qq{}; + my $yearselector = qq{}; # - my $hourselector = qq{}; if ($includeempty) { $hourselector.=qq{}; } @@ -683,8 +690,8 @@ ENDJS $hourselector .= $timest." \n"; } $hourselector .= " \n"; - my $minuteselector = qq{}; - my $secondselector= qq{}; + my $minuteselector = qq{}; + my $secondselector= qq{}; my $cal_link; unless (($nolink) || ($state eq 'disabled')) { $cal_link = qq{}; @@ -2080,7 +2087,7 @@ returns: nothing if ($lasttext ne '') { $links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1', - $lasttext), {title => $lasttext}); + $lasttext)); } my $icons = ''; @@ -2155,9 +2162,8 @@ returns: nothing # Return the breadcrumb's line - - - return "$links"; + my $labeltext = &HTML::Entities::encode(&mt('Links for navigation and information')); + return ''; } sub clear_breadcrumbs { @@ -2457,7 +2463,7 @@ sub docs_breadcrumbs { my @row_count; sub start_pick_box { - my ($css_class,$id) = @_; + my ($css_class,$id,$caption,$caption_class) = @_; if (defined($css_class)) { $css_class = 'class="'.$css_class.'"'; } else { @@ -2471,6 +2477,16 @@ sub start_pick_box { my $output = <<"END"; END + if (defined($caption)) { + if (defined($caption_class)) { + $caption_class = 'class="'.$caption_class.'"'; + } else { + $caption_class = 'class="LC_caption"'; + } + $output .= <<"END"; + +END + } return $output; } @@ -2490,7 +2506,7 @@ END } sub row_title { - my ($title,$css_title_class,$css_value_class, $css_value_furtherAttributes) = @_; + my ($title,$css_title_class,$css_value_class,$css_value_furtherAttributes,$nocolon) = @_; $row_count[0]++; my $css_class = ($row_count[0] % 2)?'LC_odd_row':'LC_even_row'; $css_title_class ||= 'LC_pick_box_title'; @@ -2498,14 +2514,14 @@ sub row_title { $css_value_class ||= 'LC_pick_box_value'; - if ($title ne '') { + if (($title ne '') && (!$nocolon)) { $title .= ':'; } my $output = <<"ENDONE"; -
$caption
+ $title - + ENDONE return $output; @@ -3948,6 +3964,8 @@ sub list_from_array { # Inputs: # An array of following structure: # ({ categorytitle => 'Categorytitle', +# listclass=>'class to use for
    tag for listed items in category (optional) +# boxclass=>'a class to use for the div which provides the box for the category (optional), # items => [ # { # linktext => 'Text to be displayed', @@ -3965,13 +3983,15 @@ 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. sub generate_menu { my @menu = @_; # subs for specific html elements - my ($h3, $div, $ul, $li, $a, $img) = inittags( qw(h3 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 foreach my $category (@menu) { @@ -3993,32 +4013,36 @@ sub generate_menu { src => $src, alt => mt(defined($$link{alttext}) ? $$link{alttext} : $$link{linktext}) - }), { - href => $$link{url}, - title => mt($$link{linktitle}), - class => 'LC_menubuttons_link' - }). - $a->(mt($$link{linktext}), { + }).$span->(mt($$link{linktext}), { + class => "LC_menu_text",}), { href => $$link{url}, title => mt($$link{linktitle}), class => "LC_menubuttons_link" }). - (defined($$link{help}) ? + (defined($$link{help}) ? Apache::loncommon::help_open_topic($$link{help}) : ''), {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

    , concatenate with + # 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: - #

      title

      • ...
      • ...
      + #

      title

      • ...
      • ...
      # 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_Box LC_400Box"})) if scalar(@links); + $div->($h2->(mt($$category{categorytitle}), {class=>'LC_hcell LC_heading_2'}). + $ul->(join('' ,@links), {class =>"$ulclass" }), + {class=>"$boxclass LC_400Box"})) if scalar(@links); } # wrap the joined @categories in another
      (column layout)