version 1.135, 2002/11/11 22:37:23
|
version 1.140, 2002/12/02 17:15:07
|
Line 118 sub page_start {
|
Line 118 sub page_start {
|
return ($result,$head_tag_start,$body_tag_start,$form_tag_start); |
return ($result,$head_tag_start,$body_tag_start,$form_tag_start); |
} |
} |
|
|
|
use Time::HiRes(); |
sub get_resource_name { |
sub get_resource_name { |
my ($parstack,$safeeval)=@_; |
my ($parstack,$safeeval)=@_; |
my $name=&Apache::lonxml::get_param('name',$parstack,$safeeval); |
my $name=&Apache::lonnet::gettitle(); |
if ($name eq '') { |
&Apache::lonnet::logthis("Got $name"); |
|
if ($name eq '') { |
$name=&Apache::lonnet::EXT('resource.title'); |
$name=&Apache::lonnet::EXT('resource.title'); |
if ($name eq 'con_lost') { $name = ''; } |
if ($name eq 'con_lost') { $name = ''; } |
} |
} |
Line 138 sub setup_rndseed {
|
Line 140 sub setup_rndseed {
|
$rndseed=time; |
$rndseed=time; |
$ENV{'form.rndseed'}=$rndseed; |
$ENV{'form.rndseed'}=$rndseed; |
} |
} |
|
&Apache::lonxml::debug("Setting rndseed to $rndseed"); |
&Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval); |
&Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval); |
} |
} |
return $rndseed; |
return $rndseed; |
Line 174 sub problem_web_to_edit_header {
|
Line 177 sub problem_web_to_edit_header {
|
<hr />'; |
<hr />'; |
my $numtoanalyze=$ENV{'form.numtoanalyze'}; |
my $numtoanalyze=$ENV{'form.numtoanalyze'}; |
if (!$numtoanalyze) { $numtoanalyze=100; } |
if (!$numtoanalyze) { $numtoanalyze=100; } |
#DISABLED for now. |
$result.= '<input type="submit" name="problemmode" value="Answer Distribution" /> |
#$result.= '<input type="submit" name="problemmode" value="Answer Distribution" /> |
<input type="text" name="numtoanalyze" value="'. |
# <input type="text" name="numtoanalyze" value="'. |
$numtoanalyze.'" size="5" /> <hr />'; |
# $numtoanalyze.'" size="5" /> <hr />'; |
|
return $result; |
return $result; |
} |
} |
|
|
Line 281 sub start_problem {
|
Line 283 sub start_problem {
|
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval); |
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval); |
if ($target eq 'tex' and $ENV{'request.symb'} =~ m/\.page_/) { $result = '';} |
if ($target eq 'tex' and $ENV{'request.symb'} =~ m/\.page_/) { $result = '';} |
|
|
|
if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval); } |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { |
#handle exam checkout |
#handle exam checkout |
if ($Apache::lonhomework::type eq 'exam') { |
if ($Apache::lonhomework::type eq 'exam') { |
Line 423 sub end_problem {
|
Line 426 sub end_problem {
|
$result.="</body>\n"; |
$result.="</body>\n"; |
} |
} |
} |
} |
if ($target ne 'tex') { |
if ($target eq 'web') { |
$result.=&Apache::lonxml::xmlend(); |
$result.=&Apache::lonxml::xmlend(); |
} else { |
} elsif ($target eq 'tex') { |
$result .= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}'; |
$result .= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}'; |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
$result .= '\end{minipage}\end{document} '; |
$result .= '\end{minipage}\end{document} '; |
} else { |
} else { |
$result .= ''; |
$result .= ''; |
} |
} |
} |
} |
} |
} |
if ($target eq 'grade') { |
if ($target eq 'grade') { |
Line 501 sub start_block {
|
Line 504 sub start_block {
|
if ($code) { |
if ($code) { |
$code =~ s/\"//g; |
$code =~ s/\"//g; |
$code .=';return $condition;'; |
$code .=';return $condition;'; |
|
if (!$Apache::lonxml::default_homework_loaded) { |
|
&Apache::lonxml::default_homework_load($safeeval); |
|
} |
$result = &Apache::run::run($code,$safeeval); |
$result = &Apache::run::run($code,$safeeval); |
&Apache::lonxml::debug("block :$code: returned :$result:"); |
&Apache::lonxml::debug("block :$code: returned :$result:"); |
} else { |
} else { |
Line 536 sub start_while {
|
Line 542 sub start_while {
|
$code .=';return $condition;'; |
$code .=';return $condition;'; |
|
|
push( @Apache::structuretags::whileconds, $code); |
push( @Apache::structuretags::whileconds, $code); |
|
if (!$Apache::lonxml::default_homework_loaded) { |
|
&Apache::lonxml::default_homework_load($safeeval); |
|
} |
my $result = &Apache::run::run($code,$safeeval); |
my $result = &Apache::run::run($code,$safeeval); |
my $bodytext=$$parser[$#$parser]->get_text("/while"); |
my $bodytext=$$parser[$#$parser]->get_text("/while"); |
push( @Apache::structuretags::whilebody, $bodytext); |
push( @Apache::structuretags::whilebody, $bodytext); |
Line 686 sub end_part {
|
Line 695 sub end_part {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
&Apache::lonxml::debug("in end_part $target "); |
&Apache::lonxml::debug("in end_part $target "); |
my $status=$Apache::inputtags::status['-1']; |
my $status=$Apache::inputtags::status['-1']; |
pop @Apache::inputtags::status; |
my $result=''; |
if ( $target eq 'meta' ) { return ''; } |
if ( $target eq 'meta' ) { |
if ( $target eq 'grade' && $status eq 'CAN_ANSWER') { |
$result=''; |
return &Apache::inputtags::grade; |
} elsif ( $target eq 'grade' && $status eq 'CAN_ANSWER') { |
} |
$result=&Apache::inputtags::grade; |
if ($target eq 'web' || $target eq 'tex' ) { |
} elsif ($target eq 'web' || $target eq 'tex' ) { |
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,$target); |
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part, |
|
$target); |
if ($Apache::lonhomework::type eq 'exam') {$gradestatus='';} |
if ($Apache::lonhomework::type eq 'exam') {$gradestatus='';} |
return $gradestatus; |
$result=$gradestatus; |
} |
} |
return ''; |
pop @Apache::inputtags::status; |
|
return $result; |
} |
} |
|
|
sub start_preduedate { |
sub start_preduedate { |