--- loncom/homework/radiobuttonresponse.pm 2001/12/14 23:00:52 1.33 +++ loncom/homework/radiobuttonresponse.pm 2002/01/25 16:11:37 1.37 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # mutliple choice style responses # -# $Id: radiobuttonresponse.pm,v 1.33 2001/12/14 23:00:52 albertel Exp $ +# $Id: radiobuttonresponse.pm,v 1.37 2002/01/25 16:11:37 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,7 +30,7 @@ package Apache::radiobuttonresponse; use strict; -sub BEGIN { +BEGIN { &Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse')); } @@ -45,12 +45,13 @@ sub start_radiobuttonresponse { $result=&Apache::response::meta_package_write('radiobuttonresponse'); } elsif ($target eq 'edit' ) { $result.=&Apache::edit::start_table($token). - ''.&Apache::lonxml::description($token)."Delete:". + ''.&Apache::lonxml::description($token)."Delete:". &Apache::edit::deletelist($target,$token) - ." \n"; - $result.=&Apache::edit::text_arg('Max Number Of Foils:','max',$token,'4'). - ""; - $result.="\n"; + ." ".&Apache::edit::end_row() + .&Apache::edit::start_spanning_row(); + + $result.=&Apache::edit::text_arg('Max Number Of Shown Foils:','max',$token,'4'). + &Apache::edit::end_row().&Apache::edit::start_spanning_row()."\n"; } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args($token,$parstack, $safeeval,'max'); @@ -153,11 +154,13 @@ sub end_foilgroup { sub getfoilcounts { my ($parstack,$safeeval)=@_; my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2'); - my @names = @{ $Apache::response::foilgroup{'names'} }; + my @names; my $truecnt=0; my $falsecnt=0; my $name; - + if ( $Apache::response::foilgroup{'names'} ) { + @names= @{ $Apache::response::foilgroup{'names'} }; + } foreach $name (@names) { if ($Apache::response::foilgroup{$name.'.value'} eq 'true') { $truecnt++; @@ -195,7 +198,10 @@ sub whichfoils { my @truelist; my @falselist; - my @names = @{ $Apache::response::foilgroup{'names'} }; + my @names; + if ( $Apache::response::foilgroup{'names'} ) { + @names= @{ $Apache::response::foilgroup{'names'} }; + } foreach my $name (@names) { #result.="
$name is $Apache::response::foilgroup{$name.'.value'} "; if ($Apache::response::foilgroup{$name.'.value'} eq 'true') { @@ -256,7 +262,6 @@ sub displayfoils { sub displayanswers { my ($max,$answer)=@_; - my @names = @{ $Apache::response::foilgroup{'names'} }; my @whichopt = &whichfoils($max,$answer); my $result=&Apache::response::answer_header('radiobuttonresponse'); foreach my $name (@whichopt) { @@ -275,7 +280,7 @@ sub start_conceptgroup { if ($target eq 'edit') { $result.=&Apache::edit::tag_start($target,$token); $result.=&Apache::edit::text_arg('Concept:','concept',$token,'50'). - "\n"; + &Apache::edit::end_row().&Apache::edit::start_spanning_row(); } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args($token,$parstack, $safeeval,'concept'); @@ -321,6 +326,7 @@ sub start_foil { $result.=&Apache::edit::text_arg('Name:','name',$token); $result.=&Apache::edit::select_arg('Correct Option:','value', ['unused','true','false'],$token); + $result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval, 'value','name');