--- loncom/homework/inputtags.pm 2011/07/12 12:55:50 1.292 +++ loncom/homework/inputtags.pm 2011/12/08 02:59:34 1.297 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.292 2011/07/12 12:55:50 christianto Exp $ +# $Id: inputtags.pm,v 1.297 2011/12/08 02:59:34 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -571,7 +571,7 @@ sub file_selector { if ($which eq 'uploadonly' || $which eq 'both') { $result.=&mt('Submit a file: (only one file per submission)'). '

'; + $jspart.'_'.$id.'" id="HWFILE'.$jspart.'_'.$id.'" />
'; } if ( $which eq 'both') { $result.='
'.''.&mt('OR:').'
'; @@ -843,6 +843,26 @@ sub finalizeawards { } } +sub grading_is_nonlenient { + my ($part) = @_; +# Web mode: we are non-lenient unless told otherwise + my $defaultparm = 'off'; + my $nonlenient = 0; +# Grading a bubblesheet exam: we are grading lenient unless told otherwise + if ($Apache::lonhomework::scantronmode) { + $defaultparm = 'on'; + $nonlenient = 1; + } + my $lenientparm = + &Apache::response::get_response_param($part,'lenient',$defaultparm); + if ($lenientparm=~/^0|off|no$/i) { + $nonlenient = 1; + } elsif ($lenientparm=~/^1|on|yes$/i) { + $nonlenient = 0; + } + return $nonlenient; +} + sub decideoutput { my ($award,$awarded,$awardmsg,$solved,$previous,$target,$nocorrect)=@_; @@ -911,7 +931,13 @@ sub decideoutput { } } } - if ($awarded==1) { $button=0; } else { $button=1; } + if (&grading_is_nonlenient($part)) { + $button=0; + } elsif ($awarded==1) { + $button=0; + } else { + $button=1; + } $previousmsg=''; } elsif ($solved =~ /^excused/) { if ($target eq 'tex') { @@ -1459,7 +1485,7 @@ sub get_grade_messages { $trial.="/".$Apache::inputtags::params{'maxtries'}; } } - $trystr = ''.&mt($tries_text.' [_1]',$trial).''; + $trystr = ''.&mt($tries_text.' [_1]',$trial).''; } } @@ -1580,7 +1606,7 @@ sub previous_tries { {$1 $txt_correct. $3}s; } my $trystr = "(".&mt('Try [_1]',$Apache::lonhomework::history{"$prefix.tries"}).")"; - if ($curr_rndseed || $lastrndseed) { + if (($curr_rndseed || $lastrndseed) && ($i > 1)) { if ($curr_rndseed ne $lastrndseed) { $trystr .= '
'.&mt('New problem variation this try.').''; } @@ -1621,12 +1647,12 @@ sub previous_tries { ''.''.&mt('Submission #').''.&mt('Try'). ''. &mt('Submitted Answer').''; - $output =''.$headers.$output.'
'; + $output =&Apache::loncommon::start_scrollbox('420px','400px','400px'). + ''.$headers.$output.'
'. + &Apache::loncommon::end_scrollbox(); #return $output; $output = &Apache::loncommon::js_ready($output); - $output.='
'; - my $windowopen=&Apache::lonhtmlcommon::javascript_docopen(); my $tries_text = &get_tries_text('link'); my $start_page = &Apache::loncommon::start_page($tries_text, undef, @@ -1640,13 +1666,8 @@ sub previous_tries { $prefix =~ tr{.}{_}; my $function_name = "LONCAPA_previous_tries_".$prefix. $Apache::lonxml::curdepth.'_'.$env{'form.counter'}; - my $result ="".&mt($tries_text)."
"; - #use Data::Dumper; - #&Apache::lonnet::logthis(&Dumper(\%Apache::inputtags::submission_display)); + my $result = &Apache::loncommon::modal_adhoc_script($function_name,420,410,$start_page.$output.$end_page). + "".&mt($tries_text)."
"; return $result; }