--- loncom/interface/loncommon.pm 2023/11/03 01:31:57 1.1415 +++ loncom/interface/loncommon.pm 2025/02/21 04:29:26 1.1460 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1415 2023/11/03 01:31:57 raeburn Exp $ +# $Id: loncommon.pm,v 1.1460 2025/02/21 04:29:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1174,7 +1174,8 @@ sub linked_select_forms { $menuorder, $onchangefirst, $onchangesecond, - $suffix + $suffix, + $haslabel ) = @_; my $second = "document.$formname.$secondselectname"; my $first = "document.$formname.$firstselectname"; @@ -1240,13 +1241,18 @@ END $result.=">".&mt($hashref->{$value}->{'text'})."\n"; } $result .= "\n"; + if ($haslabel) { + $result .= ''; + } 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 .= ''; + } # return $debug; return $result; } # end of sub linked_select_forms { @@ -1372,7 +1381,7 @@ sub helpLatexCheatsheet { $out .= '' .&help_open_topic('Authoring_Output_Tags',&mt('Output Tags'),$stayOnPage,undef,600) .' ' - .&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) .''; } $out .= ''; # End cheatsheet @@ -1451,7 +1460,7 @@ $banner_link $text END } else { - return ' '.$text.' '; + return ' 

'.$text.'

 '; } } @@ -1463,6 +1472,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 +1487,6 @@ sub help_menu_js { my $end_page = &Apache::loncommon::end_page({'frameset' => 1, 'js_ready' => 1,}); - my $template .= <<"ENDTEMPLATE"; + +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(< form to allow a user to select the domain to preform an operation in. @@ -2925,17 +3097,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 +3123,7 @@ sub select_dom_form { if (ref($excdoms) eq 'ARRAY') { map { $exclude{$_} = 1; } @{$excdoms}; } - my $selectdomain = "\n"; foreach my $dom (@domains) { next if ($exclude{$dom}); $selectdomain.="