--- loncom/homework/edit.pm 2001/06/26 21:39:55 1.14
+++ loncom/homework/edit.pm 2001/06/27 18:51:12 1.15
@@ -146,24 +146,40 @@ $optionlist
}
sub handle_insert {
- if (!$ENV{"form.insert_$Apache::lonxml::curdepth"}) { return ''; }
+ &Apache::lonxml::debug("Er handle insert called");
+ if ($ENV{"form.insert_$Apache::lonxml::curdepth"} eq '') { return ''; }
my $result;
my $tagnum = $ENV{"form.insert_$Apache::lonxml::curdepth"};
my $func=$Apache::lonxml::insertlist{"$tagnum.function"};
+ &Apache::lonxml::debug("Looking for :$func:");
if ($func eq 'default') {
my $newtag=$Apache::lonxml::insertlist{"$tagnum.tag"};
my $namespace;
if ($newtag =~ /::/) { ($namespace,$newtag) = split(/::/,$newtag); }
$result.="\n<$newtag>\n$newtag>";
} else {
- {
- no strict 'refs';
- $result.=&$func();
+ if (defined(&$func)) {
+ {
+ no strict 'refs';
+ $result.=&$func();
+ }
+ } else {
+ my $newtag=$Apache::lonxml::insertlist{"$tagnum.tag"};
+ &Apache::lonxml::error("Unable to insert tag $newtag, $func was not defined.");
}
}
return $result;
}
+sub insert_numericalresponse {
+ return '
+
+
+
+
+';
+}
+
sub insert_optionresponse {
return '
@@ -219,7 +235,7 @@ sub insert_script {
return "\n";
}
-# Returns a 1 if the toekn has been modified and you should rebuild the tag
+# Returns a 1 if the token has been modified and you should rebuild the tag
# side-effects, will modify the $token if new values are found
sub get_new_args {
my ($token,$parstack,$safeeval,@args)=@_;
@@ -236,6 +252,7 @@ sub get_new_args {
return $rebuild;
}
+# looks for /> on start tags
sub rebuild_tag {
my ($token) = @_;
my $result;
@@ -245,7 +262,11 @@ sub rebuild_tag {
&Apache::lonxml::debug("setting :$key: to :$val:");
$result.=' '.$key.'="'.$val.'"';
}
- $result.=">";
+ if ($token->[4] =~ m:/>$:) {
+ $result.=' />';
+ } else {
+ $result.='>';
+ }
} elsif ( $token->[0] eq 'E' ) {
$result = ''.$token->[1].'>';
}