Annotation of loncom/homework/essayresponse.pm, revision 1.4

1.1       albertel    1: # The LearningOnline Network with CAPA
                      2: # essay (ungraded) style responses
                      3: # 4/3 Guy
                      4: package Apache::essayresponse;
                      5: use strict;
                      6: 
                      7: sub BEGIN {
                      8:   &Apache::lonxml::register('Apache::essayresponse',('essayresponse'));
                      9: }
                     10: 
                     11: sub start_essayresponse {
1.3       albertel   12:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.4     ! albertel   13:   my $result;
1.1       albertel   14:   my $id = &Apache::response::start_response($parstack,$safeeval);
1.4     ! albertel   15:   if ($target eq 'meta') {
        !            16:     $result=&Apache::response::meta_package_write('essayresponse');
        !            17:   }
        !            18:   return $result;
1.1       albertel   19: }
                     20: 
                     21: sub end_essayresponse {
1.3       albertel   22:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.1       albertel   23:   if ( $target eq 'grade' ) {
                     24:     if ( defined $ENV{'form.submitted'}) {
                     25:       my $id = $Apache::inputtags::response['-1'];
1.2       albertel   26:       my $response = $ENV{'form.HWVAL'.$Apache::inputtags::response['-1']};
                     27:       if ( $response =~ /[^\s]/) {
                     28: 	$Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.submission"}=$response;
                     29: 	$Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}="SUBMITTED";
                     30:       }
1.1       albertel   31:     }
                     32:   }
                     33:   &Apache::response::end_response;
                     34:   return '';
                     35: }
1.2       albertel   36: 
                     37: 1;
                     38: __END__

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