Diff for /loncom/homework/response.pm between versions 1.91 and 1.94

version 1.91, 2004/02/16 20:09:51 version 1.94, 2004/03/12 18:41:43
Line 28 Line 28
   
 package Apache::response;  package Apache::response;
 use strict;  use strict;
   use Apache::lonlocal;
   
 BEGIN {  BEGIN {
     &Apache::lonxml::register('Apache::response',('responseparam','parameter','dataresponse'));      &Apache::lonxml::register('Apache::response',('responseparam','parameter','dataresponse'));
Line 45  sub start_response { Line 46  sub start_response {
     push (@Apache::inputtags::response,$id);      push (@Apache::inputtags::response,$id);
     push (@Apache::inputtags::responselist,$id);      push (@Apache::inputtags::responselist,$id);
     @Apache::inputtags::inputlist=();      @Apache::inputtags::inputlist=();
       if ($Apache::inputtags::part eq '') {
    &Apache::lonxml::error(&HTML::Entities::encode(&mt("Found a <*response> outside of a <part> in a <part>ed problem")));
       }
       if ($Apache::inputtags::response_with_no_part &&
    $Apache::inputtags::part ne '0') {
    &Apache::lonxml::error(&HTML::Entities::encode(&mt("<*response>s are both inside of <part> and outside of <part>, this is not a valid problem, errors in grading may occur.")).'<br />');
       }
       if ($Apache::inputtags::part eq '0') {
    $Apache::inputtags::response_with_no_part=1;
       }
     return $id;      return $id;
 }  }
   
Line 262  sub end_dataresponse { Line 273  sub end_dataresponse {
     my ($symb,$courseid,$domain,$name)=&Apache::lonxml::whichuser();      my ($symb,$courseid,$domain,$name)=&Apache::lonxml::whichuser();
     my $allowed=&Apache::lonnet::allowed('mgr',$courseid);      my $allowed=&Apache::lonnet::allowed('mgr',$courseid);
     if ($allowed) {      if ($allowed) {
  &Apache::response::setup_params('dataresponse');   &Apache::response::setup_params('dataresponse',$safeeval);
  my $partid = $Apache::inputtags::part;   my $partid = $Apache::inputtags::part;
  my $id = $Apache::inputtags::response['-1'];   my $id = $Apache::inputtags::response['-1'];
  my $response = $ENV{'form.HWVAL_'.$id};   my $response = $ENV{'form.HWVAL_'.$id};
Line 382  sub reset_params { Line 393  sub reset_params {
 }  }
   
 sub setup_params {  sub setup_params {
     my ($tag) = @_;      my ($tag,$safeeval) = @_;
   
     if ($ENV{'request.state'} eq 'construct') { return; }      if ($ENV{'request.state'} eq 'construct') { return; }
     my %paramlist=();      my %paramlist=();
Line 405  sub setup_params { Line 416  sub setup_params {
     &Apache::lonxml::debug("using nothing");      &Apache::lonxml::debug("using nothing");
     $Apache::inputtags::params{$key}='';      $Apache::inputtags::params{$key}='';
  } else {   } else {
     &Apache::lonxml::debug("using value");      my $string="{return qq\0".$value."\0}";
       my $newvalue=&Apache::run::run($string,$safeeval,1);
       if (defined($newvalue)) { $value=$newvalue; }
     $Apache::inputtags::params{$key}=$value;      $Apache::inputtags::params{$key}=$value;
  }   }
     }      }

Removed from v.1.91  
changed lines
  Added in v.1.94


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