version 1.271.2.9, 2011/10/10 17:47:58
|
version 1.294, 2011/10/08 19:12:19
|
Line 354 sub start_textline {
|
Line 354 sub start_textline {
|
unless ($newvariation) { |
unless ($newvariation) { |
$oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"}; |
$oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"}; |
&Apache::lonxml::debug("oldresponse $oldresponse is ".ref($oldresponse)); |
&Apache::lonxml::debug("oldresponse $oldresponse is ".ref($oldresponse)); |
|
|
if (ref($oldresponse) eq 'ARRAY') { |
if (ref($oldresponse) eq 'ARRAY') { |
$oldresponse = $oldresponse->[$#Apache::inputtags::inputlist]; |
$oldresponse = $oldresponse->[$#Apache::inputtags::inputlist]; |
} |
} |
Line 479 sub end_hiddenline {
|
Line 478 sub end_hiddenline {
|
return ""; |
return ""; |
} |
} |
|
|
|
|
sub start_hiddensubmission { |
sub start_hiddensubmission { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $result = ""; |
my $result = ""; |
Line 571 sub file_selector {
|
Line 571 sub file_selector {
|
if ($which eq 'uploadonly' || $which eq 'both') { |
if ($which eq 'uploadonly' || $which eq 'both') { |
$result.=&mt('Submit a file: (only one file per submission)'). |
$result.=&mt('Submit a file: (only one file per submission)'). |
' <br /><input type="file" size="50" name="HWFILE'. |
' <br /><input type="file" size="50" name="HWFILE'. |
$jspart.'_'.$id.'" /><br />'; |
$jspart.'_'.$id.'" id="HWFILE'.$jspart.'_'.$id.'" /><br />'; |
} |
} |
if ( $which eq 'both') { |
if ( $which eq 'both') { |
$result.='<br />'.'<strong>'.&mt('OR:').'</strong><br />'; |
$result.='<br />'.'<strong>'.&mt('OR:').'</strong><br />'; |
Line 728 sub valid_award {
|
Line 728 sub valid_award {
|
'UNIT_FAIL', 'NO_UNIT', |
'UNIT_FAIL', 'NO_UNIT', |
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', |
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', |
'BAD_FORMULA', 'NOT_FUNCTION', 'WRONG_FORMAT', |
'BAD_FORMULA', 'NOT_FUNCTION', 'WRONG_FORMAT', |
'INTERNAL_ERROR', 'SIG_FAIL', 'INCORRECT', |
'INTERNAL_ERROR', 'SIG_FAIL', 'INCORRECT', |
'MISORDERED_RANK', 'INVALID_FILETYPE', |
'MISORDERED_RANK', 'INVALID_FILETYPE', |
'EXCESS_FILESIZE', 'FILENAME_INUSE', |
'EXCESS_FILESIZE', 'FILENAME_INUSE', |
'DRAFT', 'SUBMITTED', 'SUBMITTED_CREDIT', |
'DRAFT', 'SUBMITTED', 'SUBMITTED_CREDIT', |
Line 746 sub valid_award {
|
Line 746 sub valid_award {
|
'UNIT_INVALID_INSTRUCTOR', 'UNIT_INVALID_STUDENT', |
'UNIT_INVALID_INSTRUCTOR', 'UNIT_INVALID_STUDENT', |
'UNIT_IRRECONCIBLE', 'UNIT_FAIL', 'NO_UNIT', |
'UNIT_IRRECONCIBLE', 'UNIT_FAIL', 'NO_UNIT', |
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', 'NOT_FUNCTION', |
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', 'NOT_FUNCTION', |
'WRONG_FORMAT', 'INTERNAL_ERROR', |
'WRONG_FORMAT', 'INTERNAL_ERROR', |
'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK', |
'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK', |
'INVALID_FILETYPE', 'EXCESS_FILESIZE', 'FILENAME_INUSE', |
'INVALID_FILETYPE', 'EXCESS_FILESIZE', 'FILENAME_INUSE', |
'DRAFT', 'SUBMITTED', |
'DRAFT', 'SUBMITTED', |
Line 862 sub decideoutput {
|
Line 862 sub decideoutput {
|
my $part = $Apache::inputtags::part; |
my $part = $Apache::inputtags::part; |
my $tohandgrade = &Apache::lonnet::EXT("resource.$part.handgrade"); |
my $tohandgrade = &Apache::lonnet::EXT("resource.$part.handgrade"); |
my $handgrade = ('yes' eq lc($tohandgrade)); |
my $handgrade = ('yes' eq lc($tohandgrade)); |
|
|
# |
# |
# Should "Computer's Answer" be displayed? |
# Should "Computer's Answer" be displayed? |
# Should not be displayed if still answerable, |
# Should not be displayed if still answerable, |
# if the problem is handgraded, |
# if the problem is handgraded, |
# or if the problem does not give a correct answer |
# or if the problem does not give a correct answer |
# |
# |
|
|
my $computer = ($handgrade || $nocorrect)? '' |
my $computer = ($handgrade || $nocorrect)? '' |
: " ".&mt("Computer's answer now shown above."); |
: " ".&mt("Computer's answer now shown above."); |
&Apache::lonxml::debug("handgrade has :$handgrade:"); |
&Apache::lonxml::debug("handgrade has :$handgrade:"); |
Line 886 sub decideoutput {
|
Line 886 sub decideoutput {
|
$css_class=$possible_class{'charged_try'}; |
$css_class=$possible_class{'charged_try'}; |
} |
} |
if ($handgrade || |
if ($handgrade || |
($env{'request.filename'}=~ m{/res/lib/templates/(examupload|DropBox)\.problem$})) { |
($env{'request.filename'}=~/\/res\/lib\/templates\/(examupload|DropBox).problem$/)) { |
$message = &mt("A score has been assigned."); |
$message = &mt("A score has been assigned."); |
$added_computer_text=1; |
$added_computer_text=1; |
} else { |
} else { |
Line 911 sub decideoutput {
|
Line 911 sub decideoutput {
|
} |
} |
} |
} |
} |
} |
$button=0; |
if ($awarded==1) { $button=0; } else { $button=1; } |
$previousmsg=''; |
$previousmsg=''; |
} elsif ($solved =~ /^excused/) { |
} elsif ($solved =~ /^excused/) { |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
Line 1047 sub decideoutput {
|
Line 1047 sub decideoutput {
|
$message = &mt("Wrong format").'.'; |
$message = &mt("Wrong format").'.'; |
$css_class=$possible_class{'not_charged_try'}; |
$css_class=$possible_class{'not_charged_try'}; |
$button=1; |
$button=1; |
} elsif ($award eq 'INTERNAL_ERROR') { |
} elsif ($award eq 'INTERNAL_ERROR') { |
$message = &mt("An internal error occurred while processing your answer. Please try again later."); |
$message = &mt("An internal error occurred while processing your answer. Please try again later."); |
$css_class=$possible_class{'not_charged_try'}; |
$css_class=$possible_class{'not_charged_try'}; |
$button=1; |
$button=1; |
Line 1137 sub decideoutput {
|
Line 1137 sub decideoutput {
|
} |
} |
$message.=&mt('Submissions to practice problems are not permanently recorded.'); |
$message.=&mt('Submissions to practice problems are not permanently recorded.'); |
} |
} |
|
|
return ($button,$css_class,$message,$previousmsg); |
return ($button,$css_class,$message,$previousmsg); |
} |
} |
|
|
Line 1190 sub setgradedata {
|
Line 1189 sub setgradedata {
|
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') { |
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') { |
$Apache::lonhomework::results{"resource.$id.afterduedate"}=$award; |
$Apache::lonhomework::results{"resource.$id.afterduedate"}=$award; |
return ''; |
return ''; |
} elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~ |
} elsif ( $Apache::lonhomework::history{"resource.$id.awarded"} < 1 |
/^correct/ |
|
|| $Apache::lonhomework::scantronmode |
|| $Apache::lonhomework::scantronmode |
|| &Apache::lonhomework::hide_problem_status() ) { |
|| &Apache::lonhomework::hide_problem_status() ) { |
# the student doesn't already have it correct, |
# the student doesn't already have it correct, |
Line 1312 sub setgradedata {
|
Line 1310 sub setgradedata {
|
$Apache::lonhomework::results{"resource.$id.previous"} = '0'; |
$Apache::lonhomework::results{"resource.$id.previous"} = '0'; |
} |
} |
} |
} |
} elsif ( $Apache::lonhomework::history{"resource.$id.solved"} =~ |
} elsif ( $Apache::lonhomework::history{"resource.$id.awarded"} == 1 ) { |
/^correct/ ) { |
|
#delete all data as they student already has it correct |
#delete all data as they student already has it correct |
&removealldata($id); |
&removealldata($id); |
#and since they didn't do anything we were never here |
#and since they didn't do anything we were never here |
Line 1323 sub setgradedata {
|
Line 1320 sub setgradedata {
|
if ($award eq 'SUBMITTED') { |
if ($award eq 'SUBMITTED') { |
&Apache::response::add_to_gradingqueue(); |
&Apache::response::add_to_gradingqueue(); |
} |
} |
if (($Apache::lonhomework::type eq 'anonsurvey') || |
$Apache::lonhomework::results{"resource.$id.type"} = $Apache::lonhomework::type; |
($Apache::lonhomework::type eq 'anonsurveycred') || |
$Apache::lonhomework::results{"resource.$id.duedate"} = &Apache::lonnet::EXT("resource.$id.duedate"); |
($Apache::lonhomework::type eq 'randomizetry')) { |
$Apache::lonhomework::results{"resource.$id.hinttries"} = &Apache::lonnet::EXT("resource.$id.hinttries"); |
$Apache::lonhomework::results{"resource.$id.type"} = $Apache::lonhomework::type; |
$Apache::lonhomework::results{"resourse.$id.version"} = &Apache::lonnet::usedversion(); |
} |
|
if ($Apache::lonhomework::type eq 'randomizetry') { |
|
$Apache::lonhomework::results{"resource.$id.rndseed"} = $env{'form.'.$id.'.rndseed'}; |
|
} |
|
} |
} |
|
|
sub find_which_previous { |
sub find_which_previous { |
Line 1449 sub get_grade_messages {
|
Line 1442 sub get_grade_messages {
|
if ($env{'request.state'} ne "construct" |
if ($env{'request.state'} ne "construct" |
&& $Apache::lonhomework::type ne 'exam' |
&& $Apache::lonhomework::type ne 'exam' |
&& $env{'form.suppress_tries'} ne 'yes') { |
&& $env{'form.suppress_tries'} ne 'yes') { |
$trystr ='{\vskip 1 mm \small ' |
$trystr ='{\vskip 1 mm \small ' |
.&mt('[_1]'.$tries_text.'[_2] [_3]' |
.&mt('[_1]'.$tries_text.'[_2] [_3]' |
,'\textit{','}',$tries.'/'.$maxtries ) |
,'\textit{','}',$tries.'/'.$maxtries ) |
.'} \vskip 2 mm'; |
.'} \vskip 2 mm'; |
} else { |
} else { |
$trystr = '\vskip 0 mm '; |
$trystr = '\vskip 0 mm '; |
} |
} |
} else { |
} else { |
my $trial = $tries; |
my $trial =$tries; |
if ($Apache::lonhomework::parsing_a_task) { |
if ($Apache::lonhomework::parsing_a_task) { |
} elsif($env{'request.state'} ne 'construct') { |
} elsif($env{'request.state'} ne 'construct') { |
$trial.="/$maxtries"; |
$trial.="/".&Apache::lonhtmlcommon::direct_parm_link($maxtries,$env{'request.symb'},'maxtries',$id,$target); |
} else { |
} else { |
if (defined($Apache::inputtags::params{'maxtries'})) { |
if (defined($Apache::inputtags::params{'maxtries'})) { |
$trial.="/".$Apache::inputtags::params{'maxtries'}; |
$trial.="/".$Apache::inputtags::params{'maxtries'}; |
} |
} |
} |
} |
$trystr.='<td><span class="LC_nobreak">'.&mt("$tries_text [_1]",$trial).'</span></td>'; |
$trystr = '<td><span class="LC_nobreak">'.&mt($tries_text.' [_1]',$trial).'</span.</td>'; |
} |
} |
} |
} |
|
|
Line 1556 sub previous_tries {
|
Line 1549 sub previous_tries {
|
$count++; |
$count++; |
$count_lookup{$i} = $count; |
$count_lookup{$i} = $count; |
my $curr_rndseed = $Apache::lonhomework::history{"$prefix.rndseed"}; |
my $curr_rndseed = $Apache::lonhomework::history{"$prefix.rndseed"}; |
|
|
my ($previousmsg,$latemessage,$message,$trystr); |
my ($previousmsg,$latemessage,$message,$trystr); |
|
|
($previousmsg,$latemessage,$message,$trystr) = |
($previousmsg,$latemessage,$message,$trystr) = |
Line 1592 sub previous_tries {
|
Line 1584 sub previous_tries {
|
if ($curr_rndseed ne $lastrndseed) { |
if ($curr_rndseed ne $lastrndseed) { |
$trystr .= '<br /><span style="color: green; white-space: nowrap; font-style: italic; font-weight: bold; font-size: 80%;">'.&mt('New problem variation this try.').'</span>'; |
$trystr .= '<br /><span style="color: green; white-space: nowrap; font-style: italic; font-weight: bold; font-size: 80%;">'.&mt('New problem variation this try.').'</span>'; |
} |
} |
} |
} |
$message =~ s{(</td>)}{ $trystr $1}; |
$message =~ s{(</td>)}{ $trystr $1}; |
} |
} |
my ($class) = ($message =~ m{<td.*class="([^"]*)"}); #" |
my ($class) = ($message =~ m{<td.*class="([^"]*)"}); #" |