Annotation of loncom/homework/response.pm, revision 1.5

1.1       albertel    1: # The LearningOnline Network with CAPA
                      2: # various response type definitons response definition
                      3: 
1.5     ! www         4: # 11/23 Gerd Kortemeyer
        !             5: 
1.1       albertel    6: package Apache::response;
                      7: use strict;
                      8: 
                      9: sub BEGIN {
1.3       albertel   10:   &Apache::lonxml::register('Apache::response',('responseparam','caparesponse'));
1.1       albertel   11: }
                     12: 
                     13: sub start_caparesponse {
                     14:   require Apache::caparesponse; 
                     15:   import Apache::caparesponse; 
                     16:   my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;
1.2       albertel   17: #  print "\n<br>\nsimple caparesponse\n";
1.1       albertel   18:   Apache::caparesponse::start_caparesponse($target,$token,$parstack,$parser,$safeeval,$style);;
1.2       albertel   19:   return "";
1.3       albertel   20: }
                     21: 
                     22: sub start_responseparam {
                     23:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
1.5     ! www        24:  if ($target ne 'meta') {
1.3       albertel   25:   my $args='';
                     26:   if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
                     27:   my $default = &Apache::run::run("{$args;".'return $default}',$safeeval);
1.4       albertel   28:   my $name = &Apache::run::run("{$args;".'return $name}',$safeeval);
                     29:   &Apache::lonxml::debug("looking for resource.$Apache::inputtags::part['-1'].$name");
                     30:   my $value = &Apache::lonnet::EXT("resource.$Apache::inputtags::part['-1'].$name");
                     31:   &Apache::lonxml::debug("$name has value :$value: and default :$default:");
1.3       albertel   32:   if (!$value) {
1.4       albertel   33:     $Apache::inputtags::params{$name}=$default;
1.3       albertel   34:   } else {
1.4       albertel   35:     $Apache::inputtags::params{$name}=$value;
1.3       albertel   36:   }
                     37:   return '';
1.5     ! www        38: } else {
        !            39:     my $tag='parameter_'.$Apache::inputtags::part['-1'].'_'.
        !            40: 	$token->[2]->{'name'};
        !            41:     my $display='';
        !            42:     if ($token->[2]->{'description'}) {
        !            43:        $display=' display="'.$token->[2]->{'description'}.'"';
        !            44:     }
        !            45:     return "\n<".$tag.$display.'>'.$token->[2]->{'type'}.'</'.$tag.'>';
        !            46: }
1.3       albertel   47: }
                     48: 
                     49: sub end_responseparam {
1.1       albertel   50: }
1.2       albertel   51: 
1.1       albertel   52: 1;
                     53: __END__
                     54:  

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