--- loncom/interface/courseprefs.pm 2023/04/13 15:21:00 1.119 +++ loncom/interface/courseprefs.pm 2023/05/22 21:10:55 1.120 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set configuration settings for a course # -# $Id: courseprefs.pm,v 1.119 2023/04/13 15:21:00 raeburn Exp $ +# $Id: courseprefs.pm,v 1.120 2023/05/22 21:10:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1883,7 +1883,7 @@ sub process_ltitools { my @allfields = ('fullname','firstname','lastname','email','user','roles'); map { $possfield{$_} = 1; } @allfields; - my ($dest,$privnum,$cipher,$errors,%ltitools); + my ($dest,$privnum,$cipher); ($cipher,$privnum) = &get_credentials($cdom,$cnum,'ltitools',$context); if ($context eq 'domain') { @@ -3223,7 +3223,7 @@ sub store_ltitools { &Apache::lonnet::devalidate_cache_new('courseltitools',$hashid); unless (($home eq 'no_host') || ($home eq '')) { if (grep(/^\Q$home\E$/,@ids)) { - &Apache::lonnet::devalidate_cache_new('courseltitoolsenc',$hashid); + &Apache::lonnet::devalidate_cache_new('crsltitoolsenc',$hashid); } } } else { @@ -6310,8 +6310,35 @@ sub print_bridgetasks { sub print_ltitools { my ($cdom,$cnum,$settings,$rowtotal,$crstype,$noedit,$context) = @_; my ($datatable,$disabled,$css_class,$dest); - my %lt = <itools_names(); my $itemcount = 1; + unless ($context eq 'domain') { + my %tooltypes = &Apache::loncommon::usable_exttools(); + unless ($tooltypes{'crs'}) { + my $showtype = 'course'; + if ($crstype eq 'Community') { + $showtype = lc($crstype); + } + $css_class = $itemcount%2?' class="LC_odd_row"':''; + $datatable = ''. + &mt("Definition of external tools is not enabled for this $showtype.").'
'; + if ($tooltypes{'dom'}) { + $datatable .= &mt("Contact an administrator for the $showtype domain ([_1]) to request this feature be enabled.", + ''.$cdom.''). + '

'. + &mt("Use of external tools defined at a domain level is enabled, so the $showtype editor can be used to add tool(s), if any have been defined."); + } else { + $datatable .= &mt("Use of external tools defined at a domain level is not enabled, either, for this $showtype."). + '

'. + &mt("Contact an administrator for the $showtype domain ([_1]) to request changes.", + ''.$cdom.''); + + } + $datatable .= ''; + $itemcount ++; + return $datatable; + } + } + my %lt = <itools_names(); my $maxnum = 0; my %ordered; if (ref($settings) eq 'HASH') { @@ -6393,7 +6420,7 @@ sub print_ltitools { ''. ''. '

'. - ''.$lt{'url'}.':'.$lt{'url'}.':'. (' 'x2). ''.$lt{'lifetime'}.':'. @@ -6671,7 +6698,7 @@ sub print_ltitools { ''. ''. '
'. - ''.$lt{'url'}.': '."\n". + ''.$lt{'url'}.': '."\n". (' 'x2). ''.$lt{'lifetime'}.':
'; if ($switchserver) { @@ -8224,7 +8251,7 @@ sub devalidate_remote_courseprefs { my %servers = &Apache::lonnet::internet_dom_servers($cdom); my %thismachine; map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); - my @posscached = ('courselti'); + my @posscached = ('courselti','courseltitools'); if (keys(%servers)) { foreach my $server (keys(%servers)) { next if ($thismachine{$server});