';
}
@@ -163,6 +175,12 @@ sub problem_web_to_edit_header {
if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; }
$result.= ' /> Show All Foils
';
+ my $numtoanalyze=$ENV{'form.numtoanalyze'};
+ if (!$numtoanalyze) { $numtoanalyze=100; }
+ $result.= '
+ ';
+ return $result;
}
sub initialize_storage {
@@ -265,6 +283,7 @@ sub start_problem {
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
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') {
#handle exam checkout
if ($Apache::lonhomework::type eq 'exam') {
@@ -283,14 +302,20 @@ sub start_problem {
my $expression='$external::datestatus="'.$status.'";';
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';
&Apache::run::run($expression,$safeeval);
+ &Apache::lonxml::debug("Got $status");
if (( $status eq 'CLOSED' ) ||
( $status eq 'UNCHECKEDOUT') ||
- ( $status eq 'BANNED')) {
- my $bodytext=&Apache::lonxml::get_all_text("/problem",$$parser[$#$parser]);
+ ( $status eq 'BANNED') ||
+ ( $status eq 'UNAVAILABLE')) {
+ my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
if ( $target eq "web" ) {
$result.= $head_tag_start.'';
- my $msg=$body_tag_start.
- '
Not open to be viewed
';
+ my $msg=$body_tag_start;
+ if ($status eq 'UNAVAILABLE') {
+ $result.='
Unable to determine if this resource is open due to network problems. Please try again later.
';
+ } else {
+ $result.='
Not open to be viewed
';
+ }
if ($status eq 'CLOSED') {
$msg.='The problem '.$accessmsg;
} elsif ($status eq 'UNCHECKEDOUT') {
@@ -298,8 +323,13 @@ sub start_problem {
}
$result.=$msg.' ';
} 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 ";
- }
+ $result.="\\begin{document}\\noindent \\vskip 1 mm \\begin{minipage}{\\textwidth}\\vskip 0 mm ";
+ if ($status eq 'UNAVAILABLE') {
+ $result.='Unable to determine if this resource is open due to network problems. Please try again later.\vskip 0 mm ';
+ } else {
+ $result.="Problem is not open to be viewed. It $accessmsg \\vskip 0 mm ";
+ }
+ }
} elsif ($target eq 'web') {
my $name= &get_resource_name($parstack,$safeeval);
if ($status eq 'CAN_ANSWER') {
@@ -318,7 +348,7 @@ sub start_problem {
}
}
} elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER'
- || $status eq 'CLOSED') {
+ || $status eq 'CLOSED' || $status eq 'UNAVALAILABLE') {
$result.=$head_tag_start.
"$name\n$body_tag_start\n";
}
@@ -349,7 +379,7 @@ sub start_problem {
if(not $duedate=~m/1969/) {
$result .= '\begin{document} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent \begin{minipage}{\textwidth}';
} else {
- $result .= '\begin{document} \noindent \vskip 1 mm \begin{minipage}{\textwidth}';
+ $result .= '\begin{document} \noindent \vskip 1 mm \noindent\begin{minipage}{\textwidth}';
}
} else {
$result .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\';
@@ -389,9 +419,7 @@ sub end_problem {
$status ne 'UNCHECKEDOUT') {
# if part is zero, no s existed, so we need show the current
# grading status
- my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part);
- #FIXME this is ugly we should just generate tex in inputtags
- if ($target eq 'tex') { $gradestatus=&html_to_tex($gradestatus); }
+ my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target);
if ($Apache::lonhomework::type ne 'exam') {$result.= $gradestatus;}
}
if (
@@ -408,15 +436,15 @@ sub end_problem {
$result.="