--- loncom/interface/courseprefs.pm 2023/09/24 03:31:18 1.127 +++ loncom/interface/courseprefs.pm 2024/02/24 23:41:44 1.131 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set configuration settings for a course # -# $Id: courseprefs.pm,v 1.127 2023/09/24 03:31:18 raeburn Exp $ +# $Id: courseprefs.pm,v 1.131 2024/02/24 23:41:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -372,6 +372,12 @@ sub handler { my %values=&Apache::lonnet::dump('environment',$cdom,$cnum); my %linkprot=&Apache::lonnet::dump('lti',$cdom,$cnum,undef,undef,undef,1); + my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); + unless ($phase eq 'process') { + if (ref($domdefs{'linkprotsuggested'}) eq 'HASH') { + $values{'suggested'} = $domdefs{'linkprotsuggested'}; + } + } my %ltienc = &Apache::lonnet::dump('nohist_ltienc',$cdom,$cnum,undef,undef,undef,1); my %ltitools = &Apache::lonnet::dump('ltitools',$cdom,$cnum,undef,undef,undef,1); my %ltitoolsenc = &Apache::lonnet::dump('nohist_toolsenc',$cdom,$cnum,undef,undef,undef,1); @@ -793,9 +799,38 @@ sub print_config_box { '; + if ($action eq 'linkprot') { + if ((ref($settings) eq 'HASH') && (ref($settings->{'suggested'}) eq 'HASH')) { + my $hints; + my $hintcount = 0; + foreach my $key (sort { $a <=> $b } keys(%{$settings->{'suggested'}})) { + if ((ref($settings->{'suggested'}->{$key}) eq 'HASH')) { + if (($settings->{'suggested'}->{$key}-{'name'} ne '') && + ($settings->{'suggested'}->{$key}-{'info'} ne '')) { + my $css_class = $hintcount%2?' class="LC_odd_row"':' class="LC_even_row"'; + $hints .= ''. + ''; + $hintcount ++; + } + } + } + if ($hintcount) { + $output .= ''. + ''. + ''."\n". + ''. + ''. + ''."\n". + $hints; + } + } + } if (exists $item->{'header'}->[0]->{'col1'} || exists $item->{'header'}->[0]->{'col2'}) { - $output .= ' + $output .= ' '; if (($action eq 'courseinfo') || ($action eq 'localization') || @@ -3285,7 +3320,13 @@ sub store_ltitools { } } } - $output .= '
  • '.&mt('Configurable in course:'); + $output .= '
  • '; + if ($context eq 'domain') { + $output .= &mt('Configurable in course'); + } else { + $output .= &mt('Configurable for each instance of tool in course'); + } + $output .= ':'; my @possconfig = ('label','title','target','linktext','explanation','append'); my $numconfig = 0; if (ref($changes->{$itemid}{'crsconf'}) eq 'HASH') { @@ -6709,7 +6750,13 @@ sub print_ltitools { %courseconfig = %{$settings->{$item}->{'crsconf'}}; } } - $datatable .= '
    '.&mt('Configurable in course').''; + $datatable .= '
    '; + if ($context eq 'domain') { + $datatable .= &mt('Configurable in course'); + } else { + $datatable .= &mt('Configurable for each instance of tool in course'); + } + $datatable .= ''; foreach my $item ('label','title','target','linktext','explanation','append') { my $checked; if ($courseconfig{$item}) { @@ -6867,7 +6914,13 @@ sub print_ltitools { $datatable .= ''; } $datatable .= '
  • '. + $settings->{'suggested'}->{$key}->{'name'}.'
    '.
    +                                      $settings->{'suggested'}->{$key}->{'info'}.
    +                                      '
    '.&mt('Recommendation(s) for specific launcher application(s)').'
    '.&mt('Launcher Application').''.&mt('Recommendation(s)').'
    '.&mt($item->{'header'}->[0]->{'col1'}).'
    '. - '
    '.&mt('Configurable in course').''; + '
    '; + if ($context eq 'domain') { + $datatable .= &mt('Configurable in course'); + } else { + $datatable .= &mt('Configurable for each instance of tool in course'); + } + $datatable .= ''; foreach my $item ('label','title','target','linktext','explanation','append') { $datatable .= ' '. ''. - '