version 1.75, 2002/01/11 16:32:29
|
version 1.81, 2002/02/08 20:58:39
|
Line 34 package Apache::structuretags;
|
Line 34 package Apache::structuretags;
|
use strict; |
use strict; |
use Apache::lonnet; |
use Apache::lonnet; |
|
|
sub BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::structuretags',('block','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext')); |
&Apache::lonxml::register('Apache::structuretags',('block','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext')); |
# &Apache::lonxml::register_insert('problem','',('part','postanswerdate','preduedate')) |
# &Apache::lonxml::register_insert('problem','',('part','postanswerdate','preduedate')) |
} |
} |
Line 67 sub end_tex {
|
Line 67 sub end_tex {
|
|
|
sub page_start { |
sub page_start { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $result=&Apache::londefdef::start_html($target,$token,$tagstack,$parstack,$parser,$safeeval); |
my %found; |
my $head_tag_start='<head>'.&Apache::lonxml::registerurl(); |
foreach my $taginside ($tagstack) { |
my $body_tag_start='<body onLoad="'.&Apache::lonxml::loadevents().'" '. |
foreach my $taglookedfor ('html','body','form') { |
'onUnload="'.&Apache::lonxml::unloadevents().'" '; |
if ($taginside =~ /^$taglookedfor$/i) { $found{$taglookedfor} = 1; } |
my $background=&Apache::lonxml::get_param('background',$parstack,$safeeval); |
} |
if ($background) { |
} |
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= |
|
$background; |
my $result; |
$body_tag_start.='background="'.$background.'" '; |
my $head_tag_start; |
} else { |
if (!defined($found{'html'})) { |
my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,$safeeval); |
$result=&Apache::londefdef::start_html($target,$token,$tagstack,$parstack, |
if ($bgcolor) { |
$parser,$safeeval); |
$body_tag_start.='bgcolor="'.$bgcolor.'" '; |
$head_tag_start='<head>'.&Apache::lonxml::registerurl(); |
|
} |
|
my $body_tag_start; |
|
if (!defined($found{'body'})) { |
|
$body_tag_start='<body onLoad="'.&Apache::lonxml::loadevents().'" '. |
|
'onUnload="'.&Apache::lonxml::unloadevents().'" '; |
|
my $background=&Apache::lonxml::get_param('background',$parstack,$safeeval); |
|
if ($background) { |
|
$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= |
|
$background; |
|
$body_tag_start.='background="'.$background.'" '; |
} else { |
} else { |
$body_tag_start.='bgcolor="#ffffff"'; |
my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,$safeeval); |
|
if ($bgcolor) { |
|
$body_tag_start.='bgcolor="'.$bgcolor.'" '; |
|
} else { |
|
$body_tag_start.='bgcolor="#ffffff"'; |
|
} |
} |
} |
|
$body_tag_start.='>'; |
} |
} |
$body_tag_start.='>'; |
|
return ($result,$head_tag_start,$body_tag_start); |
return ($result,$head_tag_start,$body_tag_start); |
} |
} |
|
|
Line 147 ENDCHECKOUT
|
Line 162 ENDCHECKOUT
|
sub start_problem { |
sub start_problem { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
|
|
# meta is called from lonpublisher, which doesn't uses the normal |
|
# lonhomework method of parsing the file which means that inputtags |
|
# won't get reset |
|
if ( $Apache::inputtags::part ne '' && $target != 'meta' ) { |
|
&Apache::lonxml::error('Only one problem allowed in a .problem file'); |
|
my $bodytext=&Apache::lonxml::get_all_text("/problem",$$parser[-1]); |
|
return ''; |
|
} |
#intialize globals |
#intialize globals |
$Apache::inputtags::part='0'; |
$Apache::inputtags::part='0'; |
@Apache::inputtags::responselist = (); |
@Apache::inputtags::responselist = (); |
Line 273 sub start_problem {
|
Line 296 sub start_problem {
|
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
$result=$token->[4]; |
$result=$token->[4]; |
$result.=&Apache::edit::handle_insert(); |
$result.=&Apache::edit::handle_insert(); |
|
} elsif ($target eq 'tex') { |
|
$result .= '\begin{document}\noindent\textbf{Problem.}\newline'; |
} else { |
} else { |
# page_start returned a starting result, delete it if we don't need it |
# page_start returned a starting result, delete it if we don't need it |
$result = ''; |
$result = ''; |
Line 316 sub end_problem {
|
Line 341 sub end_problem {
|
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
&Apache::lonxml::debug("in end_problem with $target, edit"); |
&Apache::lonxml::debug("in end_problem with $target, edit"); |
$result='<br /><input type="submit" name="submit" value="Submit Changes" />'; |
$result='<br /><input type="submit" name="submit" value="Submit Changes" />'; |
|
} elsif ($target eq 'tex') { |
|
$result .= '\end{document}'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 584 sub end_startouttext {
|
Line 611 sub end_startouttext {
|
."</td> |
."</td> |
<td>". |
<td>". |
&Apache::edit::insertlist($target,$token). |
&Apache::edit::insertlist($target,$token). |
&Apache::edit::end_row().&Apache::edit::start_spanning_row()."\n". |
"</td> |
|
</tr><tr><td colspan=\"3\">\n". |
&Apache::edit::editfield($token->[1],$text,"",50,4); |
&Apache::edit::editfield($token->[1],$text,"",50,4); |
} |
} |
if ($target eq 'modified') { |
if ($target eq 'modified') { |