[LON-CAPA-cvs] cvs: loncom /interface courseprefs.pm
raeburn
raeburn at source.lon-capa.org
Thu May 7 19:08:12 EDT 2026
raeburn Thu May 7 23:08:12 2026 EDT
Modified files:
/loncom/interface courseprefs.pm
Log:
- WCAG 2 compliance.
- Eliminate onfocus="this.blur() ... open window, to allow tab-only access.
- Include labels for form elements.
- Replace use of <table> for layout with <div>.
- Group form elements in fieldset with legend for screenreaders.
-------------- next part --------------
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.145 loncom/interface/courseprefs.pm:1.146
--- loncom/interface/courseprefs.pm:1.145 Sat Apr 18 05:52:51 2026
+++ loncom/interface/courseprefs.pm Thu May 7 23:08:11 2026
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set configuration settings for a course
#
-# $Id: courseprefs.pm,v 1.145 2026/04/18 05:52:51 raeburn Exp $
+# $Id: courseprefs.pm,v 1.146 2026/05/07 23:08:11 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4265,10 +4265,9 @@
},
'categories' => {
text => &mt($itemtext->{'categories'}),
- link => '<a href="javascript:catsbrowser()">'.
- &mt('Display Categories').'</a>',
input => 'textbox',
size => '25',
+ label => 'categories_display',
},
'loncaparev' => {
text => &mt($itemtext->{'loncaparev'}),
@@ -4280,13 +4279,15 @@
my $datatable;
my $count = 0;
foreach my $item (@{$ordered}) {
- my $colspan;
+ my ($colspan,$leftclass,$rightclass);
if ($item eq 'hidefromcat') {
next if (!$can_toggle_cat);
} elsif ($item eq 'categories') {
next if (!$can_categorize);
} elsif ($item eq 'uniquecode') {
next if (!$env{'course.'.$env{'request.course.id'}.'.internal.uniquecode'});
+ } elsif ($item eq 'co-owners') {
+ $rightclass = 'LC_left_item';
}
unless (($item eq 'cloners') || ($item eq 'rolenames')) {
$colspan = 2;
@@ -4294,10 +4295,10 @@
$count ++;
if (exists $items{$item}{advanced} && $items{$item}{advanced} == 1) {
$datatable .= &item_table_row_start($items{$item}{text},$items{$item}{link},$items{$item}{subtext},
- $items{$item}{label},$count,"advanced",$colspan);
+ $items{$item}{label},$count,"advanced",$colspan,$leftclass,$rightclass);
} else {
$datatable .= &item_table_row_start($items{$item}{text},$items{$item}{link},$items{$item}{subtext},
- $items{$item}{label},$count,undef,$colspan);
+ $items{$item}{label},$count,undef,$colspan,$leftclass,$rightclass);
}
if ($items{$item}{input} eq 'radio') {
$datatable .= &yesno_radio($item,$items{$item}{legend},$settings,undef,undef,undef,$noedit);
@@ -4461,7 +4462,10 @@
if ($noedit) {
$launcher = $disabled;
} else {
- $launcher = 'onfocus="this.blur();javascript:catsbrowser();"';
+ $launcher = ' id="'.$item.'_display" readonly="readonly" placeholder="'
+ .&mt('use Display Categories link').'"';
+ $datatable .= '<a href="javascript:catsbrowser()">'.
+ &mt('Display Categories').'</a> ';
}
$datatable .= '<input type="hidden" name="categories" value="'.$settings->{$item}.'" />'.
&Apache::lonhtmlcommon::textbox($item.'_display',$settings->{$item},
@@ -5488,38 +5492,43 @@
}
my $coowner_rows = @currcoown + @pendingcoown + @othercoords;
if ($coowner_rows) {
- $output .= &Apache::loncommon::start_data_table();
+ $output .= '<div class="LC_grid" role="grid" style="margin: 0;">';
if (@currcoown) {
- $output .= &Apache::loncommon::start_data_table_row().
- '<td><i>'.&mt('Current co-owners').'</i></td><td>';
+ $output .= '<div class="LC_grid_row" role="row">'
+ .'<div class="LC_grid_cell role="gridcell" style="vertical-align: top;">'
+ .'<i>'.&mt('Current co-owners').'</i></div>'
+ .'<div class="LC_grid_cell role="gridcell">';
foreach my $person (@currcoown) {
my ($co_uname,$co_dom) = split(':',$person);
$output .= '<span class="LC_nobreak"><label><input type="checkbox" name="coowners" checked="checked" value="'.$person.'"'.$disabled.' />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' ';
}
- $output .= '</td>'.
- &Apache::loncommon::end_data_table_row();
+ $output .= '</div></div>';
}
if ($pendingcoowners) {
- $output .= &Apache::loncommon::start_data_table_row().
- '<td><i>'.&mt('Invited as co-owners [_1](agreement pending)','<br />').'</i></td><td>';
+ $output .= '<div class="LC_grid_row" role="row">'
+ .'<div class="LC_grid_cell role="gridcell" style="vertical-align: top;">'
+ .'<i>'.&mt('Invited as co-owners [_1](agreement pending)','<br />').'</i>'
+ .'</div>'
+ .'<div class="LC_grid_cell role="gridcell">';
foreach my $person (@pendingcoown) {
my ($co_uname,$co_dom) = split(':',$person);
$output .= '<span class="LC_nobreak"><label><input type="checkbox" name="pendingcoowners" checked="checked" value="'.$person.'"'.$disabled.' />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' ';
}
- $output .= '</td>'.
- &Apache::loncommon::end_data_table_row();
+ $output .= '</div></div>';
}
if (@othercoords) {
- $output .= &Apache::loncommon::start_data_table_row().
- '<td><i>'.&mt('Invite other Coordinators [_1]to become co-owners','<br />').'</i></td><td>';
+ $output .= '<div class="LC_grid_row" role="row">'
+ .'<div class="LC_grid_cell role="gridcell style="vertical-align: top;">'
+ .'<i>'.&mt('Invite other Coordinators [_1]to become co-owners','<br />').'</i>'
+ .'</div>'
+ .'<div class="LC_grid_cell role="gridcell">';
foreach my $person (@othercoords) {
my ($co_uname,$co_dom) = split(':',$person);
$output .= '<span class="LC_nobreak"><label><input type="checkbox" name="invitecoowners" value="'.$person.'"'.$disabled.' />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' ';
}
- $output .= '</td>'.
- &Apache::loncommon::end_data_table_row();
+ $output .= '</div></div>';
}
- $output .= &Apache::loncommon::end_data_table();
+ $output .= '</div>';
} else {
$output = &mt('There are no coordinators to select as co-owners');
}
@@ -5551,37 +5560,45 @@
$is_pending = 1;
}
if (@currcoown && ($is_coowner || $is_pending)) {
- $output = &Apache::loncommon::start_data_table();
+ $output = '<div class="LC_grid" role="grid">';
}
if (@currcoown) {
if ($is_coowner || $is_pending) {
- $output .= &Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_row().'<td>';
+ $output .= '<div class="LC_grid_row" role="row">'
+ .'<div class="LC_grid_cell" role="gridcell">';
}
$output .= &mt('Current co-owners are:').' '.
join(', ', map { &Apache::loncommon::plainname(split(':',$_)); } (@currcoown));
if ($is_coowner || $is_pending) {
- $output .= '</td>'.&Apache::loncommon::end_data_table_row();
+ $output .= '</div></div>';
}
}
if ($is_coowner || $is_pending) {
if (@currcoown) {
- $output .= &Apache::loncommon::start_data_table_row().'<td>';
+ $output .= '<div class="LC_grid_row" role="row">'
+ .'<div class="LC_grid_cell" role="gridcell">';
}
- $output .= '<span class="LC_nobreak">';
if ($is_coowner) {
- $output .= &mt('You are currently a co-owner:').' <label><input type="checkbox" name="remove_coowner" value="'.$uname.':'.$udom.'" />'.&mt('Discontinue?').'</label>';
- } else {
- $output .= &mt('The course owner has invited you to become a co-owner:').' <label><input type="radio" name="pending_coowner" value="accept"'.$disabled.' />'.&mt('Accept?').'</label>'.(' 'x2).
- '<label><input type="radio" name=pending_coowner" value="decline"'.$disabled.' />'.&mt('Decline?').'</label>';
+ $output .= '<span class="LC_nobreak">'
+ .&mt('You are currently a co-owner:')
+ .' <label><input type="checkbox" name="remove_coowner" value="'.$uname.':'.$udom.'" />'
+ .&mt('Discontinue?').'</label></span>';
+ } else {
+ $output .= '<fieldset class="LC_borderless" style="margin: 0;">'
+ .'<legend class="LC_visually_hidden">'.&mt('Co-owner invitation').'</legend>'
+ .'<span class="LC_nobreak">'
+ .&mt('The course owner has invited you to become a co-owner:')
+ .' <label><input type="radio" name="pending_coowner" value="accept"'.$disabled.' />'
+ .&mt('Accept?').'</label>'.(' 'x2)
+ .'<label><input type="radio" name=pending_coowner" value="decline"'.$disabled.' />'.&mt('Decline?').'</label>'
+ .'</span></fieldset>';
}
- $output .= '</span>';
if (@currcoown) {
- $output .= '</td>'.&Apache::loncommon::end_data_table_row();
+ $output .= '</div></div>';
}
}
if (@currcoown && ($is_coowner || $is_pending)) {
- $output .= &Apache::loncommon::end_data_table();
+ $output .= '</div>';
}
return $output;
}
More information about the LON-CAPA-cvs
mailing list