From raeburn at source.lon-capa.org Mon Oct 18 18:29:20 2021 From: raeburn at source.lon-capa.org (raeburn) Date: Mon, 18 Oct 2021 22:29:20 -0000 Subject: [LON-CAPA-cvs] cvs: loncom /interface courseprefs.pm loncommon.pm lonfeedback.pm Message-ID: raeburn Mon Oct 18 22:29:20 2021 EDT Modified files: /loncom/interface courseprefs.pm loncommon.pm lonfeedback.pm Log: - Bug 6907 Configuration for a numbered menu collection includes option to hide footer shown below a resource, and/or hide Discussion or Feedback links. -------------- next part -------------- Index: loncom/interface/courseprefs.pm diff -u loncom/interface/courseprefs.pm:1.93 loncom/interface/courseprefs.pm:1.94 --- loncom/interface/courseprefs.pm:1.93 Wed Aug 4 19:59:10 2021 +++ loncom/interface/courseprefs.pm Mon Oct 18 22:29:20 2021 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set configuration settings for a course # -# $Id: courseprefs.pm,v 1.93 2021/08/04 19:59:10 raeburn Exp $ +# $Id: courseprefs.pm,v 1.94 2021/10/18 22:29:20 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -995,8 +995,8 @@ } } } - } + foreach my $idx (@items) { my $itemid = $itemids{$idx}; next unless ($itemid); @@ -4076,8 +4076,8 @@ } if ($position eq 'top') { my $includeempty = 0; - $datatable .= ''. - &user_table($cdom,$item,\@sections, + $datatable .= ''. + &user_table($cdom,$item,\@sections, $settings->{$item},\%lt,$noedit); } else { $datatable .= &Apache::lonhtmlcommon::textbox($item.'.text', @@ -4300,8 +4300,8 @@ ''.&role_checkboxes($cdom,$cnum,$item,$settings,undef,undef,$noedit). '
'; } elsif ($item eq 'plc.users.denied') { - $datatable .= ''. - &user_table($cdom,$item,undef, + $datatable .= ''. + &user_table($cdom,$item,undef, $settings->{$item},\%lt,$noedit); } elsif ($item eq 'pch.roles.denied') { $datatable .= ''. @@ -5064,7 +5064,7 @@ my %checked; my $on = ' checked="checked"'; foreach my $key (keys(%{$menu{$num}})) { - if (($key eq 'top') || ($key eq 'inline') || ($key eq 'main')) { + if (($key eq 'top') || ($key eq 'inline') || ($key eq 'foot') || ($key eq 'main')) { if ($menu{$num}{$key} eq 'y') { $checked{$key} = $on; } @@ -5081,7 +5081,13 @@ foreach my $category (@order) { if ((ref($categories{$category}) eq 'ARRAY') && (@{$categories{$category}} > 0)) { $datatable .= '
'.$menutitles{$category}.''."\n"; + if ($category eq 'text') { + $datatable .= ''.&mt('Header').'
'; + } foreach my $field (@{$categories{$category}}) { + if ($field eq 'disc') { + $datatable .= '
'.&mt('Footer').'
'; + } $datatable .= '
'; } @@ -5131,8 +5137,8 @@ sub menuitems_categories { my @order = ('shown','text','links','list','inline'); my %categories = ( - shown => ['top','inline','main'], - text => ['name','role','crs'], + shown => ['top','inline','foot','main'], + text => ['name','role','crs','disc','fdbk'], links => ['pers','logo','menu','comm','roles','help','logout'], list => ['about','prefs','port','wish','anno','rss'], inline => ['cont','grades','chat','people','groups','resv','syll','feeds'], @@ -5143,7 +5149,7 @@ sub menuitems_titles { return &Apache::lonlocal::texthash ( shown => 'Hierarchy', - text => 'Header text', + text => 'Text', links => 'Header links', list => 'Drop-down list', inline => 'Inline links', @@ -5154,6 +5160,7 @@ return &Apache::lonlocal::texthash ( top => 'Display header', inline => 'Display inline menu', + foot => 'Display footer', main => 'Access to main menu', pers => 'Personal', logo => 'LON-CAPA', @@ -5165,6 +5172,8 @@ name => 'Fullname', crs => 'Course Title', role => 'Current Role', + disc => 'Discussion', + fdbk => 'Feedback', about => 'Information', prefs => 'Preferences', port => 'Portfolio', @@ -5206,7 +5215,7 @@ foreach my $num (@current) { my %checked; foreach my $key (keys(%{$menu{$num}})) { - if (($key eq 'top') || ($key eq 'inline') || ($key eq 'main')) { + if (($key eq 'top') || ($key eq 'inline') || ($key eq 'foot') || ($key eq 'main')) { if ($menu{$num}{$key} eq 'y') { $checked{$key} = 1; } @@ -5224,7 +5233,13 @@ if ((ref($categories{$category}) eq 'ARRAY') && (@{$categories{$category}} > 0)) { $output .= '
'. ''.$menutitles{$category}.''."\n"; + if ($category eq 'text') { + $output .= ''.&mt('Header Text').'

'; + } foreach my $field (@{$categories{$category}}) { + if ($field eq 'disc') { + $output .= '
'.&mt('Footer Text').'

