--- loncom/interface/courseprefs.pm 2023/03/19 16:05:48 1.118 +++ loncom/interface/courseprefs.pm 2023/06/01 20:04:36 1.121 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set configuration settings for a course # -# $Id: courseprefs.pm,v 1.118 2023/03/19 16:05:48 raeburn Exp $ +# $Id: courseprefs.pm,v 1.121 2023/06/01 20:04:36 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') { @@ -2011,7 +2011,7 @@ sub process_ltitools { if ($env{$keyitem} ne '') { $ltitools{$newid}{'key'} = $env{$keyitem}; } - my $secretitem = 'form.ltitools_add_secret'; + my $secretitem = 'form.ltitools_secret_add'; $env{$secretitem} =~ s/(`)/'/g; if ($env{$secretitem} ne '') { if ($privnum && $cipher) { @@ -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,38 @@ sub print_bridgetasks { sub print_ltitools { my ($cdom,$cnum,$settings,$rowtotal,$crstype,$noedit,$context) = @_; my ($datatable,$disabled,$css_class,$dest); - my %lt = <itools_names(); + if ($noedit) { + $disabled = ' disabled="disabled"'; + } 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 +6423,7 @@ sub print_ltitools { ''. ''. '

'. - ''.$lt{'url'}.':'.$lt{'url'}.':'. (' 'x2). ''.$lt{'lifetime'}.':'. @@ -6671,7 +6701,7 @@ sub print_ltitools { ''. ''. '
'. - ''.$lt{'url'}.': '."\n". + ''.$lt{'url'}.': '."\n". (' 'x2). ''.$lt{'lifetime'}.':
'; if ($switchserver) { @@ -6679,8 +6709,8 @@ sub print_ltitools { } else { $datatable .= ''.$lt{'key'}.': '."\n". (' 'x2). - ''.$lt{'secret'}.':'. - ' '."\n"; + ''.$lt{'secret'}.':'. + ' '."\n"; } $datatable .= '

'. ''. @@ -8224,7 +8254,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});