--- loncom/interface/loncommon.pm 2025/03/07 02:13:40 1.1469 +++ loncom/interface/loncommon.pm 2025/03/22 21:18:30 1.1474 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1469 2025/03/07 02:13:40 raeburn Exp $ +# $Id: loncommon.pm,v 1.1474 2025/03/22 21:18:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2800,7 +2800,7 @@ sub create_text_file { # ------------------------------------------ sub domain_select { - my ($name,$value,$multiple,$incdoms,$excdoms)=@_; + my ($name,$value,$multiple,$incdoms,$excdoms,$id)=@_; my @possdoms; if (ref($incdoms) eq 'ARRAY') { @possdoms = @{$incdoms}; @@ -2821,10 +2821,10 @@ sub domain_select { if ($multiple) { $domains{''}=&mt('Any domain'); $domains{'select_form_order'} = [sort {lc($a) cmp lc($b) } (keys(%domains))]; - return &multiple_select_form($name,$value,4,\%domains); + return &multiple_select_form($name,$value,4,\%domains,undef,$id); } else { $domains{'select_form_order'} = [sort {lc($a) cmp lc($b) } (keys(%domains))]; - return &select_form($name,$value,\%domains); + return &select_form($name,$value,\%domains,'','',$id); } } @@ -2836,7 +2836,7 @@ sub domain_select { =over 4 -=item * &multiple_select_form($name,$value,$size,$hash,$order) +=item * &multiple_select_form($name,$value,$size,$hash,$order,$id) Returns a string containing a element =cut #------------------------------------------- sub multiple_select_form { - my ($name,$value,$size,$hash,$order)=@_; + my ($name,$value,$size,$hash,$order,$id)=@_; my %selected = map { $_ => 1 } ref($value)?@{$value}:($value); my $output=''; if (! defined($size)) { @@ -2862,7 +2863,10 @@ sub multiple_select_form { $size = scalar(keys(%$hash)); } } - $output.="\n".''; my @order; if (ref($order) eq 'ARRAY') { @order = @{$order}; @@ -2886,7 +2890,7 @@ sub multiple_select_form { =pod -=item * &select_form($defdom,$name,$hashref,$onchange,$readonly) +=item * &select_form($defdom,$name,$hashref,$onchange,$readonly,$id,$aria_labelledby) Returns a string containing a \n"; + if ($id ne '') { + $id = ' id="'.$id.'"'; + } + if ($aria_labelledby ne '') { + $aria_labelledby = ' aria-labelledby="'.$aria_labelledby.'"'; + } + my $selectform = "\n"; + my $selectform = "'. - '
'.&mt('Type').': '. + '
\n"; return $Str; } @@ -15741,9 +15799,9 @@ sub csv_print_select_table { &end_data_table_header_row()."\n"); foreach my $array_ref (@$d) { my ($value,$display,$defaultcol)=@{ $array_ref }; - $r->print(&start_data_table_row().''.$display.''); + $r->print(&start_data_table_row().''); - $r->print(''); $r->print(''); foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) { @@ -15788,8 +15846,10 @@ sub csv_samples_select_table { &end_data_table_header_row()); foreach my $key (sort(keys(%{ $samples->[0] }))) { + my $num = $i+1; + my $labeltext = &HTML::Entities::encode(&mt('Field for data in column [_1]',$num)); $r->print(&start_data_table_row().'