'; + } if ($checked{$field}) { $output .= &Apache::lonhtmlcommon::confirm_success($menufields{$field}); } else { Index: loncom/interface/loncommon.pm diff -u loncom/interface/loncommon.pm:1.1367 loncom/interface/loncommon.pm:1.1368 --- loncom/interface/loncommon.pm:1.1367 Sat Sep 25 20:35:26 2021 +++ loncom/interface/loncommon.pm Mon Oct 18 22:29:20 2021 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1367 2021/09/25 20:35:26 raeburn Exp $ +# $Id: loncommon.pm,v 1.1368 2021/10/18 22:29:20 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -18839,7 +18839,7 @@ my @entries = split(/\&/,$value); foreach my $entry (@entries) { my ($name,$fields) = split(/=/,$entry); - if (($name eq 'top') || ($name eq 'inline') || ($name eq 'main')) { + if (($name eq 'top') || ($name eq 'inline') || ($name eq 'foot') || ($name eq 'main')) { $menu{$name} = $fields; } else { my @shown; Index: loncom/interface/lonfeedback.pm diff -u loncom/interface/lonfeedback.pm:1.384 loncom/interface/lonfeedback.pm:1.385 --- loncom/interface/lonfeedback.pm:1.384 Fri Dec 18 15:23:02 2020 +++ loncom/interface/lonfeedback.pm Mon Oct 18 22:29:20 2021 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.384 2020/12/18 15:23:02 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.385 2021/10/18 22:29:20 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -118,10 +118,16 @@ $outputtarget = 'export'; } } + my ($nofooter,$nodisclink,$nofdbklink); if (not &discussion_visible($status)) { if ($mode ne 'board') { - &Apache::lonenc::check_encrypt(\$ressymb); - return '
"; + ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll(); + if ($nofooter || $nofdbklink) { + return '
'; + } else { + &Apache::lonenc::check_encrypt(\$ressymb); + return '
"; + } } } if ($group ne '' && $mode eq 'board') { @@ -136,13 +142,21 @@ $blocktext = '
'; + ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll(); + unless ($nofooter || $nofdbklink) { + $blocktext.=&send_message_link($ressymb); + } + $blocktext.=''; }else{ $blocktext.=""; } return $blocktext; } + unless ($outputtarget eq 'export') { + ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll(); + } + my @bgcols = ("LC_disc_old_item","LC_disc_new_item"); my $discussiononly=0; if ($mode eq 'board') { $discussiononly=1; } @@ -774,33 +788,60 @@ &mt('This discussion is closed.').''; } } elsif ($outputtarget ne 'tex') { - $discussion.=''; } return $discussion; } +sub check_menucoll { + my ($nofooter,$nodisclink,$nofdbklink); + my ($menucoll,$deeplinkmenu,$menuref) = &Apache::loncommon::menucoll_in_effect(); + if ($menucoll) { + if (ref($menuref) eq 'HASH') { + if ($menuref->{'foot'} eq 'n') { + $nofooter = 1; + } else { + unless ($menuref->{'disc'}) { + $nodisclink = 1; + } + unless ($menuref->{'fdbk'}) { + $nofdbklink = 1; + } + } + } + } + return ($nofooter,$nodisclink,$nofdbklink); +} + sub can_see_hidden { my ($mode,$ressymb,$feedurl,$group,$cdom,$cnum,$crs) = @_; my $seehidden; From raeburn at source.lon-capa.org Mon Oct 18 20:16:32 2021 From: raeburn at source.lon-capa.org (raeburn) Date: Tue, 19 Oct 2021 00:16:32 -0000 Subject: [LON-CAPA-cvs] cvs: rat / lonwrapper.pm Message-ID: raeburn Tue Oct 19 00:16:32 2021 EDT Modified files: /rat lonwrapper.pm Log: - On iOS 13-15 "Request Mobile Website" is needed to view a PDF in Safari. Browser agent string decoded at request time instead of using value set at session initialization, to accommodate user toggling via Aa control. Index: rat/lonwrapper.pm diff -u rat/lonwrapper.pm:1.76 rat/lonwrapper.pm:1.77 --- rat/lonwrapper.pm:1.76 Sat Feb 29 16:05:26 2020 +++ rat/lonwrapper.pm Tue Oct 19 00:16:32 2021 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Wrapper for external and binary files as standalone resources # -# $Id: lonwrapper.pm,v 1.76 2020/02/29 16:05:26 raeburn Exp $ +# $Id: lonwrapper.pm,v 1.77 2021/10/19 00:16:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -56,6 +56,9 @@ 'show' => 'Show content in pop-up window', ); + (undef,undef,undef,undef,undef,undef,my $clientmobile) = + &Apache::loncommon::decode_user_agent($r); + my ($anchor,$uselink); if ($is_ext) { if ($env{'form.symb'}) { @@ -66,7 +69,7 @@ } elsif ($env{'form.anchor'} ne '') { $anchor = '#'.$env{'form.anchor'}; } - unless (($is_pdf) && ($env{'browser.mobile'})) { + unless (($is_pdf) && ($clientmobile)) { my $hostname = $r->hostname(); my $lonhost = $r->dir_config('lonHostID'); my $ip = &Apache::lonnet::get_host_ip($lonhost); @@ -142,7 +145,7 @@ # do not obscure the Functions menu. # - unless (($env{'browser.mobile'}) || ($exttool eq 'window') || ($exttool eq 'tab') || $uselink) { + unless ($clientmobile || ($exttool eq 'window') || ($exttool eq 'tab') || $uselink) { $headjs = '