--- loncom/interface/domainprefs.pm 2016/04/04 01:09:47 1.272 +++ loncom/interface/domainprefs.pm 2016/06/06 17:40:47 1.273 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.272 2016/04/04 01:09:47 raeburn Exp $ +# $Id: domainprefs.pm,v 1.273 2016/06/06 17:40:47 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3154,7 +3154,24 @@ sub print_ltitools { } $datatable .= ''; } - $datatable .= ''. + $datatable .= ''; + my %courseconfig; + if (ref($settings->{$item}) eq 'HASH') { + if (ref($settings->{$item}->{'crsconf'}) eq 'HASH') { + %courseconfig = %{$settings->{$item}->{'crsconf'}}; + } + } + $datatable .= '
'.&mt('Configurable in course').''; + foreach my $item ('label','title','target') { + my $checked; + if ($courseconfig{$item}) { + $checked = ' checked="checked"'; + } + $datatable .= ''.(' ' x2)."\n"; + } + $datatable .= '
'. '
'.&mt('Custom items sent on launch').''. ''; if (ref($settings->{$item}->{'custom'}) eq 'HASH') { @@ -3260,6 +3277,13 @@ sub print_ltitools { $datatable .= ''; } $datatable .= '
'.&mt('Action').''.&mt('Name').''.&mt('Value').'
'. + '
'.&mt('Configurable in course').''; + foreach my $item ('label','title','target') { + $datatable .= ''.(' ' x2)."\n"; + } + $datatable .= '
'. '
'.&mt('Custom items sent on launch').''. ''. '
'.&mt('Action').''.&mt('Name').''.&mt('Value').'
'. @@ -3294,6 +3318,9 @@ sub ltitools_names { 'width' => 'Width', 'passback' => 'Tool can return grades:', 'roster' => 'Tool can retrieve roster:', + 'crstarget' => 'Display target', + 'crslabel' => 'Course label', + 'crstitle' => 'Course title', ); return %lt; } @@ -8435,6 +8462,10 @@ sub modify_ltitools { } } } + my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_courseconfig'); + foreach my $item (@courseconfig) { + $confhash{$newid}{'crsconf'}{$item} = 1; + } if ($env{'form.ltitools_add_custom'}) { my $name = $env{'form.ltitools_add_custom_name'}; my $value = $env{'form.ltitools_add_custom_value'}; @@ -8522,6 +8553,19 @@ sub modify_ltitools { $changes{$itemid} = 1; } } + my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_courseconfig_'.$i); + foreach my $item ('label','title','target') { + if (grep(/^\Q$item\E$/,@courseconfig)) { + $confhash{$itemid}{'crsconf'}{$item} = 1; + if (ref($domconfig{$action}{$itemid}{'crsconf'}) eq 'HASH') { + if ($domconfig{$action}{$itemid}{'crsconf'}{$item} ne $confhash{$itemid}{'crsconf'}{$item}) { + $changes{$itemid} = 1; + } + } else { + $changes{$itemid} = 1; + } + } + } my @fields = &Apache::loncommon::get_env_multiple('form.ltitools_fields_'.$i); foreach my $field (@fields) { if ($possfield{$field}) { @@ -8685,6 +8729,21 @@ sub modify_ltitools { my $num = length($confhash{$itemid}{'secret'}); $resulttext .= ('*'x$num).''; } + $resulttext .= '
  • '.&mt('Configurable in course:'); + my @possconfig = ('label','title','target'); + my $numconfig = 0; + if (ref($confhash{$itemid}{'crsconf'}) eq 'HASH') { + foreach my $item (@possconfig) { + if ($confhash{$itemid}{'crsconf'}{$item}) { + $numconfig ++; + $resulttext .= ' '.$lt{'crs'.$item}; + } + } + } + if (!$numconfig) { + $resulttext .= &mt('None'); + } + $resulttext .= '
  • '; foreach my $item ('passback','roster') { $resulttext .= '
  • '.$lt{$item}.' '; if ($confhash{$itemid}{$item}) {