--- loncom/interface/domainprefs.pm 2017/03/20 03:19:43 1.295 +++ loncom/interface/domainprefs.pm 2017/04/25 22:18:59 1.296 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.295 2017/03/20 03:19:43 raeburn Exp $ +# $Id: domainprefs.pm,v 1.296 2017/04/25 22:18:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -488,7 +488,7 @@ sub handler { }, 'ltitools' => {text => 'External Tools (LTI)', - help => 'Domain_configuration_LTI_Tools', + help => 'Domain_Configuration_LTI_Tools', header => [{col1 => 'Setting', col2 => 'Value',}], print => \&print_ltitools, @@ -3754,6 +3754,8 @@ sub print_ltitools { if ($settings->{$item}->{'display'}->{'height'} =~ /^(\d+)$/) { $currdisp{'height'} = $1; } + $currdisp{'linktext'} = $settings->{$item}->{'display'}->{'linktext'}; + $currdisp{'explanation'} = $settings->{$item}->{'display'}->{'explanation'}; } else { $currdisp{'iframe'} = ' checked="checked"'; } @@ -3767,6 +3769,12 @@ sub print_ltitools { ''. (' 'x2); } + $datatable .= '
'. + '
'.$lt{'linktext'}.'
'. + '
'. + '
'.$lt{'explanation'}.'
'. + '

'; $datatable .= '
'; foreach my $extra ('passback','roster') { my $checkedon = ''; @@ -3848,7 +3856,7 @@ sub print_ltitools { } } $datatable .= '
'.&mt('Configurable in course').''; - foreach my $item ('label','title','target') { + foreach my $item ('label','title','target','linktext','explanation') { my $checked; if ($courseconfig{$item}) { $checked = ' checked="checked"'; @@ -3926,7 +3934,12 @@ sub print_ltitools { ''. (' 'x2); } - $datatable .= '
'; + $datatable .= '
'. + '
'.$lt{'linktext'}.'
'. + '
'. + '
'.$lt{'explanation'}.'
'. + ''. + '

