version 1.116, 2002/09/23 17:25:24
|
version 1.122, 2002/10/02 18:14:07
|
Line 297 sub start_problem {
|
Line 297 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 347 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 387 sub end_problem {
|
Line 389 sub end_problem {
|
$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 |
my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part); |
my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target); |
#FIXME this is ugly we should just generate tex in inputtags |
if ($Apache::lonhomework::type ne 'exam') {$result.= $gradestatus;} |
if ($target eq 'tex') { $gradestatus=&html_to_tex($gradestatus); } |
|
$result.= $gradestatus; |
|
} |
} |
if ( |
if ( |
(($target eq 'web') && ($ENV{'request.state'} ne 'construct')) || |
(($target eq 'web') && ($ENV{'request.state'} ne 'construct')) || |
Line 411 sub end_problem {
|
Line 411 sub end_problem {
|
} else { |
} else { |
$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{document} '; |
$result .= '\end{minipage}\end{document} '; |
} else { |
} else { |
$result .= '} '; |
$result .= ''; |
} |
} |
} |
} |
} |
} |
Line 432 sub end_problem {
|
Line 432 sub end_problem {
|
return $result; |
return $result; |
} |
} |
|
|
#FIXME I am ugly shoot me |
|
sub html_to_tex { |
|
my ($string)=@_; |
|
$string =~ s/<table>//; |
|
$string =~ s/<\/table>//; |
|
$string =~ s/<tr([^>]*)>//g; |
|
$string =~ s/<\/tr>//g; |
|
$string =~ s/<td([^>]*)>//g; |
|
$string =~ s/<\/td>//g; |
|
$string =~ s/<b>/\\textbf{/g; |
|
$string =~ s/<\/b>/}/g; |
|
$string =~ s/<br \/>/\\vskip 0 mm /g; |
|
$string =~ s/<input([^>]*)>//g; |
|
return $string; |
|
} |
|
|
|
sub start_library { |
sub start_library { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
Line 601 sub shuffle {
|
Line 586 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 659 sub end_part {
|
Line 644 sub end_part {
|
return &Apache::inputtags::grade; |
return &Apache::inputtags::grade; |
} |
} |
if ($target eq 'web' || $target eq 'tex' ) { |
if ($target eq 'web' || $target eq 'tex' ) { |
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part); |
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,$target); |
#FIXME this is ugly we should just generate tex in inputtags |
if ($Apache::lonhomework::type eq 'exam') {$gradestatus='';} |
if ($target eq 'tex') { $gradestatus=&html_to_tex($gradestatus); } |
|
return $gradestatus; |
return $gradestatus; |
} |
} |
return ''; |
return ''; |