--- loncom/interface/loncommon.pm 2024/10/07 19:46:51 1.1439 +++ loncom/interface/loncommon.pm 2025/02/20 01:09:33 1.1458 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1439 2024/10/07 19:46:51 raeburn Exp $ +# $Id: loncommon.pm,v 1.1458 2025/02/20 01:09:33 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 .= ''.$middletext; + } $result .= "".&mt($select2{$value})."\n"; } $result .= "\n"; + if ($middletext ne '') { + $result .= ''; + } # return $debug; return $result; } # end of sub linked_select_forms { @@ -2300,7 +2309,7 @@ sub import_crsauthor_form { dire => 'Directory', se => 'Select', ); - $output = $lt{'dire'}.': '. + $output = ''.$lt{'dire'}.': '. ''. ''.$lt{'se'}.''; @@ -2311,10 +2320,10 @@ sub import_crsauthor_form { next if ($key eq '/'); $output .= ''.$key.''."\n"; } - $output .= ''."\n". + $output .= ''."\n". $lt{'fnam'}.': '."\n". ''."\n". - ''."\n". + ''."\n". ''; return ($numdirs,$output); } @@ -2476,7 +2485,7 @@ END $cdom 0 -notset +notset $now 0 rights @@ -3066,7 +3075,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 form to allow a user to select the domain to preform an operation in. @@ -3085,17 +3094,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}); @@ -3106,7 +3120,7 @@ sub select_dom_form { if (ref($excdoms) eq 'ARRAY') { map { $exclude{$_} = 1; } @{$excdoms}; } - my $selectdomain = "\n"; + my $selectdomain = "\n"; foreach my $dom (@domains) { next if ($exclude{$dom}); $selectdomain.="{'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); @@ -6931,8 +6947,6 @@ sub bodytag { $role = &Apache::lonnet::plaintext($role); } - if (!$realm) { $realm=' '; } - my $extra_body_attr = &make_attr_string($forcereg,\%design); # construct main body tag @@ -6956,7 +6970,6 @@ sub bodytag { undef($role); } unless ($ltimenu->{'coursetitle'}) { - $realm=' '; $showcrstitle = 0; } } @@ -6966,7 +6979,6 @@ sub bodytag { undef($role); } unless ($menuref->{'crs'}) { - $realm=' '; $showcrstitle = 0; } } @@ -7000,8 +7012,12 @@ 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 '') { @@ -7030,30 +7046,42 @@ END $args->{'links_disabled'}, $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|$dc_info|; } - $bodytag .= qq|$left $role - $realm $dc_info|; + $bodytag .= qq|$left $role|; + unless (($realm eq '') && ($dc_info eq '')) { + $bodytag .= qq|$realm $dc_info|; + } + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } return $bodytag; } + $bodytag .= ''; unless ($env{'request.symb'} =~ m/\.page___\d+___/) { $bodytag .= qq|$left $role|; } - $bodytag .= $right; + $bodytag .= $right.''; if ($dc_info) { $dc_info = &dc_courseid_toggle($dc_info); } - $bodytag .= qq|$realm $dc_info|; + unless (($realm eq '') && ($dc_info eq '')) { + $bodytag .= qq|$realm $dc_info|; + } + $bodytag .= qq||; } #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 @@ -7066,7 +7094,9 @@ END $args->{'links_target'}); } $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, @@ -7082,11 +7112,13 @@ END $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. + } else { + # this is to separate menu from content when there's no secondary + # menu. Especially needed for publicly accessible resources. $bodytag .= ''; - $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } } if ($args->{'collapsible_header'} ne '') { $bodytag .= $args->{'collapsible_header'}. @@ -7221,7 +7253,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); @@ -7286,6 +7317,30 @@ 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; +} + .LC_menus_content.shown{ display: block; } @@ -7298,6 +7353,10 @@ form, .inline { text-align:right; } +.LC_center { + text-align:center; +} + .LC_middle { vertical-align:middle; } @@ -7950,29 +8009,58 @@ table#LC_helpmenu fieldset legend { font-size: larger; } -table#LC_helpmenu_links { - width: 100%; - border: 1px solid black; +.LC_helpdesk_headbox { + border: 2px groove threedface; + padding: 1em; +} + +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; +} + +.LC_helpdesk_img, +.LC_helpdesk_text { + padding: 0; + margin: 0; + border: 0; + display: inline; } -table#LC_helpmenu_links a:link, -table#LC_helpmenu_links a:visited, -table#LC_helpmenu_links a:active { +.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; } @@ -7999,7 +8087,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; @@ -8202,6 +8290,29 @@ table.LC_prior_tries td { padding: 6px; } +.LC_prob_status { + margin-top: 5px; + padding-top: 0; + padding-left: 0; + padding-bottom: 0; + padding-right: 5px; +} + +.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, @@ -9092,7 +9203,7 @@ ul#LC_toolbar { padding: 0; margin: 2px; list-style:none; - position:relative; + display:inline; background-color:white; overflow: auto; } @@ -9120,6 +9231,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; @@ -9654,7 +9772,11 @@ OFFLOAD '; } - $result .= ''."\n"; + $result .= '{'frameset'}) { + $result .= ' /'; + } + $result .= '>'."\n"; return $result.''; } @@ -18995,8 +19117,8 @@ sub needs_coursereinit { $update = 'supp'; } } - return ($update); } + return ($update); } return (); } @@ -19527,9 +19649,9 @@ sub create_captcha { if (-e $Apache::lonnet::perlvar{'lonCaptchaDir'}.'/'.$md5sum.'.png') { $output = ''."\n". ''. - &mt('Type in the letters/numbers shown below').' '. + ''.&mt('Type in the letters/numbers shown below').' '. ''. - ''. + ''. ''; last; }