'; foreach my $extra ('passback','roster') { $datatable .= $lt{$extra}.' '. '
'. '
'.&mt('Configurable in course').''; - foreach my $item ('label','title','target') { - $datatable .= ''.(' ' x2)."\n"; + foreach my $item ('label','title','target','linktext','explanation') { + $datatable .= ''.(' ' x2)."\n"; } $datatable .= '
'. '
'.&mt('Custom items sent on launch').''. @@ -3985,28 +3998,32 @@ sub print_ltitools { sub ltitools_names { my %lt = &Apache::lonlocal::texthash( - 'title' => 'Title', - 'version' => 'Version', - 'msgtype' => 'Message Type', - 'url' => 'URL', - 'key' => 'Key', - 'secret' => 'Secret', - 'icon' => 'Icon', - 'user' => 'Username:domain', - 'fullname' => 'Full Name', - 'firstname' => 'First Name', - 'lastname' => 'Last Name', - 'email' => 'E-mail', - 'roles' => 'Role', - 'window' => 'Window/Tab', - 'iframe' => 'iFrame', - 'height' => 'Height', - 'width' => 'Width', - 'passback' => 'Tool can return grades:', - 'roster' => 'Tool can retrieve roster:', - 'crstarget' => 'Display target', - 'crslabel' => 'Course label', - 'crstitle' => 'Course title', + 'title' => 'Title', + 'version' => 'Version', + 'msgtype' => 'Message Type', + 'url' => 'URL', + 'key' => 'Key', + 'secret' => 'Secret', + 'icon' => 'Icon', + 'user' => 'Username:domain', + 'fullname' => 'Full Name', + 'firstname' => 'First Name', + 'lastname' => 'Last Name', + 'email' => 'E-mail', + 'roles' => 'Role', + 'window' => 'Window/Tab', + 'iframe' => 'iFrame', + 'height' => 'Height', + 'width' => 'Width', + 'linktext' => 'Default Link Text', + 'explanation' => 'Default Explanation', + 'passback' => 'Tool can return grades:', + 'roster' => 'Tool can retrieve roster:', + 'crstarget' => 'Display target', + 'crslabel' => 'Course label', + 'crstitle' => 'Course title', + 'crslinktext' => 'Link Text', + 'crsexplanation' => 'Explanation', ); return %lt; } @@ -9483,11 +9500,17 @@ sub modify_ltitools { if ($env{'form.ltitools_add_msgtype'} eq 'basic-lti-launch-request') { $confhash{$newid}{'msgtype'} = $env{'form.ltitools_add_msgtype'}; } - foreach my $item ('width','height') { + foreach my $item ('width','height','linktext','explanation') { $env{'form.ltitools_add_'.$item} =~ s/^\s+//; $env{'form.ltitools_add_'.$item} =~ s/\s+$//; - if ($env{'form.ltitools_add_'.$item} =~ /^\d+$/) { - $confhash{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item}; + if (($item eq 'width') || ($item eq 'height')) { + if ($env{'form.ltitools_add_'.$item} =~ /^\d+$/) { + $confhash{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item}; + } + } else { + if ($env{'form.ltitools_add_'.$item} ne '') { + $confhash{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item}; + } } } if ($env{'form.ltitools_add_target'} eq 'window') { @@ -9599,6 +9622,28 @@ sub modify_ltitools { } else { $changes{$itemid} = 1; } + } elsif (ref($domconfig{$action}{$itemid}{'display'}) eq 'HASH') { + if ($domconfig{$action}{$itemid}{'display'}{$size} ne '') { + $changes{$itemid} = 1; + } + } + } + foreach my $item ('linktext','explanation') { + $env{'form.ltitools_'.$item.'_'.$i} =~ s/^\s+//; + $env{'form.ltitools_'.$item.'_'.$i} =~ s/\s+$//; + if ($env{'form.ltitools_'.$item.'_'.$i} ne '') { + $confhash{$itemid}{'display'}{$item} = $env{'form.ltitools_'.$item.'_'.$i}; + if (ref($domconfig{$action}{$itemid}{'display'}) eq 'HASH') { + if ($domconfig{$action}{$itemid}{'display'}{$item} ne $confhash{$itemid}{'display'}{$item}) { + $changes{$itemid} = 1; + } + } else { + $changes{$itemid} = 1; + } + } elsif (ref($domconfig{$action}{$itemid}{'display'}) eq 'HASH') { + if ($domconfig{$action}{$itemid}{'display'}{$item} ne '') { + $changes{$itemid} = 1; + } } } if ($env{'form.ltitools_target_'.$i} eq 'window') { @@ -9622,7 +9667,7 @@ sub modify_ltitools { } } my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_courseconfig_'.$i); - foreach my $item ('label','title','target') { + foreach my $item ('label','title','target','linktext','explanation') { if (grep(/^\Q$item\E$/,@courseconfig)) { $confhash{$itemid}{'crsconf'}{$item} = 1; if (ref($domconfig{$action}{$itemid}{'crsconf'}) eq 'HASH') { @@ -9798,13 +9843,13 @@ sub modify_ltitools { $resulttext .= ('*'x$num).''; } $resulttext .= '
  • '.&mt('Configurable in course:'); - my @possconfig = ('label','title','target'); + my @possconfig = ('label','title','target','linktext','explanation'); my $numconfig = 0; if (ref($confhash{$itemid}{'crsconf'}) eq 'HASH') { foreach my $item (@possconfig) { if ($confhash{$itemid}{'crsconf'}{$item}) { $numconfig ++; - $resulttext .= ' '.$lt{'crs'.$item}; + $resulttext .= ' "'.$lt{'crs'.$item}.'"'; } } } @@ -9837,7 +9882,12 @@ sub modify_ltitools { $displaylist =~ s/,$//; $resulttext .= '
  • '.$displaylist.'
  • '; } - } + foreach my $item ('linktext','explanation') { + if ($confhash{$itemid}{'display'}{$item}) { + $resulttext .= '
  • '.$lt{$item}.': '.$confhash{$itemid}{'display'}{$item}.'
  • '; + } + } + } if (ref($confhash{$itemid}{'fields'}) eq 'HASH') { my $fieldlist; foreach my $field (@allfields) {