version 1.698, 2023/03/27 18:41:04
|
version 1.699, 2023/05/22 21:10:55
|
Line 719 sub group_import {
|
Line 719 sub group_import {
|
$url = $1; |
$url = $1; |
my $marker = $2; |
my $marker = $2; |
my $info = $3; |
my $info = $3; |
my ($toolid,%toolhash,%toolsettings); |
my ($toolid,$toolprefix,$tooltype,%toolhash,%toolsettings); |
my @extras = ('linktext','explanation','crslabel','crstitle','crsappend'); |
my @extras = ('linktext','explanation','crslabel','crstitle','crsappend'); |
my @toolinfo = split(/:/,$info); |
my @toolinfo = split(/:/,$info); |
if ($residx) { |
if ($residx) { |
Line 728 sub group_import {
|
Line 728 sub group_import {
|
} else { |
} else { |
$toolid = shift(@toolinfo); |
$toolid = shift(@toolinfo); |
} |
} |
|
if ($toolid =~ /^c/) { |
|
$tooltype = 'crs'; |
|
$toolprefix = 'c'; |
|
} else { |
|
$tooltype = 'dom'; |
|
} |
$toolid =~ s/\D//g; |
$toolid =~ s/\D//g; |
($toolhash{'target'},$toolhash{'width'},$toolhash{'height'}, |
($toolhash{'target'},$toolhash{'width'},$toolhash{'height'}, |
$toolhash{'linktext'},$toolhash{'explanation'},$toolhash{'crslabel'}, |
$toolhash{'linktext'},$toolhash{'explanation'},$toolhash{'crslabel'}, |
Line 741 sub group_import {
|
Line 747 sub group_import {
|
$toolhash{'gradable'} =~ s/\D+//g; |
$toolhash{'gradable'} =~ s/\D+//g; |
} |
} |
if (ref($ltitoolsref) eq 'HASH') { |
if (ref($ltitoolsref) eq 'HASH') { |
if (ref($ltitoolsref->{$toolid}) eq 'HASH') { |
if (ref($ltitoolsref->{$tooltype}) eq 'HASH') { |
my @deleted; |
if (ref($ltitoolsref->{$tooltype}->{$toolid}) eq 'HASH') { |
$toolhash{'id'} = $toolid; |
my %tools = %{$ltitoolsref->{$tooltype}->{$toolid}}; |
if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'tab') || |
my @deleted; |
($toolhash{'target'} eq 'window')) { |
$toolhash{'id'} = $toolprefix.$toolid; |
if ($toolhash{'target'} eq 'window') { |
if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'tab') || |
foreach my $item ('width','height') { |
($toolhash{'target'} eq 'window')) { |
$toolhash{$item} =~ s/^\s+//; |
if ($toolhash{'target'} eq 'window') { |
$toolhash{$item} =~ s/\s+$//; |
foreach my $item ('width','height') { |
if ($toolhash{$item} =~ /\D/) { |
$toolhash{$item} =~ s/^\s+//; |
delete($toolhash{$item}); |
$toolhash{$item} =~ s/\s+$//; |
if ($residx) { |
if ($toolhash{$item} =~ /\D/) { |
if ($toolsettings{$item}) { |
delete($toolhash{$item}); |
push(@deleted,$item); |
if ($residx) { |
|
if ($toolsettings{$item}) { |
|
push(@deleted,$item); |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} elsif ($residx) { |
} elsif ($residx) { |
$toolhash{'target'} = $toolsettings{'target'}; |
$toolhash{'target'} = $toolsettings{'target'}; |
if ($toolhash{'target'} eq 'window') { |
if ($toolhash{'target'} eq 'window') { |
foreach my $item ('width','height') { |
foreach my $item ('width','height') { |
$toolhash{$item} = $toolsettings{$item}; |
$toolhash{$item} = $toolsettings{$item}; |
} |
|
} |
|
} elsif (ref($tools{'display'}) eq 'HASH') { |
|
$toolhash{'target'} = $tools{'display'}{'target'}; |
|
if ($toolhash{'target'} eq 'window') { |
|
$toolhash{'width'} = $tools{'display'}{'width'}; |
|
$toolhash{'height'} = $tools{'display'}{'height'}; |
} |
} |
} |
} |
} elsif (ref($ltitoolsref->{$toolid}->{'display'}) eq 'HASH') { |
if ($toolhash{'target'} eq 'iframe') { |
$toolhash{'target'} = $ltitoolsref->{$toolid}->{'display'}->{'target'}; |
foreach my $item ('width','height','linktext','explanation') { |
if ($toolhash{'target'} eq 'window') { |
delete($toolhash{$item}); |
$toolhash{'width'} = $ltitoolsref->{$toolid}->{'display'}->{'width'}; |
if ($residx) { |
$toolhash{'height'} = $ltitoolsref->{$toolid}->{'display'}->{'height'}; |
if ($toolsettings{$item}) { |
} |
push(@deleted,$item); |
} |
} |
if ($toolhash{'target'} eq 'iframe') { |
|
foreach my $item ('width','height','linktext','explanation') { |
|
delete($toolhash{$item}); |
|
if ($residx) { |
|
if ($toolsettings{$item}) { |
|
push(@deleted,$item); |
|
} |
} |
} |
} |
} |
} elsif ($toolhash{'target'} eq 'tab') { |
} elsif ($toolhash{'target'} eq 'tab') { |
foreach my $item ('width','height') { |
foreach my $item ('width','height') { |
delete($toolhash{$item}); |
delete($toolhash{$item}); |
if ($residx) { |
if ($residx) { |
if ($toolsettings{$item}) { |
if ($toolsettings{$item}) { |
push(@deleted,$item); |
push(@deleted,$item); |
} |
} |
} |
} |
} |
} |
} |
} |
if (ref($tools{'crsconf'}) eq 'HASH') { |
if (ref($ltitoolsref->{$toolid}->{'crsconf'}) eq 'HASH') { |
foreach my $item ('label','title','linktext','explanation') { |
foreach my $item ('label','title','linktext','explanation') { |
my $crsitem; |
my $crsitem; |
if (($item eq 'label') || ($item eq 'title')) { |
if (($item eq 'label') || ($item eq 'title')) { |
$crsitem = 'crs'.$item; |
$crsitem = 'crs'.$item; |
} else { |
} else { |
$crsitem = $item; |
$crsitem = $item; |
} |
} |
if ($tools{'crsconf'}{$item}) { |
if ($ltitoolsref->{$toolid}->{'crsconf'}->{$item}) { |
$toolhash{$crsitem} =~ s/^\s+//; |
$toolhash{$crsitem} =~ s/^\s+//; |
$toolhash{$crsitem} =~ s/\s+$//; |
$toolhash{$crsitem} =~ s/\s+$//; |
if ($toolhash{$crsitem} eq '') { |
if ($toolhash{$crsitem} eq '') { |
delete($toolhash{$crsitem}); |
|
} |
|
} else { |
delete($toolhash{$crsitem}); |
delete($toolhash{$crsitem}); |
} |
} |
} else { |
if (($residx) && (exists($toolsettings{$crsitem}))) { |
delete($toolhash{$crsitem}); |
unless (exists($toolhash{$crsitem})) { |
} |
push(@deleted,$crsitem); |
if (($residx) && (exists($toolsettings{$crsitem}))) { |
} |
unless (exists($toolhash{$crsitem})) { |
|
push(@deleted,$crsitem); |
|
} |
} |
} |
} |
} |
} |
} |
if ($toolhash{'passback'}) { |
if ($toolhash{'passback'}) { |
my $gradesecret = UUID::Tiny::create_uuid_as_string(UUID_V4); |
my $gradesecret = UUID::Tiny::create_uuid_as_string(UUID_V4); |
$toolhash{'gradesecret'} = $gradesecret; |
$toolhash{'gradesecret'} = $gradesecret; |
$toolhash{'gradesecretdate'} = time; |
$toolhash{'gradesecretdate'} = time; |
} |
} |
if ($toolhash{'roster'}) { |
if ($toolhash{'roster'}) { |
my $rostersecret = UUID::Tiny::create_uuid_as_string(UUID_V4); |
my $rostersecret = UUID::Tiny::create_uuid_as_string(UUID_V4); |
$toolhash{'rostersecret'} = $rostersecret; |
$toolhash{'rostersecret'} = $rostersecret; |
$toolhash{'rostersecretdate'} = time; |
$toolhash{'rostersecretdate'} = time; |
|
} |
|
my $changegradable; |
|
if (($residx) && ($folder =~ /^default/)) { |
|
if ($toolsettings{'gradable'}) { |
|
unless (($toolhash{'gradable'}) || (defined($LONCAPA::map::zombies[$residx]))) { |
|
push(@deleted,'gradable'); |
|
$changegradable = 1; |
|
} |
|
} elsif ($toolhash{'gradable'}) { |
|
$changegradable = 1; |
|
} |
} |
if (($caller eq 'londocs') && (defined($LONCAPA::map::zombies[$residx]))) { |
my $changegradable; |
$changegradable = 1; |
if (($residx) && ($folder =~ /^default/)) { |
if ($toolsettings{'gradable'}) { |
if ($toolsettings{'gradable'}) { |
$toolhash{'gradable'} = 1; |
unless (($toolhash{'gradable'}) || (defined($LONCAPA::map::zombies[$residx]))) { |
|
push(@deleted,'gradable'); |
|
$changegradable = 1; |
|
} |
|
} elsif ($toolhash{'gradable'}) { |
|
$changegradable = 1; |
|
} |
|
if (($caller eq 'londocs') && (defined($LONCAPA::map::zombies[$residx]))) { |
|
$changegradable = 1; |
|
if ($toolsettings{'gradable'}) { |
|
$toolhash{'gradable'} = 1; |
|
} |
} |
} |
} |
} |
} |
my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum); |
my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum); |
if ($putres eq 'ok') { |
if ($putres eq 'ok') { |
if (@deleted) { |
if (@deleted) { |
&Apache::lonnet::del('exttool_'.$marker,\@deleted,$coursedom,$coursenum); |
&Apache::lonnet::del('exttool_'.$marker,\@deleted,$coursedom,$coursenum); |
} |
} |
if (($changegradable) && ($folder =~ /^default/)) { |
if (($changegradable) && ($folder =~ /^default/)) { |
my $val; |
my $val; |
if ($toolhash{'gradable'}) { |
if ($toolhash{'gradable'}) { |
$val = 'yes'; |
$val = 'yes'; |
} else { |
} else { |
$val = 'no'; |
$val = 'no'; |
} |
|
&LONCAPA::map::storeparameter($residx,'parameter_0_gradable',$val, |
|
'string_yesno'); |
|
&remember_parms($residx,'gradable','set',$val); |
} |
} |
&LONCAPA::map::storeparameter($residx,'parameter_0_gradable',$val, |
} else { |
'string_yesno'); |
return (&mt('Failed to save update to external tool.'),1); |
&remember_parms($residx,'gradable','set',$val); |
|
} |
} |
} else { |
|
return (&mt('Failed to save update to external tool.'),1); |
|
} |
} |
} |
} |
} |
} |
Line 5725 sub handler {
|
Line 5734 sub handler {
|
my $containertag; |
my $containertag; |
my $pathitem; |
my $pathitem; |
my %ltitools; |
my %ltitools; |
|
my $posslti; |
my $hiddentop; |
my $hiddentop; |
my $navmap; |
my $navmap; |
my $filterFunc = sub { my $res = shift; return (!$res->randomout() && !$res->is_map()) }; |
my $filterFunc = sub { my $res = shift; return (!$res->randomout() && !$res->is_map()) }; |
Line 5958 sub handler {
|
Line 5968 sub handler {
|
} |
} |
} |
} |
my $tabidstr = join("','",@tabids); |
my $tabidstr = join("','",@tabids); |
%ltitools = &Apache::lonnet::get_domain_lti($coursedom,'consumer'); |
my (%domtools,%crstools); |
my $posslti = keys(%ltitools); |
my %tooltypes = &Apache::loncommon::usable_exttools(); |
|
if ($tooltypes{'dom'}) { |
|
%domtools = &Apache::lonnet::get_domain_lti($coursedom,'consumer'); |
|
} |
|
if ($tooltypes{'crs'}) { |
|
%crstools = &Apache::lonnet::get_course_lti($coursenum,$coursedom,'consumer'); |
|
} |
|
%ltitools = ( |
|
dom => \%domtools, |
|
crs => \%crstools, |
|
); |
|
$posslti = scalar(keys(%domtools)) + scalar(keys(%crstools)); |
my $hostname = $r->hostname(); |
my $hostname = $r->hostname(); |
$script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti, |
$script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti, |
$londocroot,$canedit,$hostname,\$navmap). |
$londocroot,$canedit,$hostname,\$navmap). |
Line 6316 SEDFFORM
|
Line 6337 SEDFFORM
|
<input type="hidden" name="active" value="bb" /> |
<input type="hidden" name="active" value="bb" /> |
$pickfile |
$pickfile |
<p> |
<p> |
$lt{'title'}: <input type="textbox" name="crsrestitle" value="" $disabled /> |
$lt{'title'}: <input type="text" name="crsrestitle" value="" $disabled /> |
</p> |
</p> |
<input type="hidden" name="importdetail" value="" /> |
<input type="hidden" name="importdetail" value="" /> |
<input type="submit" name="crsres" value="$lt{'impo'}" $disabled /><br /> |
<input type="submit" name="crsres" value="$lt{'impo'}" $disabled /><br /> |
Line 6660 NWEBFORM
|
Line 6681 NWEBFORM
|
<label><input type="radio" name="newsubdir" value="1" onclick="toggleNewsubdir(this.form);" $disabled />Yes</label> |
<label><input type="radio" name="newsubdir" value="1" onclick="toggleNewsubdir(this.form);" $disabled />Yes</label> |
</span><span id="newsubdir"></span> |
</span><span id="newsubdir"></span> |
<input type="hidden" name="newsubdirname" id="newsubdirname" value="" autocomplete="off" /> |
<input type="hidden" name="newsubdirname" id="newsubdirname" value="" autocomplete="off" /> |
|
</div> |
</p> |
</p> |
$lt{'fnam'} |
$lt{'fnam'} |
<input type="text" size="20" name="newresourcename" autocomplete="off" $disabled /> |
<input type="text" size="20" name="newresourcename" autocomplete="off" $disabled /> |
Line 6770 NGFFORM
|
Line 6792 NGFFORM
|
my @external = ( |
my @external = ( |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleExternal(\'ext\');" />'=>$extresourcesform} |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleExternal(\'ext\');" />'=>$extresourcesform} |
); |
); |
if (keys(%ltitools)) { |
if ($posslti) { |
push(@external, |
push(@external, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/exttool.png" alt="'.$lt{extt}.'" onclick="toggleExternal(\'tool\');" />'=>$exttoolform}, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/exttool.png" alt="'.$lt{extt}.'" onclick="toggleExternal(\'tool\');" />'=>$exttoolform}, |
); |
); |
Line 6953 my @specialdocs = (
|
Line 6975 my @specialdocs = (
|
my @supexternal = ( |
my @supexternal = ( |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:toggleExternal(\'suppext\')" />' |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:toggleExternal(\'suppext\')" />' |
=>$supextform}); |
=>$supextform}); |
if (keys(%ltitools)) { |
if ($posslti) { |
push(@supexternal, |
push(@supexternal, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/exttool.png" alt="'.$lt{extt}.'" onclick="javascript:toggleExternal(\'supptool\')" />' |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/exttool.png" alt="'.$lt{extt}.'" onclick="javascript:toggleExternal(\'supptool\')" />' |
=>$supexttoolform}); |
=>$supexttoolform}); |