Diff for /loncom/homework/radiobuttonresponse.pm between versions 1.33 and 1.37

version 1.33, 2001/12/14 23:00:52 version 1.37, 2002/01/25 16:11:37
Line 30 Line 30
 package Apache::radiobuttonresponse;  package Apache::radiobuttonresponse;
 use strict;  use strict;
   
 sub BEGIN {  BEGIN {
   &Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse'));    &Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse'));
 }  }
   
Line 45  sub start_radiobuttonresponse { Line 45  sub start_radiobuttonresponse {
     $result=&Apache::response::meta_package_write('radiobuttonresponse');      $result=&Apache::response::meta_package_write('radiobuttonresponse');
   } elsif ($target eq 'edit' ) {    } elsif ($target eq 'edit' ) {
     $result.=&Apache::edit::start_table($token).      $result.=&Apache::edit::start_table($token).
       '<tr><td>'.&Apache::lonxml::description($token)."</td><td>Delete:".   '<tr><td>'.&Apache::lonxml::description($token)."</td><td>Delete:".
  &Apache::edit::deletelist($target,$token)   &Apache::edit::deletelist($target,$token)
   ."</td><td>&nbsp</td></tr><tr><td colspan=\"3\">\n";   ."</td><td>&nbsp".&Apache::edit::end_row()
     $result.=&Apache::edit::text_arg('Max Number Of Foils:','max',$token,'4').          .&Apache::edit::start_spanning_row();
       "</td></tr>";  
     $result.="<tr><td colspan=\"3\">\n";      $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') {    } elsif ($target eq 'modified') {
     my $constructtag=&Apache::edit::get_new_args($token,$parstack,      my $constructtag=&Apache::edit::get_new_args($token,$parstack,
  $safeeval,'max');   $safeeval,'max');
Line 153  sub end_foilgroup { Line 154  sub end_foilgroup {
 sub getfoilcounts {  sub getfoilcounts {
   my ($parstack,$safeeval)=@_;    my ($parstack,$safeeval)=@_;
   my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');    my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
   my @names = @{ $Apache::response::foilgroup{'names'} };    my @names;
   my $truecnt=0;    my $truecnt=0;
   my $falsecnt=0;    my $falsecnt=0;
   my $name;    my $name;
     if ( $Apache::response::foilgroup{'names'} ) {
       @names= @{ $Apache::response::foilgroup{'names'} };
     }
   foreach $name (@names) {    foreach $name (@names) {
     if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {      if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
       $truecnt++;        $truecnt++;
Line 195  sub whichfoils { Line 198  sub whichfoils {
   my @truelist;    my @truelist;
   my @falselist;    my @falselist;
   
   my @names = @{ $Apache::response::foilgroup{'names'} };    my @names;
     if ( $Apache::response::foilgroup{'names'} ) {
       @names= @{ $Apache::response::foilgroup{'names'} };
     }
   foreach my $name (@names) {    foreach my $name (@names) {
     #result.="<br /><b>$name</b> is <i> $Apache::response::foilgroup{$name.'.value'} </i>";      #result.="<br /><b>$name</b> is <i> $Apache::response::foilgroup{$name.'.value'} </i>";
     if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {      if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
Line 256  sub displayfoils { Line 262  sub displayfoils {
   
 sub displayanswers {  sub displayanswers {
   my ($max,$answer)=@_;    my ($max,$answer)=@_;
   my @names = @{ $Apache::response::foilgroup{'names'} };  
   my @whichopt = &whichfoils($max,$answer);    my @whichopt = &whichfoils($max,$answer);
   my $result=&Apache::response::answer_header('radiobuttonresponse');    my $result=&Apache::response::answer_header('radiobuttonresponse');
   foreach my $name (@whichopt) {    foreach my $name (@whichopt) {
Line 275  sub start_conceptgroup { Line 280  sub start_conceptgroup {
   if ($target eq 'edit') {    if ($target eq 'edit') {
     $result.=&Apache::edit::tag_start($target,$token);      $result.=&Apache::edit::tag_start($target,$token);
     $result.=&Apache::edit::text_arg('Concept:','concept',$token,'50').      $result.=&Apache::edit::text_arg('Concept:','concept',$token,'50').
       "</td></tr><tr><td colspan=\"3\">\n";   &Apache::edit::end_row().&Apache::edit::start_spanning_row();
   } elsif ($target eq 'modified') {    } elsif ($target eq 'modified') {
     my $constructtag=&Apache::edit::get_new_args($token,$parstack,      my $constructtag=&Apache::edit::get_new_args($token,$parstack,
  $safeeval,'concept');   $safeeval,'concept');
Line 321  sub start_foil { Line 326  sub start_foil {
     $result.=&Apache::edit::text_arg('Name:','name',$token);      $result.=&Apache::edit::text_arg('Name:','name',$token);
     $result.=&Apache::edit::select_arg('Correct Option:','value',      $result.=&Apache::edit::select_arg('Correct Option:','value',
        ['unused','true','false'],$token);         ['unused','true','false'],$token);
       $result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
   } elsif ($target eq 'modified') {    } elsif ($target eq 'modified') {
      my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,       my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,
   'value','name');    'value','name');

Removed from v.1.33  
changed lines
  Added in v.1.37


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>