--- loncom/interface/londocs.pm 2016/05/09 02:25:33 1.603 +++ loncom/interface/londocs.pm 2016/06/06 17:40:48 1.604 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.603 2016/05/09 02:25:33 raeburn Exp $ +# $Id: londocs.pm,v 1.604 2016/06/06 17:40:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -619,32 +619,82 @@ sub group_import { $url = $1; my $marker = $2; my $info = $3; - my ($toolid,%toolhash); + my ($toolid,%toolhash,%toolsettings); my @toolinfo = split(/:/,$info); if ($residx) { - my %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum); + %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum); $toolid = $toolsettings{'id'}; } else { - $toolid = shift(@toolinfo); + $toolid = shift(@toolinfo); } $toolid =~ s/\D//g; - ($toolhash{'target'},$toolhash{'width'},$toolhash{'height'}) = @toolinfo; + ($toolhash{'target'},$toolhash{'width'},$toolhash{'height'}, + $toolhash{'crslabel'},$toolhash{'crstitle'}) = @toolinfo; + $toolhash{'crslabel'} = &unescape($toolhash{'crslabel'}); + $toolhash{'crstitle'} = &unescape($toolhash{'crstitle'}); if (ref($ltitoolsref) eq 'HASH') { + my @deleted; if (ref($ltitoolsref->{$toolid}) eq 'HASH') { if ($ltitoolsref->{$toolid}->{'url'} =~ m{^https://}) { $url =~ s/exttool$/exttools/; } $toolhash{'id'} = $toolid; + if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'window')) { + if ($toolhash{'target'} eq 'window') { + foreach my $item ('width','height') { + $toolhash{$item} =~ s/^\s+//; + $toolhash{$item} =~ s/\s+$//; + } + } + } elsif ($residx) { + $toolhash{'target'} = $toolsettings{'target'}; + if ($toolhash{'target'} eq 'window') { + $toolhash{'width'} = $toolsettings{'width'}; + $toolhash{'height'} = $toolsettings{'height'}; + } + } elsif (ref($ltitoolsref->{$toolid}->{'display'}) eq 'HASH') { + $toolhash{'target'} = $ltitoolsref->{$toolid}->{'display'}->{'target'}; + if ($toolhash{'target'} eq 'window') { + $toolhash{'width'} = $ltitoolsref->{$toolid}->{'display'}->{'width'}; + $toolhash{'height'} = $ltitoolsref->{$toolid}->{'display'}->{'height'}; + } + } if ($toolhash{'target'} eq 'iframe') { delete($toolhash{'width'}); delete($toolhash{'height'}); - } elsif ($toolhash{'target'} eq 'window') { - foreach my $item ('width','height') { - $toolhash{$item} =~ s/^\s+//; - $toolhash{$item} =~ s/\s+$//; + if ($residx) { + if ($toolsettings{'width'}) { + push(@deleted,'width'); + } + if ($toolsettings{'height'}) { + push(@deleted,'height'); + } + } + } + if (ref($ltitoolsref->{$toolid}->{'crsconf'}) eq 'HASH') { + foreach my $item ('label','title') { + if ($ltitoolsref->{$toolid}->{'crsconf'}->{$item}) { + $toolhash{'crs'.$item} =~ s/^\s+//; + $toolhash{'crs'.$item} =~ s/\s+$//; + if ($toolhash{'crs'.$item} eq '') { + delete($toolhash{'crs'.$item}); + } + } else { + delete($toolhash{'crs'.$item}); + } + if (($residx) && (exists($toolsettings{'crs'.$item}))) { + unless (exists($toolhash{'crs'.$item})) { + push(@deleted,'crs'.$item); + } + } } } my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum); + if ($putres eq 'ok') { + if (@deleted) { + &Apache::lonnet::del('exttool_'.$marker,\@deleted,$coursedom,$coursenum); + } + } } } } @@ -4999,7 +5049,6 @@ sub handler { my $tabidstr = join("','",@tabids); %ltitools = &Apache::lonnet::get_domain_ltitools($coursedom); my $posslti = keys(%ltitools); - my $exttoolurl = "/adm/$coursedom/$coursenum/new/exttool"; $script .= &editing_js($udom,$uname,$supplementalflag,$posslti). &history_tab_js(). &inject_data_js(). @@ -5451,7 +5500,7 @@ NROSTFORM $help{'Web_Page'} NWEBFORM - + my $specialdocumentsform; my @specialdocumentsforma; @@ -6109,7 +6158,7 @@ sub editing_js { p_msb => 'Title for the Problem', p_mdb => 'Title for the Drop Box', p_mbb => 'Title for the Discussion Board', - p_mwp => 'Title for Web Page', + p_mwp => 'Title for Web Page', p_mab => "Enter user:domain for User's Personal Information Page", p_mab2 => 'Personal Information Page of ', p_mab_alrt1 => 'Not a valid user:domain',