--- loncom/interface/loncommon.pm 2023/11/17 17:02:20 1.1418 +++ loncom/interface/loncommon.pm 2025/03/25 01:02:59 1.1476 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1418 2023/11/17 17:02:20 raeburn Exp $ +# $Id: loncommon.pm,v 1.1476 2025/03/25 01:02:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -966,7 +966,9 @@ ENDSCRT sub select_timezone { my ($name,$selected,$onchange,$includeempty,$id,$disabled)=@_; - my $output='<select name="'.$name.'" '.$id.$onchange.$disabled.'>'."\n"; + my $labeltext = &HTML::Entities::encode(&mt('Select Time Zone')); + my $output='<select name="'.$name.'" '.$id.$onchange.$disabled. + ' aria-label="'.$labeltext.'">'."\n"; if ($includeempty) { $output .= '<option value=""'; if (($selected eq '') || ($selected eq 'local')) { @@ -1174,7 +1176,8 @@ sub linked_select_forms { $menuorder, $onchangefirst, $onchangesecond, - $suffix + $suffix, + $haslabel ) = @_; my $second = "document.$formname.$secondselectname"; my $first = "document.$formname.$firstselectname"; @@ -1240,13 +1243,18 @@ END $result.=">".&mt($hashref->{$value}->{'text'})."</option>\n"; } $result .= "</select>\n"; + if ($haslabel) { + $result .= '</label>'; + } my %select2; if (ref($hashref->{$firstdefault}) eq 'HASH') { if (ref($hashref->{$firstdefault}->{'select2'}) eq 'HASH') { %select2 = %{$hashref->{$firstdefault}->{'select2'}}; } } - $result .= $middletext; + if ($middletext ne '') { + $result .= '<label>'.$middletext; + } $result .= "<select size=\"1\" name=\"$secondselectname\""; if ($onchangesecond) { $result .= ' onchange="'.$onchangesecond.'"'; @@ -1264,6 +1272,9 @@ END $result.=">".&mt($select2{$value})."</option>\n"; } $result .= "</select>\n"; + if ($middletext ne '') { + $result .= '</label>'; + } # return $debug; return $result; } # end of sub linked_select_forms { @@ -1342,7 +1353,7 @@ sub help_open_topic { } $template.=' <a'.$target.' href="'.$link.'" title="'.$title.'">' .'<img src="'.$helpicon.'" border="0"' - .' alt="'.&mt('Help: [_1]',$topic).'"' + .' alt="'.&mt('Help icon').'"' .' title="'.$title.'" style="vertical-align:middle;"'.$imgid .' /></a>'; if ($text ne "") { @@ -1372,7 +1383,7 @@ sub helpLatexCheatsheet { $out .= '<span>' .&help_open_topic('Authoring_Output_Tags',&mt('Output Tags'),$stayOnPage,undef,600) .'</span> <span>' - .&help_open_topic('Authoring_Multilingual_Problems',&mt('How to create problems in different languages'),$stayOnPage,undef,600) + .&help_open_topic('Authoring_Multilingual_Problems',&mt('Languages'),$stayOnPage,undef,600) .'</span>'; } $out .= '</span>'; # End cheatsheet @@ -1451,7 +1462,7 @@ $banner_link <a href="$link" title="$title" $linkattr>$text</a> END } else { - return ' '.$text.' '; + return ' <h1 class="LC_helpmenu">'.$text.'</h1> '; } } @@ -1463,6 +1474,10 @@ sub help_menu_js { my $helptopic=&general_help(); my $details_link = $httphost.'/adm/help/'.$helptopic.'.hlp'; my $nothing=&Apache::lonhtmlcommon::javascript_nothing(); + my $bannertitle = &mt('Help Menu'); + &js_escape(\$bannertitle); + my $bodytitle = &mt('Documentation'); + &js_escape(\$bodytitle); my $start_page = &Apache::loncommon::start_page('Help Menu', undef, {'frameset' => 1, @@ -1474,7 +1489,6 @@ sub help_menu_js { my $end_page = &Apache::loncommon::end_page({'frameset' => 1, 'js_ready' => 1,}); - my $template .= <<"ENDTEMPLATE"; <script type="text/javascript"> // <![CDATA[ @@ -1499,8 +1513,8 @@ function helpMenu(target) { return; } function writeHelp(caller) { - caller.document.writeln('$start_page\\n<frame name="bannerframe" src="'+banner_link+'" marginwidth="0" marginheight="0" frameborder="0">\\n'); - caller.document.writeln('<frame name="bodyframe" src="$details_link" marginwidth="0" marginheight="0" frameborder="0">\\n$end_page'); + caller.document.writeln('$start_page\\n<frame name="bannerframe" title="$bannertitle" src="'+banner_link+'" marginwidth="0" marginheight="0" frameborder="0">\\n'); + caller.document.writeln('<frame name="bodyframe" title="$bodytitle" src="$details_link" marginwidth="0" marginheight="0" frameborder="0">\\n$end_page'); caller.document.close(); caller.focus(); } @@ -1764,8 +1778,6 @@ the id of the element to resize, second surrounds everything that comes after the textarea, this routine needs to be attached to the <body> for the onload and onresize events. -=back - =cut sub resize_textarea_js { @@ -2302,7 +2314,7 @@ sub import_crsauthor_form { dire => 'Directory', se => 'Select', ); - $output = $lt{'dire'}.': '. + $output = '<label>'.$lt{'dire'}.': '. '<select id="'.$firstselectname.'" name="'.$firstselectname.'" '. 'onchange="populateCrsSelects(this.form,'."'$firstselectname','$secondselectname',1,'$js_only',0,1,0,0,0".');">'. '<option value="" selected="selected">'.$lt{'se'}.'</option>'; @@ -2313,10 +2325,10 @@ sub import_crsauthor_form { next if ($key eq '/'); $output .= '<option value="'.$key.'">'.$key.'</option>'."\n"; } - $output .= '</select><br />'."\n". + $output .= '</select></label><br /><label>'."\n". $lt{'fnam'}.': <select id="'.$secondselectname.'" name="'.$secondselectname.'">'."\n". '<option value="" selected="selected"></option>'."\n". - '</select>'."\n". + '</select></label>'."\n". '<input type="hidden" id="crsres_include_'.$suffix.'" value="'.$only.'" />'; return ($numdirs,$output); } @@ -2439,6 +2451,168 @@ sub show_crsfiles_js { END } +sub crsauthor_rights { + my ($rightsfile,$path,$docroot,$cnum,$cdom) = @_; + my $sourcerights = "$path/$rightsfile"; + my $now = time; + if (!-e $sourcerights) { + my $cid = $cdom.'_'.$cnum; + if (!-e "$docroot/priv/$cdom") { + mkdir("$docroot/priv/$cdom",0755); + } + if (!-e "$docroot/priv/$cdom/$cnum") { + mkdir("$docroot/priv/$cdom/$cnum",0755); + } + if (open(my $fh,">$sourcerights")) { + print $fh <<END; +<accessrule effect="deny" realm="" type="course" role="" /> +<accessrule effect="allow" realm="$cid" type="course" role="" /> +END + close($fh); + } + } + if (!-e "$sourcerights.meta") { + if (open(my $fh,">$sourcerights.meta")) { + my $author=$env{'environment.firstname'}.' '. + $env{'environment.middlename'}.' '. + $env{'environment.lastname'}.' '. + $env{'environment.generation'}; + $author =~ s/\s+$//; + print $fh <<"END"; + +<abstract></abstract> +<author>$author</author> +<authorspace>$cnum:$cdom</authorspace> +<copyright>private</copyright> +<creationdate>$now</creationdate> +<customdistributionfile></customdistributionfile> +<dependencies></dependencies> +<domain>$cdom</domain> +<highestgradelevel>0</highestgradelevel> +<keywords></keywords> +<language>notset</language> +<lastrevisiondate>$now</lastrevisiondate> +<lowestgradelevel>0</lowestgradelevel> +<mime>rights</mime> +<modifyinguser>$env{'user.name'}:$env{'user.domain'}</modifyinguser> +<notes></notes> +<obsolete></obsolete> +<obsoletereplacement></obsoletereplacement> +<owner>$cnum:$cdom</owner> +<rule>deny:::course,allow:$cid::course</rule> +<sourceavail></sourceavail> +<standards></standards> +<subject></subject> +<title>Course Authoring Rights</title> +END + close($fh); + } + } + return; +} + +=pod + +=item * &iframe_wrapper_headjs() + +emits javascript containing two global vars to facilitate handling of resizing +by code in iframe_wrapper_resizejs() used when an iframe is present in a page +with standard LON-CAPA menus. + +=cut + +# +# Where iframe is in use, if window.onload() executes before the custom resize function +# has been defined (jQuery), two global javascript vars (LCnotready and LCresizedef) +# are used to ensure document.ready() triggers a call to resize, so the iframe contents +# do not obscure the Functions menu. +# + +sub iframe_wrapper_headjs { + return <<"ENDJS"; +<script type="text/javascript"> +// <![CDATA[ +var LCnotready = 0; +var LCresizedef = 0; +// ]]> +</script> + +ENDJS + +} + +=pod + +=item * &iframe_wrapper_resizejs() + +emits javascript used to handle resizing for a page containing +an iframe, to ensure that the iframe does not obscure any +standard LON-CAPA menu items. + +=back + +=cut + +# +# jQuery to use when iframe is in use and a page resize occurs. +# This script will ensure that the iframe does not obscure any +# standard LON-CAPA inline menus (primary, secondary, and/or +# breadcrumbs and Functions menus. Expects javascript from +# &iframe_wrapper_headjs() to be in head portion of the web page, +# e.g., by inclusion in second arg passed to &start_page(). +# + +sub iframe_wrapper_resizejs { + my $offset = 5; + &get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']); + if (($env{'form.inhibitmenu'} eq 'yes') || ($env{'form.only_body'})) { + $offset = 0; + } + return &Apache::lonhtmlcommon::scripttag(<<SCRIPT); + \$(document).ready( function() { + \$(window).unbind('resize').resize(function(){ + var header = null; + var offset = $offset; + var height = 0; + var hdrtop = 0; + if (\$('div.LC_menus_content:first').length) { + if (\$('div.LC_menus_content:first').hasClass ("shown")) { + header = \$('div.LC_menus_content:first'); + offset = 12; + } + } else if (\$('div.LC_head_subbox:first').length) { + header = \$('div.LC_head_subbox:first'); + offset = 9; + } else { + if (\$('#LC_breadcrumbs').length) { + header = \$('#LC_breadcrumbs'); + } + } + if (header != null && header.length) { + height = header.height(); + hdrtop = header.position().top; + } + var pos = height + hdrtop + offset; + \$('.LC_iframecontainer').css('top', pos); + }); + LCresizedef = 1; + if (LCnotready == 1) { + LCnotready = 0; + \$(window).trigger('resize'); + } + }); + window.onload = function(){ + if (LCresizedef) { + LCnotready = 0; + \$(window).trigger('resize'); + } else { + LCnotready = 1; + } + }; +SCRIPT + +} + =pod =head1 Excel and CSV file utility routines @@ -2626,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}; @@ -2647,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); } } @@ -2662,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 <select> element int multiple mode @@ -2674,12 +2848,13 @@ Args: $hash - the elements should be 'option' => 'shown text' (shown text should already have been &mt()) $order - (optional) array ref of the order to show the elements in + $id = (optional) id for <select> 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)) { @@ -2688,7 +2863,10 @@ sub multiple_select_form { $size = scalar(keys(%$hash)); } } - $output.="\n".'<select name="'.$name.'" size="'.$size.'" multiple="multiple">'; + if ($id ne '') { + $id = ' id="'.$id.'"'; + } + $output.="\n".'<select name="'.$name.'" size="'.$size.'" multiple="multiple"'.$id.'>'; my @order; if (ref($order) eq 'ARRAY') { @order = @{$order}; @@ -2712,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 <select name='$name' size='1'> form to allow a user to select options from a ref to a hash containing: @@ -2720,7 +2898,10 @@ option_name => displayed text. An option a javascript onchange item, e.g., onchange="this.form.submit();". An optional arg -- $readonly -- if true will cause the select form to be disabled, e.g., for the case where an instructor has a section- -specific role, and is viewing/modifying parameters. +specific role, and is viewing/modifying parameters. An optional arg +-- $id -- will be used as the id attribute of the select element. An +optional arg -- $aria_labelledby -- will be included as the aria-labelledby +attribute of the select element. See lonrights.pm for an example invocation and use. @@ -2728,7 +2909,7 @@ See lonrights.pm for an example invocati #------------------------------------------- sub select_form { - my ($def,$name,$hashref,$onchange,$readonly) = @_; + my ($def,$name,$hashref,$onchange,$readonly,$id,$aria_labelledby) = @_; return unless (ref($hashref) eq 'HASH'); if ($onchange) { $onchange = ' onchange="'.$onchange.'"'; @@ -2737,7 +2918,13 @@ sub select_form { if ($readonly) { $disabled = ' disabled="disabled"'; } - my $selectform = "<select name=\"$name\" size=\"1\"$onchange$disabled>\n"; + if ($id ne '') { + $id = ' id="'.$id.'"'; + } + if ($aria_labelledby ne '') { + $aria_labelledby = ' aria-labelledby="'.$aria_labelledby.'"'; + } + my $selectform = "<select name=\"$name\" size=\"1\"$onchange$disabled$id$aria_labelledby>\n"; my @keys; if (exists($hashref->{'select_form_order'})) { @keys=@{$hashref->{'select_form_order'}}; @@ -2788,7 +2975,7 @@ sub display_filter { my $onchange = "javascript:toggleHistoryOptions(this,'containingphrase','$context', '$secondid','$thirdid')"; return '<span class="LC_nobreak"><label>'.&mt('Records: [_1]', - &Apache::lonmeta::selectbox('show',$env{'form.show'},'',undef, + &Apache::lonmeta::selectbox('show',$env{'form.show'},'','',undef, (&mt('all'),10,20,50,100,1000,10000))). '</label></span> <span class="LC_nobreak">'. &mt('Filter: [_1]', @@ -2890,9 +3077,12 @@ sub gradeleveldescription { } sub select_level_form { - my ($deflevel,$name)=@_; + my ($deflevel,$name,$id)=@_; + if ($id ne '') { + $id = ' id="'.$id.'"'; + } unless ($deflevel) { $deflevel=0; } - my $selectform = "<select name=\"$name\" size=\"1\">\n"; + my $selectform = "<select name=\"$name\" size=\"1\"$id>\n"; for (my $i=0; $i<=18; $i++) { $selectform.="<option value=\"$i\" ". ($i==$deflevel ? 'selected="selected" ' : ''). @@ -2906,7 +3096,7 @@ sub select_level_form { =pod -=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms,$excdoms,$disabled) +=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms,$excdoms,$disabled,$id) Returns a string containing a <select name='$name' size='1'> form to allow a user to select the domain to preform an operation in. @@ -2925,17 +3115,22 @@ The optional $excdoms is a reference to The optional $disabled argument, if true, adds the disabled attribute to the select tag. +The option $id argument is the value (if any) to set as the (unique) id attribute for the select tag. + =cut #------------------------------------------- sub select_dom_form { - my ($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms,$excdoms,$disabled) = @_; + my ($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms,$excdoms,$disabled,$id) = @_; if ($onchange) { $onchange = ' onchange="'.$onchange.'"'; } if ($disabled) { $disabled = ' disabled="disabled"'; } + if ($id ne '') { + $id = ' id="'.$id.'"'; + } my (@domains,%exclude); if (ref($incdoms) eq 'ARRAY') { @domains = sort {lc($a) cmp lc($b)} (@{$incdoms}); @@ -2946,7 +3141,7 @@ sub select_dom_form { if (ref($excdoms) eq 'ARRAY') { map { $exclude{$_} = 1; } @{$excdoms}; } - my $selectdomain = "<select name=\"$name\" size=\"1\"$onchange$disabled>\n"; + my $selectdomain = "<select name=\"$name\" size=\"1\"$onchange$disabled$id>\n"; foreach my $dom (@domains) { next if ($exclude{$dom}); $selectdomain.="<option value=\"$dom\" ". @@ -3790,6 +3985,21 @@ sub passwd_validation_js { } else { $alertmsg = &mt('A secret did not satisfy requirement(s):').'\n\n'; } + } elsif ($context eq 'ltitools') { + my %domconfig = &Apache::lonnet::get_dom('configuration',['toolsec'],$domain); + if (ref($domconfig{'toolsec'}) eq 'HASH') { + if (ref($domconfig{'toolsec'}{'rules'}) eq 'HASH') { + %passwdconf = %{$domconfig{'toolsec'}{'rules'}}; + } + } + if ($id eq 'add') { + $alertmsg = &mt('Secret for added external tool did not satisfy requirement(s):').'\n\n'; + } elsif ($id =~ /^\d+$/) { + my $pos = $id+1; + $alertmsg = &mt('Secret for external tool [_1] did not satisfy requirement(s):','#'.$pos).'\n\n'; + } else { + $alertmsg = &mt('A secret did not satisfy requirement(s):').'\n\n'; + } } else { %passwdconf = &Apache::lonnet::get_passwdconf($domain); $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n'; @@ -4667,9 +4877,10 @@ sub filemimetype { sub filecategoryselect { - my ($name,$value)=@_; + my ($name,$value,$id)=@_; return &select_form($value,$name, - {'' => &mt('Any category'), map { $_,$_ } sort(keys(%category_extensions))}); + {'' => &mt('Any category'), map { $_,$_ } sort(keys(%category_extensions))}, + '','',$id); } =pod @@ -5153,6 +5364,7 @@ sub get_student_view { $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) { @@ -5516,7 +5728,8 @@ sub blockcheck { } unless ($has_evb) { if (($activity eq 'printout') || ($activity eq 'grades') || ($activity eq 'search') || - ($activity eq 'boards') || ($activity eq 'groups') || ($activity eq 'chat')) { + ($activity eq 'index') || ($activity eq 'boards') || ($activity eq 'groups') || + ($activity eq 'chat')) { if ($udom eq $cdom) { $check_ipaccess = 1; } @@ -5607,8 +5820,8 @@ sub blockcheck { if (($activity eq 'boards' || $activity eq 'chat' || $activity eq 'groups' || $activity eq 'printout' || - $activity eq 'search' || $activity eq 'reinit' || - $activity eq 'alert') && + $activity eq 'search' || $activity eq 'index' || + $activity eq 'reinit' || $activity eq 'alert') && ($env{'request.course.id'})) { foreach my $key (keys(%live_courses)) { if ($key ne $env{'request.course.id'}) { @@ -5943,6 +6156,8 @@ END_MYBLOCK $text = &mt('Gradebook Blocked'); } elsif ($activity eq 'search') { $text = &mt('Search Blocked'); + } elsif ($activity eq 'index') { + $text = &mt('Content Index Blocked'); } elsif ($activity eq 'alert') { $text = &mt('Checking Critical Messages Blocked'); } elsif ($activity eq 'reinit') { @@ -6376,7 +6591,7 @@ Input: (optional) filename from which br If page header is being requested for use in a frameset, then the second (option) argument -- frameset will be true, and the target attribute set for links should be target="_parent". - If $title is supplied as the thitd arg, that will be used to + If $title is supplied as the third arg, that will be used to the left of the breadcrumbs tail for the current path. Returns: HTML div with CSTR path and recent box @@ -6461,6 +6676,19 @@ sub CSTR_pageheader { return $output; } +############################################## +=pod + +=item * &nocodemirror() + +Input: None + +Returns: 1 if CodeMirror is deactivated based on + user's preference, or domain default, + if user indicated use of default. + +=cut + sub nocodemirror { my $nocodem = $env{'environment.nocodemirror'}; unless ($nocodem) { @@ -6475,8 +6703,40 @@ sub nocodemirror { return; } +############################################## +=pod + +=item * &permitted_editors() + +Input: $uri (optional) + +Returns: %editors hash in which keys are editors + permitted in current Authoring Space, + or in current course for web pages + created in a course. + + Value for each key is 1. Possible keys + are: edit, xml, and daxe. + + For a regular Authoring Space, if no specific + set of editors has been set for the Author + who owns the Authoring Space, then the + domain default will be used. If no domain + default has been set, then the keys will be + edit and xml. + + For a course author, or for web pages created + in a course, if no specific set of editors has + been set for the course, then the domain + course default will be used. If no domain + course default has been set, then the keys + will be edit and xml. + +=cut + sub permitted_editors { - my ($is_author,$is_coauthor,$auname,$audom,%editors); + my ($uri) = @_; + my ($is_author,$is_coauthor,$is_course,$auname,$audom,%editors); if ($env{'request.role'} =~ m{^au\./}) { $is_author = 1; } elsif ($env{'request.role'} =~ m{^(?:ca|aa)\./($match_domain)/($match_username)}) { @@ -6490,17 +6750,33 @@ sub permitted_editors { } } } elsif ($env{'request.course.id'}) { - if ($env{'request.editurl'} =~ m{^/priv/($match_domain)/($match_username)/}) { + my ($cdom,$cnum); + $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + if (($env{'request.editurl'} =~ m{^/priv/\Q$cdom/$cnum\E/}) || + ($env{'request.editurl'} =~ m{^/uploaded/\Q$cdom/$cnum\E/(docs|supplemental)/}) || + ($uri =~ m{^/uploaded/\Q$cdom/$cnum\E/(docs|supplemental)/})) { + $is_course = 1; + } elsif ($env{'request.editurl'} =~ m{^/priv/($match_domain)/($match_username)/}) { ($audom,$auname) = ($1,$2); } elsif ($env{'request.uri'} =~ m{^/priv/($match_domain)/($match_username)/}) { ($audom,$auname) = ($1,$2); + } elsif (($uri eq '/daxesave') && + (($env{'form.path'} =~ m{^/daxeopen/priv/\Q$cdom/$cnum\E/}) || + ($env{'form.path'} =~ m{^/daxeopen/uploaded/\Q$cdom/$cnum\E/(docs|supplemental)/}))) { + $is_course = 1; + } elsif (($uri eq '/daxesave') && + ($env{'form.path'} =~ m{^/daxeopen/priv/($match_domain)/($match_username)/})) { + ($audom,$auname) = ($1,$2); } - if (($audom ne '') && ($auname ne '')) { - if (($env{'user.domain'} eq $audom) && - ($env{'user.name'} eq $auname)) { - $is_author = 1; - } else { - $is_coauthor = 1; + unless ($is_course) { + if (($audom ne '') && ($auname ne '')) { + if (($env{'user.domain'} eq $audom) && + ($env{'user.name'} eq $auname)) { + $is_author = 1; + } else { + $is_coauthor = 1; + } } } } @@ -6520,6 +6796,19 @@ sub permitted_editors { xml => 1, ); } + } elsif ($is_course) { + if (exists($env{'course.'.$env{'request.course.id'}.'.internal.crseditors'})) { + map { $editors{$_} = 1; } split(/,/,$env{'course.'.$env{'request.course.id'}.'.internal.crseditors'}); + } else { + my %domdefaults = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'}); + if (exists($domdefaults{'crseditors'})) { + map { $editors{$_} = 1; } split(/,/,$domdefaults{'crseditors'}); + } else { + %editors = ( edit => 1, + xml => 1, + ); + } + } } else { %editors = ( edit => 1, xml => 1, @@ -6628,7 +6917,6 @@ sub bodytag { my $hostname = $args->{'hostname'}; $function = &get_users_function() if (!$function); - my $img = &designparm($function.'.img',$domain); my $font = &designparm($function.'.font',$domain); my $pgbg = $bgcolor || &designparm($function.'.pgbg',$domain); @@ -6682,8 +6970,6 @@ sub bodytag { $role = &Apache::lonnet::plaintext($role); } - if (!$realm) { $realm=' '; } - my $extra_body_attr = &make_attr_string($forcereg,\%design); # construct main body tag @@ -6707,7 +6993,6 @@ sub bodytag { undef($role); } unless ($ltimenu->{'coursetitle'}) { - $realm=' '; $showcrstitle = 0; } } @@ -6717,7 +7002,6 @@ sub bodytag { undef($role); } unless ($menuref->{'crs'}) { - $realm=' '; $showcrstitle = 0; } } @@ -6751,50 +7035,93 @@ sub bodytag { # $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls # } - $bodytag .= Apache::lonhtmlcommon::scripttag( - Apache::lonmenu::utilityfunctions($httphost), 'start'); + my $need_endlcint; + unless ($args->{'switchserver'}) { + $bodytag .= Apache::lonhtmlcommon::scripttag( + Apache::lonmenu::utilityfunctions($httphost), 'start'); + $need_endlcint = 1; + } + my $collapsible; + if ($args->{'collapsible_header'} ne '') { + $collapsible = 1; + my ($menustate,$tiptext,$divclass); + if ($args->{'start_collapsed'}) { + $menustate = 'collapsed'; + $tiptext = 'display'; + $divclass = 'hidden'; + } else { + $menustate = 'expanded'; + $tiptext = 'hide'; + $divclass = 'shown'; + } + my $alttext = &mt('menu state: '.$menustate); + my $tooltip = &mt($tiptext.' standard menus'); + $bodytag .= <<"END"; +<div id="LC_expandingContainer" style="display:inline;" role="navigation"> +<div id="LC_collapsible" class="LC_collapse_trigger" style="position: absolute;top: -5px;left: 0px; z-index:101; display:inline;"> +<a href="#" style="text-decoration:none;"><img class="LC_collapsible_indicator" alt="$alttext" title="$tooltip" src="/res/adm/pages/$menustate.png" style="border:0;margin:0;padding:0;max-width:100%;height:auto" /></a></div> +<div class="LC_menus_content $divclass"> +END + } unless ($args->{'no_primary_menu'}) { my ($left,$right) = Apache::lonmenu::primary_menu($crstype,$ltimenu,$menucoll,$menuref, $args->{'links_disabled'}, - $args->{'links_target'}); - + $args->{'links_target'}, + $collapsible); + my $labeltext = &HTML::Entities::encode(&mt('Primary links')); if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { if ($dc_info) { $dc_info = qq|<span class="LC_cusr_subheading">$dc_info</span>|; } - $bodytag .= qq|<div id="LC_nav_bar">$left $role<br /> - <em>$realm</em> $dc_info</div>|; + $bodytag .= qq|<div id="LC_nav_bar" role="navigation" aria-label="$labeltext">$left $role</div>|; + unless (($realm eq '') && ($dc_info eq '')) { + $bodytag .= qq|<div id="LC_realm" role="complementary"><em>$realm</em> $dc_info</div>|; + } + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } return $bodytag; } + $bodytag .= '<div class="LC_landmark" style="margin: 3px 0 0 0;" role="navigation" aria-label="'.$labeltext.'">'; unless ($env{'request.symb'} =~ m/\.page___\d+___/) { $bodytag .= qq|<div id="LC_nav_bar">$left $role</div>|; } - $bodytag .= $right; + $bodytag .= $right.'</div>'; if ($dc_info) { $dc_info = &dc_courseid_toggle($dc_info); } - $bodytag .= qq|<div id="LC_realm">$realm $dc_info</div>|; + unless (($realm eq '') && ($dc_info eq '')) { + $bodytag .= qq|<div id="LC_realm" role="complementary">$realm $dc_info</div>|; + } + $bodytag .= qq|<div style="clear: both; margin: 5px 0 0 0;"></div>|; } #if directed to not display the secondary menu, don't. if ($args->{'no_secondary_menu'}) { + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } return $bodytag; } #don't show menus for public users if (!$public){ unless ($args->{'no_inline_menu'}) { - $bodytag .= Apache::lonmenu::secondary_menu($httphost,$ltiscope,$ltimenu, + $bodytag .= '<div class="LC_landmark" role="navigation" aria-label="Secondary Links">'. + Apache::lonmenu::secondary_menu($httphost,$ltiscope,$ltimenu, $args->{'no_primary_menu'}, $menucoll,$menuref, $args->{'links_disabled'}, - $args->{'links_target'}); + $args->{'links_target'}). + '</div>'; } $bodytag .= Apache::lonmenu::serverform(); - $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } if ($env{'request.state'} eq 'construct') { $bodytag .= &Apache::lonmenu::innerregister($forcereg, $args->{'bread_crumbs'},'','',$hostname, @@ -6804,19 +7131,25 @@ sub bodytag { $args->{'group'},$args->{'hide_buttons'}, $hostname,$ltiscope,$ltiuri,$showncrumbsref); } else { - $bodytag .= + $bodytag .= &Apache::lonmenu::prepare_functions($env{'request.noversionuri'}, $forcereg,$args->{'group'}, $args->{'bread_crumbs'}, $advtoolsref,'',$hostname); } - }else{ - # this is to seperate menu from content when there's no secondary - # menu. Especially needed for public accessible ressources. - $bodytag .= '<hr style="clear:both" />'; - $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } else { + # this is to separate menu from content when there's no secondary + # menu. Especially needed for publicly accessible resources. + $bodytag .= '<hr style="clear:both" role="complementary" />'; + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } + } + if ($args->{'collapsible_header'} ne '') { + $bodytag .= $args->{'collapsible_header'}. + '<div id="LC_collapsible_separator"></div>'. + '</div></div>'; } - return $bodytag; } @@ -6945,7 +7278,6 @@ Inputs: (all optional) sub standard_css { my ($function,$domain,$bgcolor) = @_; $function = &get_users_function() if (!$function); - my $img = &designparm($function.'.img', $domain); my $tabbg = &designparm($function.'.tabbg', $domain); my $font = &designparm($function.'.font', $domain); my $fontmenu = &designparm($function.'.fontmenu', $domain); @@ -6998,6 +7330,7 @@ body { line-height:130%; font-size:0.83em; color:$font; + background-color: $pgbg_or_bgcolor; } a:focus, @@ -7009,14 +7342,63 @@ form, .inline { display: inline; } +.LC_landmark { + margin: 0; + padding: 0; + border: none; +} + +.LC_visually_hidden:not(:focus):not(:active) { + clip-path: inset(50%); + height: 1px; + overflow: hidden; + position: absolute; + white-space: nowrap; + width: 1px; + display: inline; +} + +.LC_heading_2 { + font-size: 1.17em; +} + +.LC_heading_3 { + font-size: 1.0em; +} + +h1.LC_search_results { + font-size: 1.0em; + font-weight: normal; +} + +.LC_menus_content.shown{ + display: block; +} + +.LC_menus_content.hidden { + display: none; +} + .LC_right { text-align:right; } +.LC_left { + text-align:left; +} + +.LC_center { + text-align:center; +} + .LC_middle { vertical-align:middle; } +.LC_bottom { + vertical-align:bottom; +} + .LC_floatleft { float: left; } @@ -7029,6 +7411,12 @@ form, .inline { width:400px; } +#LC_collapsible_separator { + border: 1px solid black; + width: 99.9%; + height: 0px; +} + .LC_iframecontainer { width: 98%; margin: 0; @@ -7096,6 +7484,14 @@ div.LC_confirm_box .LC_success img { height: auto; } +div.LC_minheight { + min-height: 24px; + border: 0; + margin: 4px 0 0 0; + padding: 0; + vertical-align: middle; +} + .LC_textsize_mobile { \@media only screen and (max-device-width: 480px) { -webkit-text-size-adjust:100%; -moz-text-size-adjust:100%; -ms-text-size-adjust:100%; @@ -7150,9 +7546,10 @@ div.LC_confirm_box .LC_success img { padding: 4px; } -table.LC_pastsubmission { +.LC_pastsubmission { border: 1px solid black; margin: 2px; + padding: 2px; } table#LC_menubuttons { @@ -7288,6 +7685,10 @@ li.LC_menubuttons_inline_text img { text-decoration: none; } +.LC_menubuttons_link img { + vertical-align: middle; +} + .LC_menubuttons_category { color: $font; background: $pgbg; @@ -7295,7 +7696,9 @@ li.LC_menubuttons_inline_text img { font-weight: bold; } -td.LC_menubuttons_text { +.LC_menu_text { + clear: left; + text-align: left; color: $font; } @@ -7387,11 +7790,13 @@ table.LC_data_table tr td.LC_leftcol_hea } table.LC_data_table tr.LC_empty_row td, -table.LC_nested tr.LC_empty_row td { +table.LC_nested tr.LC_empty_row td, +table.LC_nested tr.LC_empty_row th { font-weight: bold; font-style: italic; text-align: center; padding: 8px; + border: 0; } table.LC_data_table tr.LC_empty_row td, @@ -7399,15 +7804,19 @@ table.LC_data_table tr.LC_footer_row td background-color: $sidebg; } +table.LC_nested tr.LC_empty_row th, table.LC_nested tr.LC_empty_row td { + padding: 4ex; background-color: #FFFFFF; } table.LC_caption { } -table.LC_nested tr.LC_empty_row td { - padding: 4ex +caption.LC_caption_prefs { + font-weight: normal; + text-align: left; + padding-bottom: 0.8em; } table.LC_nested_outer tr th { @@ -7426,14 +7835,17 @@ table.LC_nested_outer tr td.LC_subheader text-align: right; } -table.LC_nested tr.LC_info_row td { +table.LC_nested tr.LC_info_row td, +table.LC_nested tr.LC_info_row th { background-color: #CCCCCC; font-weight: bold; font-size: small; text-align: center; + border: 0; } table.LC_nested tr.LC_info_row td.LC_left_item, +table.LC_nested tr.LC_info_row th.LC_left_item, table.LC_nested_outer tr th.LC_left_item { text-align: left; } @@ -7576,6 +7988,10 @@ table.LC_data_table tr > td.LC_roles_sel border-right: 8px solid #11CC55; } +table.LC_data_table tr.LC_prefs_row { + line-height: 250%; +} + span.LC_current_location { font-size:larger; background: $pgbg; @@ -7649,39 +8065,68 @@ table.LC_parm_overview_restrictions th { border-color: $pgbg; } -table#LC_helpmenu { - border: none; - height: 55px; - border-spacing: 0; +h1.LC_helpmenu { + display: inline; + font-size: 100%; + font-weight: normal; + line-height: 1em; + margin: 0; + padding: 0; + border: 0; } -table#LC_helpmenu fieldset legend { - font-size: larger; +.LC_helpdesk_headbox { + border: 2px groove threedface; + padding: 1em; } -table#LC_helpmenu_links { - width: 100%; - border: 1px solid black; +h1.LC_helpdesk_legend { + float: left; + margin: -1.7em 0 0; + padding: 0 .5em; background: $pgbg; + font-size: 1em; + font-weight: bold; +} + +h1.LC_helpdesk_title { + display: inline; + font-size: 1em; + line-height: 2.5em; + margin: 0; padding: 0; - border-spacing: 1px; + vertical-align: bottom; } -table#LC_helpmenu_links tr td { - padding: 1px; +.LC_helpdesk_links { + border: 1px solid black; + padding: 3px; background: $tabbg; text-align: center; font-weight: bold; + display: inline; + margin-right: -6px; } -table#LC_helpmenu_links a:link, -table#LC_helpmenu_links a:visited, -table#LC_helpmenu_links a:active { +.LC_helpdesk_img, +.LC_helpdesk_text { + padding: 0; + margin: 0; + border: 0; + display: inline; +} + +.LC_helpdesk_img a:link, +.LC_helpdesk_img a:visited, +.LC_helpdesk_img a:active, +.LC_helpdesk_text a:link, +.LC_helpdesk_text a:visited, +.LC_helpdesk_text a:active { text-decoration: none; color: $font; } -table#LC_helpmenu_links a:hover { +div.LC_helpdesk_text a:hover { text-decoration: underline; color: $vlink; } @@ -7708,7 +8153,7 @@ table.LC_pick_box { border-spacing: 1px; } -table.LC_pick_box td.LC_pick_box_title { +table.LC_pick_box th.LC_pick_box_title { background: $sidebg; font-weight: bold; text-align: left; @@ -7749,6 +8194,13 @@ table.LC_pick_box td.LC_oddrow_value { background-color: $data_table_light; } +td.LC_log_filter, +th.LC_log_filter { + vertical-align: top; + text-align: left; + padding: 0 4px; +} + span.LC_helpform_receipt_cat { font-weight: bold; } @@ -7911,6 +8363,44 @@ table.LC_prior_tries td { padding: 6px; } +span.LC_prob_status { + margin: 5px 0 0 0; + padding: 0 5px 0 0; + vertical-align: middle; +} + +div.LC_prob_status_outer { + display: inline-block; + margin: -5px 0 0 0; + padding: 0; +} + +div.LC_prob_status_inner { + display: inline-block; + margin: 0 5px 0 0; + padding: 5px; +} + +caption.LC_filesub_status { + text-align: left; + font-weight: bold; +} + +.LC_mail_actions { + float: left; + padding: 0; + margin: 6px; +} + +.LC_vertical_line { + width: 1px; + background-color: black; + height: 4em; + float: left; + margin: 0; + padding: 0; +} + span.LC_prior_numerical, span.LC_prior_string, span.LC_prior_custom, @@ -8064,6 +8554,10 @@ div.LC_grade_show_user div.LC_Box { margin-right: 50px; } +div.LC_grade_show_user div.LC_Box table tr th { + font-weight: normal; +} + div.LC_grade_submissions, div.LC_grade_message_center, div.LC_grade_info_links { @@ -8094,6 +8588,12 @@ table.LC_scantron_action tr th { font-style:normal; } +div.LC_edit_problem_daxe_header { + padding: 3px; + background: $tabbg; + z-index: 100; +} + .LC_edit_problem_header, div.LC_edit_problem_footer { font-weight: normal; @@ -8159,8 +8659,9 @@ img.stift { 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 { @@ -8208,6 +8709,7 @@ h6 { border-bottom:solid 1px $lg_border_color; } +.LC_MainMenu_Box > .LC_hcell, .LC_Box > .LC_hcell { margin: 0 -10px 10px -10px; } @@ -8242,8 +8744,23 @@ fieldset { } fieldset#LC_selectuser { - margin: 0; - padding: 0; + margin: -1px 0 0 0; + padding: 0; + border: 0; +} + +fieldset.LC_delete_slot { + display:inline; + margin: 0 4px 4px; + padding: 4px; +} + +fieldset.LC_delete_slot > legend { + font-weight: normal; +} + +p.LC_medium_line { + line-height: 0.85em; } article.geogebraweb div { @@ -8645,6 +9162,11 @@ ol#LC_PathBreadcrumbs li a { padding: 0 0 10px 10px; } +.LC_MainMenu_Box { + border: solid 1px $lg_border_color; + padding: 0 10px 0 10px; +} + .LC_AboutMe_Image { float:left; margin-right:10px; @@ -8666,6 +9188,7 @@ dl.LC_ListStyleClean dd { .LC_ListStyleClean, .LC_ListStyleSimple, .LC_ListStyleNormal, +.LC_ListStyleMainMenu, .LC_ListStyleSpecial { /* display:block; */ list-style-position: inside; @@ -8703,6 +9226,12 @@ dl.LC_ListStyleClean dd { margin-bottom: 4px; } +.LC_ListStyleMainMenu li { + margin: 0; + padding: 2px 5px 2px 10px; + clear: both; +} + table.LC_SimpleTable { margin:5px; border:solid 1px $lg_border_color; @@ -8801,7 +9330,7 @@ ul#LC_toolbar { padding: 0; margin: 2px; list-style:none; - position:relative; + display:inline; background-color:white; overflow: auto; } @@ -8829,6 +9358,13 @@ a.LC_toolbarItem { background-color:transparent; } +.LC_navtools { + display: inline-block; + padding: 0; + margin: 2px; + vertical-align: middle; +} + ul.LC_funclist { margin: 0; padding: 0.5em 1em 0.5em 0; @@ -8933,13 +9469,39 @@ pre.LC_wordwrap { /* styles used for response display */ -div.LC_radiofoil, div.LC_rankfoil { +div.LC_radiofoil, div.LC_rankfoil, div.LC_optionfoil, div.LC_matchfoil, div.LC_login_links { margin: .5em 0em .5em 0em; } table.LC_itemgroup { margin-top: 1em; } +table.LC_itemgroup tr th { + font-weight: normal; +} + +fieldset.LC_webbubbles { + margin: 2px 0 0 0; + padding: 0; + border: 0; +} + +ul.LC_webbubbles { + list-style: none; + padding: 0; + margin: 0; + text-align: left; + float: left; +} + +ul.LC_webbubbles li { + line-height: 1.8em; + border: 1px solid black; + padding: 0 2px 0 5px; + margin: 0 0 0 -1px; + float: left; +} + /* styles used by TTH when "Default set of options to pass to tth/m when converting TeX" in course settings has been set @@ -9135,7 +9697,7 @@ sub headtag { $inhibitprint = &print_suppression(); } - if (!$args->{'frameset'}) { + if (!$args->{'frameset'} && !$args->{'switchserver'}) { $result .= &Apache::lonhtmlcommon::htmlareaheaders(); } if ($args->{'force_register'} && $env{'request.noversionuri'} !~ m{^/res/adm/pages/}) { @@ -9143,7 +9705,8 @@ sub headtag { } if (!$args->{'no_nav_bar'} && !$args->{'only_body'} - && !$args->{'frameset'}) { + && !$args->{'frameset'} + && !$args->{'switchserver'}) { $result .= &help_menu_js($httphost); $result.=&modal_window(); $result.=&togglebox_script(); @@ -9339,8 +9902,12 @@ OFFLOAD $title = 'The LearningOnline Network with CAPA'; } if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); } - $result .= '<title> LON-CAPA '.$title.'</title>' - .'<link rel="stylesheet" type="text/css" href="'.$url.'"'; + if ($title =~ /^LON-CAPA\s+/) { + $result .= '<title> '.$title.'</title>'; + } else { + $result .= '<title> LON-CAPA '.$title.'</title>'; + } + $result .= "\n".'<link rel="stylesheet" type="text/css" href="'.$url.'"'; if (!$args->{'frameset'}) { $result .= ' /'; } @@ -9355,10 +9922,14 @@ OFFLOAD } if ($clientmobile) { $result .= ' -<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes" />'; } - $result .= '<meta name="google" content="notranslate" />'."\n"; + $result .= '<meta name="google" content="notranslate"'; + if (!$args->{'frameset'}) { + $result .= ' /'; + } + $result .= '>'."\n"; return $result.'</head>'; } @@ -9489,7 +10060,7 @@ sub xml_begin { .'xmlns="http://www.w3.org/1999/xhtml">'; } elsif ($is_frameset) { $output='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'."\n". - '<html>'."\n"; + '<html lang="en">'."\n"; } else { $output='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n". '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n"; @@ -9539,6 +10110,11 @@ $args - additional optional args support no_auto_mt_title -> prevent &mt()ing the title arg bread_crumbs -> Array containing breadcrumbs bread_crumbs_component -> if exists show it as headline else show only the breadcrumbs + bread_crumbs_style -> breadcrumbs are contained within <div id="LC_breadcrumbs">, + and &standard_css() contains CSS for #LC_breadcrumbs, if you want + to override those values, or add to them, specify the value to + include in the style attribute to include in the div tag by using + bread_crumbs_style (e.g., overflow: visible) bread_crumbs_nomenu -> if true will pass false as the value of $menulink to lonhtmlcommon::breadcrumbs group -> includes the current group, if page is for a @@ -9707,9 +10283,12 @@ sub start_page { } #if bread_crumbs_component exists show it as headline else show only the breadcrumbs if(exists($args->{'bread_crumbs_component'})){ - $result .= &Apache::lonhtmlcommon::breadcrumbs($args->{'bread_crumbs_component'},'',$menulink); + $result .= &Apache::lonhtmlcommon::breadcrumbs($args->{'bread_crumbs_component'}, + '',$menulink,'', + $args->{'bread_crumbs_style'}); } else { - $result .= &Apache::lonhtmlcommon::breadcrumbs('','',$menulink); + $result .= &Apache::lonhtmlcommon::breadcrumbs('','',$menulink,'', + $args->{'bread_crumbs_style'}); } } } @@ -10394,8 +10973,10 @@ sub simple_error_page { } my $page = - &Apache::loncommon::start_page($title,'',\%displayargs). + &Apache::loncommon::start_page($title,'',\%displayargs)."\n". + '<div class="LC_landmark" style="clear:both" role="main">'. '<p class="LC_error">'.$msg.'</p>'. + '</div>'. &Apache::loncommon::end_page(); if (ref($r)) { $r->print($page); @@ -10417,6 +10998,11 @@ sub simple_error_page { return; } + sub set_data_table_count { + my ($count) = @_; + unshift(@row_count,$count); + } + sub start_data_table { my ($add_class,$id) = @_; my $css_class = (join(' ','LC_data_table',$add_class)); @@ -10464,7 +11050,11 @@ sub simple_error_page { } sub start_data_table_header_row { - return '<tr class="LC_header_row">'."\n";; + my ($add_class,$id) = @_; + my $css_class = 'LC_header_row'; + $css_class = (join(' ',$css_class,$add_class)) unless ($add_class eq ''); + $id = (' id="'.$id.'"') unless ($id eq ''); + return '<tr class="'.$css_class.'"'.$id.'>'."\n"; } sub end_data_table_header_row { @@ -10472,8 +11062,8 @@ sub simple_error_page { } sub data_table_caption { - my $caption = shift; - return "<caption class=\"LC_caption\">$caption</caption>"; + my ($caption,$css_class) = @_; + return "<caption class=\"LC_caption $css_class\">$caption</caption>"; } } @@ -15143,12 +15733,12 @@ sub upfile_select_html { tab => &mt('Tabulator separated'), # xml => &mt('HTML/XML'), ); - my $Str = '<input type="file" name="upfile" size="50" />'. - '<br />'.&mt('Type').': <select name="upfiletype">'; + my $Str = '<input type="file" name="upfile" id="upfile" size="50" />'. + '<br /><label>'.&mt('Type').': <select name="upfiletype">'; foreach my $type (sort(keys(%Types))) { $Str .= '<option value="'.$type.'" >'.$Types{$type}."</option>\n"; } - $Str .= "</select>\n"; + $Str .= "</select></label>\n"; return $Str; } @@ -15232,9 +15822,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().'<td>'.$display.'</td>'); + $r->print(&start_data_table_row().'<td><label for="f'.$i.'">'.$display.'</label></td>'); - $r->print('<td><select name="f'.$i.'"'. + $r->print('<td><select name="f'.$i.'" id="f'.$i.'"'. ' onchange="javascript:flip(this.form,'.$i.');">'); $r->print('<option value="none"></option>'); foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) { @@ -15279,8 +15869,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().'<td><select name="f'.$i.'"'. - ' onchange="javascript:flip(this.form,'.$i.');">'); + ' onchange="javascript:flip(this.form,'.$i.');" aria-label="'.$labeltext.'">'); foreach my $option (@$d) { my ($value,$display,$defaultcol)=@{ $option }; $r->print('<option value="'.$value.'"'. @@ -17797,6 +18389,12 @@ sub init_user_environment { } else { $userenv{'editors'} = 'edit,xml'; } + if ($userenv{'authorarchive'}) { + $userenv{'canarchive'} = 1; + } elsif (($userenv{'authorarchive'} eq '') && + ($domdef{'archive'})) { + $userenv{'canarchive'} = 1; + } } $userenv{'canrequest.author'} = @@ -18585,7 +19183,7 @@ Returns: HTML to display with informatio sub check_release_result { my ($switchwarning,$switchserver) = @_; my $output = &start_page('Selected course unavailable on this server'). - '<p class="LC_warning">'; + '<div class="LC_landmark" role="main"><p class="LC_warning">'; if ($switchwarning) { $output .= $switchwarning.'<br /><a href="/adm/roles">'; if (&show_course()) { @@ -18601,7 +19199,7 @@ sub check_release_result { &mt('Switch Server'). '</a>'; } - $output .= '</p>'.&end_page(); + $output .= '</p></div>'.&end_page(); return $output; } @@ -18685,8 +19283,8 @@ sub needs_coursereinit { $update = 'supp'; } } - return ($update); } + return ($update); } return (); } @@ -19217,9 +19815,9 @@ sub create_captcha { if (-e $Apache::lonnet::perlvar{'lonCaptchaDir'}.'/'.$md5sum.'.png') { $output = '<input type="hidden" name="crypt" value="'.$md5sum.'" />'."\n". '<span class="LC_nobreak">'. - &mt('Type in the letters/numbers shown below').' '. - '<input type="text" size="5" name="code" value="" autocomplete="new-password" />'. - '</span><br />'. + '<label>'.&mt('Type in the letters/numbers shown below').' '. + '<input type="text" size="5" name="code" value="" autocomplete="new-password" aria-required="true" />'. + '</label></span><br />'. '<img src="'.$captcha_params{'www_output_dir'}.'/'.$md5sum.'.png" alt="captcha" />'; last; }