--- loncom/homework/response.pm 2001/06/02 03:59:59 1.28
+++ loncom/homework/response.pm 2001/08/04 19:19:17 1.33
@@ -2,12 +2,14 @@
# various response type definitons response definition
# 11/23,11/24,11/28 Gerd Kortemeyer
+# Guy Albertelli
+# 08/04 Gerd Kortemeyer
package Apache::response;
use strict;
sub BEGIN {
- &Apache::lonxml::register('Apache::response',('responseparam','caparesponse','numericalresponse','radiobuttonresponse','optionresponse','imageresponse','essayresponse'));
+ &Apache::lonxml::register('Apache::response',('responseparam','caparesponse','numericalresponse','stringresponse','radiobuttonresponse','optionresponse','imageresponse','essayresponse'));
}
sub start_response {
@@ -51,6 +53,13 @@ sub meta_parameter_write {
."\n";
}
+sub meta_package_write {
+ my $name=shift;
+ return ''
+ ."\n";
+}
+
sub meta_stores_write {
my ($name,$type,$display)=@_;
return '\nsimple caparesponse\n";
+ return &Apache::caparesponse::start_caparesponse($target,$token,$tagstack,$parstack,$parser,$safeeval,$style);
}
-sub start_caparesponse {
+sub start_stringresponse {
+ require Apache::caparesponse;
+ import Apache::caparesponse;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+ return &Apache::caparesponse::start_stringresponse($target,$token,$tagstack,$parstack,$parser,$safeeval,$style);
+}
+
+sub start_numericalresponse {
require Apache::caparesponse;
import Apache::caparesponse;
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
-# print "\n
\nsimple caparesponse\n";
- return &Apache::caparesponse::start_caparesponse($target,$token,$tagstack,$parstack,$parser,$safeeval,$style);
+ return &Apache::caparesponse::start_numericalresponse($target,$token,$tagstack,$parstack,$parser,$safeeval,$style);
}
sub start_radiobuttonresponse {
@@ -160,12 +200,34 @@ sub start_responseparam {
$token->[2]->{'type'},
$token->[2]->{'default'},
$token->[2]->{'description'});
+ } elsif ($target eq 'edit') {
+ my $result.=&Apache::edit::tag_start($target,$token,&Apache::lonxml::description($token));
+ $result.=&Apache::edit::text_arg('Name:','name',$token).
+ &Apache::edit::text_arg('Type:','type',$token).
+ &Apache::edit::text_arg('Description:','description',$token).
+ &Apache::edit::text_arg('Default:','default',$token).
+ "";
+ $result.=&Apache::edit::end_table;
+ return $result;
+ } elsif ($target eq 'modified') {
+ my $result;
+ my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,
+ 'name','type','description',
+ 'default');
+ if ($constructtag) {
+ $result = &Apache::edit::rebuild_tag($token);
+ $result.=&Apache::edit::handle_insert();
+ }
+ return $result;
+
} else {
return '';
}
}
sub end_responseparam {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ if ($target eq 'edit') { return ('','no'); }
return '';
}