[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonmenu.pm
raeburn
raeburn at source.lon-capa.org
Thu Feb 20 23:29:26 EST 2025
raeburn Fri Feb 21 04:29:26 2025 EDT
Modified files:
/loncom/interface lonmenu.pm loncommon.pm
Log:
- WCAG 2 compliance.
- Replace layout table on Main Menu page with divs
- Changes to "View As User" utility in Functions menu for Course Coordinator
- Only one "role="main" allowed, so removed from display of student's view
of a problem embedded in a Course Coordinator's grading page.
-------------- next part --------------
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.560 loncom/interface/lonmenu.pm:1.561
--- loncom/interface/lonmenu.pm:1.560 Tue Jan 7 22:21:56 2025
+++ loncom/interface/lonmenu.pm Fri Feb 21 04:29:26 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.560 2025/01/07 22:21:56 raeburn Exp $
+# $Id: lonmenu.pm,v 1.561 2025/02/21 04:29:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -817,7 +817,7 @@
my $menu = '<li class="LC_hoverable '.$addclass.'">'.
'<a href="'.$link.'"'.$targetattr.'>'.
'<span class="LC_nobreak">'.$title.
- '<span class="LC_fontsize_small" style="font-weight:normal;">'.
+ '<span class="LC_fontsize_medium" style="font-weight:normal;">'.
' ▼</span></span></a>'.
'<ul>';
@@ -1110,17 +1110,17 @@
if ($perms{'mgr'}) {
&switch('','',7,2,'pgrd.png','Content Grades','grades[_4]',
"gocmd('/adm/grades','gradingmenu')",
- 'Content Grades');
+ 'Grading for Resource/Folder');
} elsif ($perms{'vgr'}) {
&switch('','',7,2,'subm.png','Content Submissions','missions[_1]',
"gocmd('/adm/grades','submission')",
- 'Content Submissions');
+ 'Submissions for Resource/Folder');
}
}
if (($env{'request.symb'} ne '') && (($perms{'opa'}) || ($perms{'vpa'}))) {
&switch('','',7,3,'pparm.png','Content Settings','parms[_2]',
"gocmd('/adm/parmset','set')",
- 'Content Settings');
+ 'Content Settings for Resource/Folder');
}
# End grades/submissions check
@@ -1147,11 +1147,13 @@
if (($env{'request.symb'} ne '') &&
($env{'request.filename'}=~/$LONCAPA::assess_re/) &&
(($perms{'mgr'}) || ($perms{'vgr'}))) {
- my ($viewas,$text,$change,$visibility,$vuname,$vudom,$vid,$leftvis,$defdom,
- $domselector,$righticon);
+ my ($viewas,$text,$change,$visibility,$vuname,$vudom,$vid,$leftvis,$rightvis,
+ $defdom,$domselector,$righticon);
my %lt = &Apache::lonlocal::texthash(
view => 'View',
upda => 'Update',
+ user => 'View as user',
+ choo => 'Choose user',
);
my $possdomstr = $env{'course.'.$env{'request.course.id'}.'.internal.userdomains'};
if ($possdomstr =~ /,/) {
@@ -1163,7 +1165,10 @@
} elsif (&Apache::lonnet::domain($possdoms[0]) ne '') {
$defdom = $possdoms[0];
}
- $domselector = &Apache::loncommon::select_dom_form($defdom,'vudom','','','',\@possdoms);
+ $domselector = &Apache::loncommon::select_dom_form($defdom,'vudom','','','',
+ \@possdoms,'','','vudom').
+ '<span class="LC_visually_hidden"><label for="vudom">'.
+ &mt("user's domain").'</label></span>';
} elsif (($possdomstr ne '') && (&Apache::lonnet::domain($possdomstr) ne '')) {
if ($env{'request.user_in_effect'} =~ /^$match_username:($match_domain)$/) {
$defdom = $1;
@@ -1181,6 +1186,7 @@
$change = 'off';
$visibility = 'inline';
$leftvis = 'none';
+ $rightvis = 'inline';
$defdom = $vudom;
$righticon = '✖';
} else {
@@ -1188,6 +1194,8 @@
$change = 'on';
$visibility = 'none';
$leftvis = 'inline';
+ $rightvis = 'none';
+ $righticon = '◄';
if ($defdom eq '') {
$defdom = $cdom;
}
@@ -1212,11 +1220,14 @@
$input .= '<input name="LC_viewas" type="hidden" value="'.$viewas.'" />',
'<input name="symb" type="hidden" value="'.$shownsymb.'" />';
my $chooser = <<END;
+<span class="LC_visually_hidden">
+<label for="LC_vuname" id="LC_vuidentifier">$lt{'user'}</label>
+</span>
$selscript
-<a href="javascript:toggleViewAsUser('$change');" class="LC_menubuttons_link">
-<span id="usexpand" class="LC_menubuttons_inline_text" style="display:$leftvis">► </span>
+<a href="javascript:toggleViewAsUser('$change');" class="LC_menubuttons_link" id="usexpand" style="display:$leftvis;">
+<span class="LC_menubuttons_inline_text">► </span>
</a>
-<fieldset id="LC_selectuser" style="display:$visibility">
+<fieldset id="LC_selectuser" style="display:$visibility;"><legend class="LC_visually_hidden">$lt{'choo'}</legend>
<form name="userview" action="" method="post" onsubmit="event.preventDefault(); return validCourseUser(this,'$change');">
<span class="LC_menubuttons_inline_text LC_nobreak">
$input
@@ -1225,13 +1236,13 @@
<input type="submit" value="$text" />
</form>
</fieldset>
-<a href="javascript:toggleViewAsUser('$change');" class="LC_menubuttons_link">
-<span id="uscollapse" class="LC_menubuttons_inline_text">$righticon</span>
+<a href="javascript:toggleViewAsUser('$change');" class="LC_menubuttons_link" id="uscollapse" style="display:$rightvis">
+<span class="LC_menubuttons_inline_text">$righticon</span>
</a>
END
&switch('','',7,5,'viewuser.png','View As','user[_1]',
'toggleViewAsUser('."'$change'".')',
- 'View As','','',$chooser);
+ 'View resource as user','','',$chooser);
}
# End view as user check
@@ -1925,7 +1936,7 @@
sub clear {
my ($row,$col)=@_;
$inlineremote[10*$row+$col]='';
- return '';
+ return '';
}
# ============================================ Switch a button or create a link
@@ -1936,38 +1947,48 @@
my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak,$form)=@_;
$act=~s/\$uname/$uname/g;
$act=~s/\$udom/$udom/g;
- $top=&mt($top);
- $bot=&mt($bot);
$desc=&mt($desc);
my $idx=10*$row+$col;
$category_members{$cat}.=':'.$idx;
# Inline Menu
if ($nobreak==2) { return ''; }
- my $text=$top.' '.$bot;
+ my ($text,$alttext);
+ $text=&mt($top).' '.&mt($bot);
$text=~s/\s*\-\s*//gs;
+ if ($top) {
+ $alttext = &mt("$top icon");
+ } elsif ($bot) {
+ $alttext = &mt("$bot icon");
+ } elsif ($nobreak == 3) {
+ $alttext = &mt('Go forward icon');
+ } elsif ($nobreak) {
+ $alttext = &mt('Go back icon');
+ } else {
+ $alttext = &mt('icon');
+ }
my $pic=
- '<img alt="'.$text.'" src="'.
+ '<img alt="'.$alttext.'" src="'.
&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img).
'" align="'.($nobreak==3?'right':'left').'" class="LC_icon" />';
if ($env{'browser.interface'} eq 'faketextual') {
# Main Menu
if ($nobreak==3) {
$inlineremote[$idx]="\n".
- '<td class="LC_menubuttons_text" align="right">'.$text.
- '</td><td align="left">'.
+ '<th class="LC_menubuttons_text" align="right">'.$text.
+ '</th><td align="left">'.
'<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>';
} elsif ($nobreak) {
$inlineremote[$idx]="\n<tr>".
- '<td align="left">'.
- '<a href="javascript:'.$act.';">'.$pic.'</a></td>
+ '<th align="left">'.
+ '<a href="javascript:'.$act.';">'.$pic.'</a></th>
<td class="LC_menubuttons_text" align="left"><a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$text.'</span></a></td>';
} else {
$inlineremote[$idx]="\n<tr>".
- '<td align="left">'.
+ '<th align="left">'.
'<a href="javascript:'.$act.';">'.$pic.
- '</a></td><td class="LC_menubuttons_text" colspan="3">'.
+ '</a></th><td class="LC_menubuttons_text" colspan="3">'.
'<a class="LC_menubuttons_link" href="javascript:'.$act.';"><span class="LC_menubuttons_inline_text">'.$desc.'</span></a></td></tr>';
}
} else {
@@ -1982,9 +2003,10 @@
$inlineremote[$idx] =
'<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.'</a>';
} else {
+ my $linktext = &mt($top);
$inlineremote[$idx] =
'<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.
- '<span class="LC_menubuttons_inline_text">'.$top.' </span></a>'.$form;
+ '<span class="LC_menubuttons_inline_text">'.$linktext.' </span></a>'.$form;
}
}
return '';
@@ -2009,15 +2031,15 @@
undef(%category_members);
# calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control
&rawconfig(1);
- my $output='<table><tr>';
+ my $output='<div class="LC_landmark" role="main">'."\n";
for (my $col=1; $col<=2; $col++) {
- $output.='<td class="LC_mainmenu_col_fieldset">';
+ $output .= '<div class="LC_mainmenu">'."\n";
for (my $row=1; $row<=8; $row++) {
foreach my $cat (keys(%category_members)) {
if ($category_positions{$cat} ne "$col,$row") { next; }
#$output.='<table><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>';
$output.='<div class="LC_Box LC_400Box">';
- $output.='<h3 class="LC_hcell">'.&mt($category_names{$cat}).'</h3>';
+ $output.='<h2 class="LC_hcell LC_heading_2">'.&mt($category_names{$cat}).'</h2>';
$output.='<table>';
my %active=();
foreach my $menu_item (split(/\:/,$category_members{$cat})) {
@@ -2032,9 +2054,9 @@
$output.='</div>';
}
}
- $output.="</td>";
+ $output.="</div>";
}
- $output.="</tr></table>";
+ $output .= '<div style="clear:both"></div></div>'."\n";
return $output;
}
@@ -2568,13 +2590,13 @@
if ((document.getElementById('usexpand')) && (document.getElementById('uscollapse'))) {
if (currstyle == 'inline') {
seluserid.style.display = 'none';
- document.getElementById('usexpand').innerHTML='► ';
- document.getElementById('uscollapse').innerHTML='';
+ document.getElementById('usexpand').style.display= 'inline';
+ document.getElementById('uscollapse').style.display = 'none';
} else {
seluserid.style.display = 'inline';
- document.getElementById('usexpand').innerHTML='';
- document.getElementById('uscollapse').innerHTML='◄ ';
toggleIdentifier(document.userview);
+ document.getElementById('usexpand').style.display = 'none';
+ document.getElementById('uscollapse').style.display = 'inline';
}
}
}
@@ -2628,16 +2650,21 @@
function toggleIdentifier(form) {
if ((document.getElementById('LC_vuname')) && (document.getElementById('LC_vid'))) {
+ var identifylabel = document.getElementById('LC_vuidentifier');
+ var identifier;
+ var userbyuname;
var radioelem = form.elements['vuidentifier'];
if (radioelem.length > 0) {
var i;
for (i=0; i<radioelem.length; i++) {
if (radioelem[i].checked == true) {
if (radioelem[i].value == 'uname') {
+ userbyuname = 1;
document.getElementById('LC_vuname').type = 'text';
document.getElementById('LC_vid').type = 'hidden';
document.getElementById('LC_vid').value = '';
} else {
+ userbyuname = 0;
document.getElementById('LC_vuname').type = 'hidden';
document.getElementById('LC_vuname').value = '';
document.getElementById('LC_vid').type = 'text';
@@ -2645,6 +2672,13 @@
break;
}
}
+ if (identifylabel) {
+ if (userbyuname) {
+ identifylabel.setAttribute("for","LC_vuname");
+ } else {
+ identifylabel.setAttribute("for","LC_vid");
+ }
+ }
}
}
return;
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1459 loncom/interface/loncommon.pm:1.1460
--- loncom/interface/loncommon.pm:1.1459 Thu Feb 20 03:05:34 2025
+++ loncom/interface/loncommon.pm Fri Feb 21 04:29:26 2025
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1459 2025/02/20 03:05:34 raeburn Exp $
+# $Id: loncommon.pm,v 1.1460 2025/02/21 04:29:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5345,6 +5345,7 @@
$userview=~s/\<\/html\>//gi;
$userview=~s/\<head\>//gi;
$userview=~s/\<\/head\>//gi;
+ $userview=~s/\Q<div class="LC_landmark" role="main"\E/<div class="LC_landmark"/;
$userview=~s/action\s*\=/would_be_action\=/gi;
$userview=&relative_to_absolute($feedurl,$userview);
if (wantarray) {
@@ -7096,7 +7097,7 @@
$menucoll,$menuref,
$args->{'links_disabled'},
$args->{'links_target'}).
- '</div>';
+ '</div>';
}
$bodytag .= Apache::lonmenu::serverform();
if ($need_endlcint) {
@@ -8566,8 +8567,9 @@
vertical-align: middle;
}
-table td.LC_mainmenu_col_fieldset {
- vertical-align: top;
+div.LC_mainmenu {
+ margin: 3px 2px 2px 1px;
+ float: left;
}
div.LC_createcourse {
@@ -8649,8 +8651,9 @@
}
fieldset#LC_selectuser {
- margin: 0;
- padding: 0;
+ margin: -1px 0 0 0;
+ padding: 0;
+ border: 0;
}
article.geogebraweb div {
@@ -10826,7 +10829,7 @@
my $page =
&Apache::loncommon::start_page($title,'',\%displayargs)."\n".
- '<div class="LC_landmark" style="clear:both" role="main">'.
+ '<div class="LC_landmark" style="clear:both" role="main">'.
'<p class="LC_error">'.$msg.'</p>'.
'</div>'.
&Apache::loncommon::end_page();
More information about the LON-CAPA-cvs
mailing list