version 1.14, 2001/06/26 21:39:55
|
version 1.17, 2001/07/10 22:06:42
|
Line 146 $optionlist
|
Line 146 $optionlist
|
} |
} |
|
|
sub handle_insert { |
sub handle_insert { |
if (!$ENV{"form.insert_$Apache::lonxml::curdepth"}) { return ''; } |
if ($ENV{"form.insert_$Apache::lonxml::curdepth"} eq '') { return ''; } |
my $result; |
my $result; |
my $tagnum = $ENV{"form.insert_$Apache::lonxml::curdepth"}; |
my $tagnum = $ENV{"form.insert_$Apache::lonxml::curdepth"}; |
my $func=$Apache::lonxml::insertlist{"$tagnum.function"}; |
my $func=$Apache::lonxml::insertlist{"$tagnum.function"}; |
Line 156 sub handle_insert {
|
Line 156 sub handle_insert {
|
if ($newtag =~ /::/) { ($namespace,$newtag) = split(/::/,$newtag); } |
if ($newtag =~ /::/) { ($namespace,$newtag) = split(/::/,$newtag); } |
$result.="\n<$newtag>\n</$newtag>"; |
$result.="\n<$newtag>\n</$newtag>"; |
} else { |
} else { |
{ |
if (defined(&$func)) { |
no strict 'refs'; |
{ |
$result.=&$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; |
return $result; |
} |
} |
|
|
|
sub insert_responseparam { |
|
return ' |
|
<responseparam />'; |
|
} |
|
|
|
sub insert_numericalresponse { |
|
return ' |
|
<numericalresponse answer=""> |
|
<textline /> |
|
<hintgroup> |
|
</hintgroup> |
|
</numericalresponse>'; |
|
} |
|
|
sub insert_optionresponse { |
sub insert_optionresponse { |
return ' |
return ' |
<optionresponse max="10"> |
<optionresponse max="10"> |
Line 219 sub insert_script {
|
Line 238 sub insert_script {
|
return "\n<script type=\"loncapa/perl\">\n</script>"; |
return "\n<script type=\"loncapa/perl\">\n</script>"; |
} |
} |
|
|
# 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 |
# side-effects, will modify the $token if new values are found |
sub get_new_args { |
sub get_new_args { |
my ($token,$parstack,$safeeval,@args)=@_; |
my ($token,$parstack,$safeeval,@args)=@_; |
Line 236 sub get_new_args {
|
Line 255 sub get_new_args {
|
return $rebuild; |
return $rebuild; |
} |
} |
|
|
|
# looks for /> on start tags |
sub rebuild_tag { |
sub rebuild_tag { |
my ($token) = @_; |
my ($token) = @_; |
my $result; |
my $result; |
if ($token->[0] eq 'S') { |
if ($token->[0] eq 'S') { |
$result = '<'.$token->[1]; |
$result = '<'.$token->[1]; |
while (my ($key,$val)= each(%{$token->[2]})) { |
while (my ($key,$val)= each(%{$token->[2]})) { |
|
$val=~s:"::g; #" |
&Apache::lonxml::debug("setting :$key: to :$val:"); |
&Apache::lonxml::debug("setting :$key: to :$val:"); |
$result.=' '.$key.'="'.$val.'"'; |
$result.=' '.$key.'="'.$val.'"'; |
} |
} |
$result.=">"; |
if ($token->[4] =~ m:/>$:) { |
|
$result.=' />'; |
|
} else { |
|
$result.='>'; |
|
} |
} elsif ( $token->[0] eq 'E' ) { |
} elsif ( $token->[0] eq 'E' ) { |
$result = '</'.$token->[1].'>'; |
$result = '</'.$token->[1].'>'; |
} |
} |