--- loncom/homework/lonhomework.pm 2016/09/20 19:28:08 1.366 +++ loncom/homework/lonhomework.pm 2017/12/22 02:00:39 1.369 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.366 2016/09/20 19:28:08 raeburn Exp $ +# $Id: lonhomework.pm,v 1.369 2017/12/22 02:00:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -190,7 +190,7 @@ sub proctor_checked_in { if ($type eq 'Task') { my $version=$Apache::lonhomework::history{'resource.0.version'}; $key ="resource.$version.0.checkedin"; - } elsif ($type eq 'problem') { + } elsif (($type eq 'problem') || ($type eq 'tool')) { $key ='resource.0.checkedin'; } # backward compatability, used to be username@domain, @@ -205,7 +205,6 @@ sub proctor_checked_in { return 1; } } - return 0; } @@ -350,7 +349,7 @@ sub check_slot_access { $is_correct = ($Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass' || $Apache::lonhomework::history{"resource.0.solved"} =~ /^correct_/ ); - } elsif ($type eq 'problem') { + } elsif (($type eq 'problem') || ($type eq 'tool')) { if ((ref($partlist) eq 'ARRAY') && (@{$partlist} > 0)) { my ($numcorrect,$numgraded) = (0,0); foreach my $part (@{$partlist}) { @@ -410,7 +409,7 @@ sub check_slot_access { # used to gain access to it to work on it, until the due date is reached, and the # problem then becomes CLOSED. Therefore return the slotstatus - # (which will be one of: NOT_IN_A_SLOT, RESERVABLE, RESERVABLE_LATER, or NOTRESERVABLE). - if (!defined($slot_name) && $type eq 'problem') { + if (!defined($slot_name) && (($type eq 'problem') || ($type eq 'tool'))) { if ($slotstatus eq 'NOT_IN_A_SLOT') { if (!$num_usable_slots) { if ($env{'request.course.id'}) { @@ -501,7 +500,7 @@ sub check_slot_access { } if (($is_correct) && ($blockip ne 'answer')) { - if ($type eq 'problem') { + if (($type eq 'problem') || ($type eq 'tool')) { return ($status); } return ('SHOW_ANSWER'); @@ -1807,16 +1806,15 @@ sub default_xml_tag { sub helpmenu_datastructure { - my $width = 500; - my $height = 600; - + # filename, title, width, height my $helpers = [ - ['Problem_LON-CAPA_Functions', &mt('Script Functions')], - ['Greek_Symbols', &mt('Greek Symbols')], - ['Other_Symbols', &mt('Other Symbols')], - ['Authoring_Output_Tags', &mt('Output Tags')], - ['Authoring_Multilingual_Problems', - &mt('How to create problems in different languages')] + ['Problem_LON-CAPA_Functions.hlp', &mt('Script Functions'), 800, 600], + ['Greek_Symbols.hlp', &mt('Greek Symbols'), 500, 600], + ['Other_Symbols.hlp', &mt('Other Symbols'), 500, 600], + ['Authoring_Output_Tags.hlp', &mt('Output Tags'), 800, 600], + ['Authoring_Multilingual_Problems.hlp', + &mt('How to create problems in different languages'), 800, 600], + ['loncapa.html', &mt('Language reference'), 800, 600], ]; my $help_structure = []; @@ -1824,7 +1822,15 @@ sub helpmenu_datastructure { foreach my $count (0..(scalar(@{$helpers})-1)) { my $filename = $helpers->[$count]->[0]; my $title = $helpers->[$count]->[1]; - my $href = &HTML::Entities::encode("javascript:openMyModal('/adm/help/$filename.hlp',$width,$height,'yes');"); + my $width = $helpers->[$count]->[2]; + my $height = $helpers->[$count]->[3]; + if ($width eq '') { + $width = 500; + } + if ($height eq '') { + $height = 600; + } + my $href = &HTML::Entities::encode("javascript:openMyModal('/adm/help/$filename',$width,$height,'yes');"); push @{$help_structure}, [$href, $title, undef]; }