version 1.105, 2002/08/23 21:17:16
|
version 1.127, 2002/10/15 14:37:59
|
Line 161 sub problem_web_to_edit_header {
|
Line 161 sub problem_web_to_edit_header {
|
<input type="submit" name="resetdata" value="Reset Submissions" /> |
<input type="submit" name="resetdata" value="Reset Submissions" /> |
<input type="checkbox" name="showallfoils" '; |
<input type="checkbox" name="showallfoils" '; |
if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; } |
if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; } |
$result.= ' /> Show All Foils |
$result.= ' /> Show All Foils |
<hr />'; |
<hr />'; |
|
my $numtoanalyze=$ENV{'form.numtoanalyze'}; |
|
if (!$numtoanalyze) { $numtoanalyze=100; } |
|
#DISABLED for now. |
|
#$result.= '<input type="submit" name="problemmode" value="Answer Distribution" /> |
|
# <input type="text" name="numtoanalyze" value="'. |
|
# $numtoanalyze.'" size="5" /> <hr />'; |
} |
} |
|
|
sub initialize_storage { |
sub initialize_storage { |
Line 297 sub start_problem {
|
Line 303 sub start_problem {
|
$msg.=&checkout_msg; |
$msg.=&checkout_msg; |
} |
} |
$result.=$msg.'<br />'; |
$result.=$msg.'<br />'; |
} |
} elsif ($target eq 'tex') { |
|
$result.="\\begin{document}\\noindent \\vskip 1 mm \\begin{minipage}{\\textwidth}\\vskip 0 mm Problem is not open to be viewed. It $accessmsg \\vskip 0 mm "; |
|
} |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web') { |
my $name= &get_resource_name($parstack,$safeeval); |
my $name= &get_resource_name($parstack,$safeeval); |
if ($status eq 'CAN_ANSWER') { |
if ($status eq 'CAN_ANSWER') { |
Line 345 sub start_problem {
|
Line 353 sub start_problem {
|
print $temp_file "$duedate\n"; |
print $temp_file "$duedate\n"; |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
if(not $duedate=~m/1969/) { |
if(not $duedate=~m/1969/) { |
$result .= '\begin{document} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm'; |
$result .= '\begin{document} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent \begin{minipage}{\textwidth}'; |
} else { |
} else { |
$result .= '\begin{document} \noindent \vskip 1 mm'; |
$result .= '\begin{document} \noindent \vskip 1 mm \noindent\begin{minipage}{\textwidth}'; |
} |
} |
} else { |
} else { |
$result .= '\parbox{\minipagewidth}{\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\'; |
$result .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\'; |
} |
} |
} else { |
} else { |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
$result .= '\begin{document} \noindent \vskip 1 mm'; |
$result .= '\begin{document} \noindent \vskip 1 mm\noindent\begin{minipage}{\textwidth}'; |
} else { |
} else { |
$result .= '\parbox{\minipagewidth}{\vskip 1mm \\\\\\\\'; |
$result .= '\vskip 1mm \\\\\\\\'; |
} |
} |
} |
} |
} |
} |
Line 379 sub end_problem {
|
Line 387 sub end_problem {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $result=''; |
my $result=''; |
my $status=$Apache::inputtags::status['-1']; |
my $status=$Apache::inputtags::status['-1']; |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ) { |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex') { |
if ( $target eq 'grade' && $Apache::inputtags::part eq '0') { |
if ( $target eq 'grade' && $Apache::inputtags::part eq '0') { |
# if part is zero, no <part>s existed, so we need to the grading |
# if part is zero, no <part>s existed, so we need to the grading |
&Apache::inputtags::grade; |
&Apache::inputtags::grade; |
} elsif ( $target eq 'web' && $Apache::inputtags::part eq '0' && |
} elsif ( ($target eq 'web' || $target eq 'tex') && $Apache::inputtags::part eq '0' && |
$status ne 'UNCHECKEDOUT') { |
$status ne 'UNCHECKEDOUT') { |
# if part is zero, no <part>s existed, so we need show the current |
# if part is zero, no <part>s existed, so we need show the current |
# grading status |
# grading status |
$result.= &Apache::inputtags::gradestatus($Apache::inputtags::part); |
my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target); |
|
if ($Apache::lonhomework::type ne 'exam') {$result.= $gradestatus;} |
} |
} |
if ( |
if ( |
($target eq 'web' && ($ENV{'request.state'} ne 'construct')) || |
(($target eq 'web') && ($ENV{'request.state'} ne 'construct')) || |
($target eq 'answer') |
($target eq 'answer') || ($target eq 'tex') |
) { |
) { |
if ($status eq 'CAN_ANSWER') { |
if ($status eq 'CAN_ANSWER') { |
$result.="</form></body>\n"; |
if ($target ne 'tex') { |
|
$result.="</form></body>\n"; |
|
} |
} elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' || |
} elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' || |
$status eq 'UNCHECKEDOUT' ) { |
$status eq 'UNCHECKEDOUT' ) { |
$result.="</body>\n"; |
if ($target ne 'tex') { |
|
$result.="</body>\n"; |
|
} |
|
} |
|
if ($target ne 'tex') { |
|
$result.=&Apache::lonxml::xmlend(); |
|
} else { |
|
$result .= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}'; |
|
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
|
$result .= '\end{minipage}\end{document} '; |
|
} else { |
|
$result .= ''; |
|
} |
} |
} |
$result.=&Apache::lonxml::xmlend(); |
|
} |
} |
if ($target eq 'grade') { |
if ($target eq 'grade') { |
&Apache::lonhomework::showhash(%Apache::lonhomework::results); |
&Apache::lonhomework::showhash(%Apache::lonhomework::results); |
Line 412 sub end_problem {
|
Line 434 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 = &problem_edit_footer(); |
$result = &problem_edit_footer(); |
} elsif ($target eq 'tex') { |
} |
$result .= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}'; |
|
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
|
$result .= '\end{document} '; |
|
} else { |
|
$result .= '} '; |
|
} |
|
} |
|
return $result; |
return $result; |
} |
} |
|
|
|
|
sub start_library { |
sub start_library { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($result,$head_tag_start,$body_tag_start,$form_tag_start)= |
my ($result,$head_tag_start,$body_tag_start,$form_tag_start); |
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval); |
|
if ($target eq 'edit') { |
if ($target eq 'edit') { |
|
($result,$head_tag_start,$body_tag_start,$form_tag_start)= |
|
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval); |
$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start. |
$result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start. |
&problem_edit_header(); |
&problem_edit_header(); |
my $temp=&Apache::edit::insertlist($target,$token); |
my $temp=&Apache::edit::insertlist($target,$token); |
Line 435 sub start_library {
|
Line 453 sub start_library {
|
} 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 'web' && $ENV{'request.state'} eq "construct" ) { |
} elsif ($target eq 'web' && $$tagstack[0] ne 'problem' && |
|
$ENV{'request.state'} eq "construct" ) { |
|
($result,$head_tag_start,$body_tag_start,$form_tag_start)= |
|
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval); |
my $name=&get_resource_name($parstack,$safeeval); |
my $name=&get_resource_name($parstack,$safeeval); |
my $rndseed=&setup_rndseed($safeeval); |
my $rndseed=&setup_rndseed($safeeval); |
$result.="$head_tag_start<title>$name</title></head> |
$result.="$head_tag_start<title>$name</title></head> |
Line 451 sub end_library {
|
Line 472 sub end_library {
|
my $result=''; |
my $result=''; |
if ($target eq 'edit') { |
if ($target eq 'edit') { |
$result=&problem_edit_footer(); |
$result=&problem_edit_footer(); |
} elsif ($target eq 'web' && $ENV{'request.state'} eq "construct") { |
} elsif ($target eq 'web' && $$tagstack[0] ne 'problem' && |
|
$ENV{'request.state'} eq "construct") { |
$result.='</form></body>'.&Apache::lonxml::xmlend(); |
$result.='</form></body>'.&Apache::lonxml::xmlend(); |
} |
} |
return $result; |
return $result; |
Line 460 sub end_library {
|
Line 482 sub end_library {
|
sub start_block { |
sub start_block { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
|
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { |
my $code = @$parstack[$#$parstack]; |
my $code = @$parstack[$#$parstack]; |
$code =~ s/\"//g; |
$code =~ s/\"//g; |
$code .=';return $condition;'; |
$code .=';return $condition;'; |
Line 507 sub end_while {
|
Line 529 sub end_while {
|
return ""; |
return ""; |
} |
} |
|
|
# <randomlist> |
# <randomlist show="1"> |
# <tag1>..</tag1> |
# <tag1>..</tag1> |
# <tag2>..</tag2> |
# <tag2>..</tag2> |
# <tag3>..</tag3> |
# <tag3>..</tag3> |
Line 516 sub end_while {
|
Line 538 sub end_while {
|
sub start_randomlist { |
sub start_randomlist { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $result; |
my $result; |
if ($target eq 'answer' || $target eq 'grade' || $target eq 'web') { |
if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' || |
|
$target eq 'tex' || $target eq 'analyze') { |
my $body= &Apache::lonxml::get_all_text("/randomlist",$$parser[$#$parser]); |
my $body= &Apache::lonxml::get_all_text("/randomlist",$$parser[$#$parser]); |
my $b_parser= HTML::TokeParser->new(\$body); |
my $b_parser= HTML::TokeParser->new(\$body); |
my $b_tok; |
my $b_tok; |
Line 569 sub shuffle {
|
Line 592 sub shuffle {
|
if (defined(@$a)) { |
if (defined(@$a)) { |
&Apache::response::setrandomnumber(); |
&Apache::response::setrandomnumber(); |
for($i=@$a;--$i;) { |
for($i=@$a;--$i;) { |
my $j=int rand($i+1); |
my $j=int(&Math::Random::random_uniform() * ($i+1)); |
next if $i == $j; |
next if $i == $j; |
@$a[$i,$j] = @$a[$j,$i]; |
@$a[$i,$j] = @$a[$j,$i]; |
} |
} |
Line 606 sub start_part {
|
Line 629 sub start_part {
|
if ( $target eq "web" ) { |
if ( $target eq "web" ) { |
$result="<br />Part is not open to be viewed. It $accessmsg<br />"; |
$result="<br />Part is not open to be viewed. It $accessmsg<br />"; |
} elsif ( $target eq 'tex' ) { |
} elsif ( $target eq 'tex' ) { |
$result="\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\"; |
$result="\\end{minipage}\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\\\begin{minipage}{\\textwidth}"; |
} |
} |
} else { |
} else { |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$result='\vskip 0 mm'; |
$result='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; |
} |
} |
} |
} |
} |
} |
Line 626 sub end_part {
|
Line 649 sub end_part {
|
if ( $target eq 'grade' && $status eq 'CAN_ANSWER') { |
if ( $target eq 'grade' && $status eq 'CAN_ANSWER') { |
return &Apache::inputtags::grade; |
return &Apache::inputtags::grade; |
} |
} |
if ($target eq 'web') { |
if ($target eq 'web' || $target eq 'tex' ) { |
return &Apache::inputtags::gradestatus($Apache::inputtags::part); |
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,$target); |
|
if ($Apache::lonhomework::type eq 'exam') {$gradestatus='';} |
|
return $gradestatus; |
} |
} |
return ''; |
return ''; |
} |
} |
|
|
sub start_preduedate { |
sub start_preduedate { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { |
if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && |
if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && |
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' ) { |
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' ) { |
&Apache::lonxml::get_all_text("/preduedate",$$parser[$#$parser]); |
&Apache::lonxml::get_all_text("/preduedate",$$parser[$#$parser]); |
Line 649 sub end_preduedate {
|
Line 674 sub end_preduedate {
|
|
|
sub start_postanswerdate { |
sub start_postanswerdate { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
if ($target eq 'web' || $target eq 'grade') { |
if ($target eq 'web' || $target eq 'grade' || $target eq 'tex') { |
if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { |
if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { |
&Apache::lonxml::get_all_text("/postanswerdate",$$parser[$#$parser]); |
&Apache::lonxml::get_all_text("/postanswerdate",$$parser[$#$parser]); |
} |
} |
Line 665 sub end_postanswerdate {
|
Line 690 sub end_postanswerdate {
|
|
|
sub start_notsolved { |
sub start_notsolved { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
&Apache::lonxml::debug("not solved has :$gradestatus:"); |
&Apache::lonxml::debug("not solved has :$gradestatus:"); |
if ($gradestatus =~ /^correct/) { |
if ($gradestatus =~ /^correct/) { |
Line 682 sub end_notsolved {
|
Line 707 sub end_notsolved {
|
|
|
sub start_solved { |
sub start_solved { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
if ($gradestatus !~ /^correct/) { |
if ($gradestatus !~ /^correct/) { |
&Apache::lonxml::get_all_text("/solved",$$parser[$#$parser]); |
&Apache::lonxml::get_all_text("/solved",$$parser[$#$parser]); |
Line 715 sub end_startouttext {
|
Line 740 sub end_startouttext {
|
<td>". |
<td>". |
&Apache::edit::insertlist($target,$token). |
&Apache::edit::insertlist($target,$token). |
&Apache::edit::end_row().&Apache::edit::start_spanning_row()."\n". |
&Apache::edit::end_row().&Apache::edit::start_spanning_row()."\n". |
&Apache::edit::editfield($token->[1],$text,"",50,4); |
&Apache::edit::editfield($token->[1],$text,"",80,4); |
} |
} |
if ($target eq 'modified') { |
if ($target eq 'modified') { |
$text=&Apache::lonxml::get_all_text("endouttext",$$parser['-1']); |
$text=&Apache::lonxml::get_all_text("endouttext",$$parser['-1']); |