--- loncom/interface/londocs.pm 2017/03/08 02:51:07 1.623 +++ loncom/interface/londocs.pm 2017/04/25 22:18:59 1.624 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.623 2017/03/08 02:51:07 raeburn Exp $ +# $Id: londocs.pm,v 1.624 2017/04/25 22:18:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -659,6 +659,7 @@ sub group_import { my $marker = $2; my $info = $3; my ($toolid,%toolhash,%toolsettings); + my @extras = ('linktext','explanation','crslabel','crstitle'); my @toolinfo = split(/:/,$info); if ($residx) { %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum); @@ -668,9 +669,11 @@ sub group_import { } $toolid =~ s/\D//g; ($toolhash{'target'},$toolhash{'width'},$toolhash{'height'}, + $toolhash{'linktext'},$toolhash{'explanation'}, $toolhash{'crslabel'},$toolhash{'crstitle'}) = @toolinfo; - $toolhash{'crslabel'} = &unescape($toolhash{'crslabel'}); - $toolhash{'crstitle'} = &unescape($toolhash{'crstitle'}); + foreach my $item (@extras) { + $toolhash{$item} = &unescape($toolhash{$item}); + } if (ref($ltitoolsref) eq 'HASH') { my @deleted; if (ref($ltitoolsref->{$toolid}) eq 'HASH') { @@ -683,13 +686,22 @@ sub group_import { foreach my $item ('width','height') { $toolhash{$item} =~ s/^\s+//; $toolhash{$item} =~ s/\s+$//; + if ($toolhash{$item} =~ /\D/) { + delete($toolhash{$item}); + if ($residx) { + if ($toolsettings{$item}) { + push(@deleted,$item); + } + } + } } } } elsif ($residx) { $toolhash{'target'} = $toolsettings{'target'}; if ($toolhash{'target'} eq 'window') { - $toolhash{'width'} = $toolsettings{'width'}; - $toolhash{'height'} = $toolsettings{'height'}; + foreach my $item ('width','height') { + $toolhash{$item} = $toolsettings{$item}; + } } } elsif (ref($ltitoolsref->{$toolid}->{'display'}) eq 'HASH') { $toolhash{'target'} = $ltitoolsref->{$toolid}->{'display'}->{'target'}; @@ -699,31 +711,35 @@ sub group_import { } } if ($toolhash{'target'} eq 'iframe') { - delete($toolhash{'width'}); - delete($toolhash{'height'}); - if ($residx) { - if ($toolsettings{'width'}) { - push(@deleted,'width'); - } - if ($toolsettings{'height'}) { - push(@deleted,'height'); + foreach my $item ('width','height','linktext','explanation') { + delete($toolhash{$item}); + if ($residx) { + if ($toolsettings{$item}) { + push(@deleted,$item); + } } } } if (ref($ltitoolsref->{$toolid}->{'crsconf'}) eq 'HASH') { - foreach my $item ('label','title') { + foreach my $item ('label','title','linktext','explanation') { + my $crsitem; + if (($item eq 'label') || ($item eq 'title')) { + $crsitem = 'crs'.$item; + } else { + $crsitem = $item; + } if ($ltitoolsref->{$toolid}->{'crsconf'}->{$item}) { - $toolhash{'crs'.$item} =~ s/^\s+//; - $toolhash{'crs'.$item} =~ s/\s+$//; - if ($toolhash{'crs'.$item} eq '') { - delete($toolhash{'crs'.$item}); + $toolhash{$crsitem} =~ s/^\s+//; + $toolhash{$crsitem} =~ s/\s+$//; + if ($toolhash{$crsitem} eq '') { + delete($toolhash{$crsitem}); } } else { - delete($toolhash{'crs'.$item}); + delete($toolhash{$crsitem}); } - if (($residx) && (exists($toolsettings{'crs'.$item}))) { - unless (exists($toolhash{'crs'.$item})) { - push(@deleted,'crs'.$item); + if (($residx) && (exists($toolsettings{$crsitem}))) { + unless (exists($toolhash{$crsitem})) { + push(@deleted,$crsitem); } } }