version 1.282, 2011/03/07 19:42:21
|
version 1.295, 2011/10/08 19:19:58
|
Line 60 use LONCAPA;
|
Line 60 use LONCAPA;
|
|
|
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline')); |
&Apache::lonxml::register('Apache::inputtags',('hiddensubmission','hiddenline','textfield','textline')); |
} |
} |
|
|
=pod |
=pod |
Line 478 sub end_hiddenline {
|
Line 478 sub end_hiddenline {
|
return ""; |
return ""; |
} |
} |
|
|
|
|
|
sub start_hiddensubmission { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
my $result = ""; |
|
my $input_id = &start_input($parstack,$safeeval); |
|
if ($target eq 'web') { |
|
$Apache::lonxml::evaluate--; |
|
if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { |
|
my $partid=$Apache::inputtags::part; |
|
my $id=$Apache::inputtags::response[-1]; |
|
if ($Apache::lonhomework::type ne 'exam') { |
|
my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval); |
|
$value = &HTML::Entities::encode($value,'<>&"'); |
|
$result= '<input type="hidden" name="HWVAL_'.$id.'" value="'.$value.'" />'; |
|
} |
|
} |
|
} elsif ($target eq 'edit') { |
|
$result=&Apache::edit::tag_start($target,$token); |
|
$result.=&Apache::edit::text_arg('Value:','value',$token,'15'); |
|
$result.=&Apache::edit::end_row(); |
|
$result.=&Apache::edit::end_table(); |
|
} elsif ($target eq 'modified') { |
|
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
|
$safeeval,'value'); |
|
if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); } |
|
} |
|
|
|
if ( ($target eq 'web' || $target eq 'tex') |
|
&& $Apache::lonhomework::type eq 'exam' |
|
&& &needs_exam_box($tagstack)) { |
|
$result.=&exam_box($target); |
|
} |
|
return $result; |
|
} |
|
|
|
sub end_hiddensubmission { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
if ($target eq 'web') { $Apache::lonxml::evaluate++; } |
|
elsif ($target eq 'edit') { return ('','no'); } |
|
&end_input(); |
|
return ""; |
|
} |
|
|
=pod |
=pod |
|
|
=item file_selector() |
=item file_selector() |
Line 528 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 842 sub decideoutput {
|
Line 885 sub decideoutput {
|
$message=&mt('Incorrect.'); |
$message=&mt('Incorrect.'); |
$css_class=$possible_class{'charged_try'}; |
$css_class=$possible_class{'charged_try'}; |
} |
} |
if ($env{'request.filename'} =~ |
if ($handgrade || |
m|/res/lib/templates/examupload.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 868 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 1094 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 1147 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 1269 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 1280 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 1400 sub get_grade_messages {
|
Line 1436 sub get_grade_messages {
|
if ( $tries eq '' ) { $tries = '0'; } |
if ( $tries eq '' ) { $tries = '0'; } |
if ( $maxtries eq '' ) { $maxtries = '2'; } |
if ( $maxtries eq '' ) { $maxtries = '2'; } |
if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } |
if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } |
my $tries_text= &get_tries_text();; |
my $tries_text= &get_tries_text(); |
if ($showbutton) { |
if ($showbutton) { |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
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 \textit{'.$tries_text.'} '. |
$trystr ='{\vskip 1 mm \small ' |
$tries.'/'.$maxtries.'} \vskip 2 mm '; |
.&mt('[_1]'.$tries_text.'[_2] [_3]' |
|
,'\textit{','}',$tries.'/'.$maxtries ) |
|
.'} \vskip 2 mm'; |
} else { |
} else { |
$trystr = '\vskip 0 mm '; |
$trystr = '\vskip 0 mm '; |
} |
} |
} else { |
} else { |
$trystr = '<td><span class="LC_nobreak">'.&mt($tries_text)." $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') { |
$trystr.="/".&Apache::lonhtmlcommon::direct_parm_link($maxtries,$env{'request.symb'},'maxtries',$id,$target); |
$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'})) { |
$trystr.="/".$Apache::inputtags::params{'maxtries'}; |
$trial.="/".$Apache::inputtags::params{'maxtries'}; |
} |
} |
} |
} |
$trystr.="</span></td>"; |
$trystr = '<td><span class="LC_nobreak">'.&mt($tries_text.' [_1]',$trial).'</span></td>'; |
} |
} |
} |
} |
|
|
Line 1542 sub previous_tries {
|
Line 1580 sub previous_tries {
|
{$1 <strong>$txt_correct</strong>. $3}s; |
{$1 <strong>$txt_correct</strong>. $3}s; |
} |
} |
my $trystr = "(".&mt('Try [_1]',$Apache::lonhomework::history{"$prefix.tries"}).")"; |
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) { |
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>'; |
} |
} |