Diff for /loncom/homework/hint.pm between versions 1.4 and 1.7

version 1.4, 2001/01/05 01:14:08 version 1.7, 2001/02/07 00:27:32
Line 2  package Apache::hinttags; Line 2  package Apache::hinttags;
   
 use strict;  use strict;
 use Apache::lonnet;  use Apache::lonnet;
   use capa;
   
 sub BEGIN {  sub BEGIN {
   &Apache::lonxml::register('Apache::hinttags',('hintgroup','hintpart','numericalhint'));    &Apache::lonxml::register('Apache::hinttags',('hintgroup','hintpart','numericalhint'));
Line 26  sub start_hintgroup { Line 27  sub start_hintgroup {
       if ($target eq 'web') {$result='<table bgcolor="#dddddd"><tr><td>';}        if ($target eq 'web') {$result='<table bgcolor="#dddddd"><tr><td>';}
     }      }
   }    }
   if ($skiptoend) {    if ($skiptoend && $target ne 'meta') {
     &Apache::lonxml::get_all_text("/hintgroup",$$parser[$#$parser]);      &Apache::lonxml::get_all_text("/hintgroup",$$parser[$#$parser]);
   }    }
   @Apache::hint::which=();    @Apache::hint::which=();
Line 61  sub end_numericalhint { Line 62  sub end_numericalhint {
   my $result;    my $result;
   if ($target ne 'meta' && $target ne 'grade') {    if ($target ne 'meta' && $target ne 'grade') {
     my $args ='';      my $args ='';
       $safeeval->share_from('capa',['&caparesponse_capa_check_answer']);
     if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }      if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
     my $name = &Apache::run::run("{$args;".'return $name}',$safeeval);      my $name = &Apache::run::run("{$args;".'return $name}',$safeeval);
     my $response = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.$Apache::inputtags::response['-1'].submission"};      my $response = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.$Apache::inputtags::response['-1'].submission"};
Line 71  sub end_numericalhint { Line 73  sub end_numericalhint {
  ';my $sig="'.$Apache::inputtags::params{'sig'}.'"'.   ';my $sig="'.$Apache::inputtags::params{'sig'}.'"'.
   "');";    "');";
     $result = &Apache::run::run($expression,$safeeval);      $result = &Apache::run::run($expression,$safeeval);
       &Apache::lonxml::debug("$expression:result:$result:$Apache::lonxml::curdepth");
     my ($awards) = split /:/ , $result;      my ($awards) = split /:/ , $result;
     my ($ad) = &Apache::inputtags::finalizeawards(split /,/ , $awards);      my ($ad) = &Apache::inputtags::finalizeawards(split /,/ , $awards);
     if ($ad eq 'EXACT_ANS' || $ad eq 'APPROX_ANS') { push (@Apache::hint::which,$name); }      if ($ad eq 'EXACT_ANS' || $ad eq 'APPROX_ANS') { push (@Apache::hint::which,$name); }
     &Apache::lonxml::debug("\n<br>result:$result:$Apache::lonxml::curdepth<br>\n");  
     $result='';      $result='';
   }    }
   return $result;    return $result;
Line 96  sub start_hintpart { Line 98  sub start_hintpart {
       foreach $which (@Apache::hint::which) { if ($which eq $on) { $show = 1; last } }        foreach $which (@Apache::hint::which) { if ($which eq $on) { $show = 1; last } }
     }      }
     if (!$show) {      if (!$show) {
       &Apache::lonxml::get_all_text("/problem",$$parser[$#$parser]);        &Apache::lonxml::get_all_text("/hintpart",$$parser[$#$parser]);
     }      }
   } else {    } else {
     &Apache::lonxml::get_all_text("/problem",$$parser[$#$parser]);      &Apache::lonxml::get_all_text("/hintpart",$$parser[$#$parser]);
   }    }
   return '';    return '';
 }  }

Removed from v.1.4  
changed lines
  Added in v.1.7


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