--- loncom/homework/inputtags.pm 2011/03/07 22:38:09 1.285 +++ loncom/homework/inputtags.pm 2011/04/29 01:41:12 1.286 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.285 2011/03/07 22:38:09 www Exp $ +# $Id: inputtags.pm,v 1.286 2011/04/29 01:41:12 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -60,7 +60,7 @@ use LONCAPA; BEGIN { - &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline')); + &Apache::lonxml::register('Apache::inputtags',('hiddensubmission','hiddenline','textfield','textline')); } =pod @@ -474,6 +474,49 @@ sub end_hiddenline { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; if ($target eq 'web') { $Apache::lonxml::evaluate++; } elsif ($target eq 'edit') { return ('','no'); } + &end_input(); + 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= ''; + } + } + } 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 ""; }