--- loncom/interface/londocs.pm 2017/11/30 02:17:50 1.643 +++ loncom/interface/londocs.pm 2017/12/29 15:04:11 1.646 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.643 2017/11/30 02:17:50 raeburn Exp $ +# $Id: londocs.pm,v 1.646 2017/12/29 15:04:11 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -45,6 +45,7 @@ use Apache::lontemplate(); use Apache::lonsimplepage(); use Apache::lonhomework(); use Apache::lonpublisher(); +use Apache::lonparmset(); use HTML::Entities; use HTML::TokeParser; use GDBM_File; @@ -670,11 +671,14 @@ sub group_import { } $toolid =~ s/\D//g; ($toolhash{'target'},$toolhash{'width'},$toolhash{'height'}, - $toolhash{'linktext'},$toolhash{'explanation'}, - $toolhash{'crslabel'},$toolhash{'crstitle'},$toolhash{'crsappend'}) = @toolinfo; + $toolhash{'linktext'},$toolhash{'explanation'},$toolhash{'crslabel'}, + $toolhash{'crstitle'},$toolhash{'crsappend'},$toolhash{'gradable'}) = @toolinfo; foreach my $item (@extras) { $toolhash{$item} = &unescape($toolhash{$item}); } + if ($folder =~ /^supplemental/) { + delete($toolhash{'gradable'}); + } if (ref($ltitoolsref) eq 'HASH') { if (ref($ltitoolsref->{$toolid}) eq 'HASH') { my @deleted; @@ -762,11 +766,35 @@ sub group_import { $toolhash{'rostersecret'} = $rostersecret; $toolhash{'rostersecretdate'} = time; } + my $changegradable; + if (($residx) && ($folder =~ /^default/)) { + if (exists($toolsettings{'gradable'})) { + if (!exists($toolhash{'gradable'})) { + push(@deleted,'gradable'); + $changegradable = 1; + } + } elsif (exists($toolhash{'gradable'})) { + $changegradable = 1; + } + } my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum); if ($putres eq 'ok') { if (@deleted) { &Apache::lonnet::del('exttool_'.$marker,\@deleted,$coursedom,$coursenum); - } + } + if (($changegradable) && ($folder =~ /^default/)) { + my $val; + if ($toolhash{'gradable'}) { + $val = 'yes'; + } else { + $val = 'no'; + } + &LONCAPA::map::storeparameter($residx,'parameter_0_gradable',$val, + 'string_yesno'); + &remember_parms($residx,'gradable','set',$val); + } + } else { + return (&mt('Failed to save update to external tool.'),1); } } } @@ -1004,6 +1032,7 @@ sub docs_change_log { 'encrypturl' => 'URL hidden', 'randompick' => 'Randomly pick', 'randomorder' => 'Randomly ordered', + 'gradable' => 'Grade can be assigned to External Tool', 'set' => 'set to', 'del' => 'deleted'); my $filter = &Apache::loncommon::display_filter('docslog')."\n". @@ -1111,7 +1140,7 @@ sub docs_change_log { $r->print(''); if ($docslog{$id}{'logentry'}{'parameter_res'}) { $r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.