--- loncom/homework/structuretags.pm 2005/11/03 11:32:00 1.309
+++ loncom/homework/structuretags.pm 2005/11/04 15:34:32 1.315
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.309 2005/11/03 11:32:00 foxr Exp $
+# $Id: structuretags.pm,v 1.315 2005/11/04 15:34:32 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -245,9 +245,11 @@ sub option {
sub problem_web_to_edit_header {
my ($rndseed)=@_;
- my $result.='
-
-
+ my $result.='';
+ if (!$Apache::lonhomework::parsing_a_task) {
+ $result .= '';
+ }
+ $result .= '
@@ -255,11 +257,17 @@ sub problem_web_to_edit_header {
$rndseed.'"
onchange="javascript:document.lonhomework.changerandseed.click()" />
';
- $result.="
+ if (!$Apache::lonhomework::parsing_a_task) {
+ $result.="
Problem Status:
";
- my $numtoanalyze=$env{'form.numtoanalyze'};
- if (!$numtoanalyze) { $numtoanalyze=20; }
- $result.= ' for
+ my $numtoanalyze=$env{'form.numtoanalyze'};
+ if (!$numtoanalyze) { $numtoanalyze=20; }
+ $result.= ' for
'.&mt('versions of this problem').
'.'.&Apache::loncommon::help_open_topic("Analyze_Problem",
'',undef,undef,300).
'';
+ }
return $result;
}
@@ -422,10 +431,6 @@ sub firstaccess_msg {
ENDCHECKOUT
}
-# initializes the problem globals across the inputtags, lonhomework, and
-# structuretags modules.
-#
-#
sub init_problem_globals {
my ($type)=@_;
#initialize globals
@@ -499,6 +504,9 @@ sub get_problem_status {
sub start_problem {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ # We'll use the redirection to fix up printing of duedates.
+ &Apache::lonxml::startredirection();
+
# Problems don't nest and we don't allow more than one in
# a .problem file.
#
@@ -670,18 +678,17 @@ sub start_problem {
my $toc_line='\vskip 1 mm\noindent '.$startminipage.
'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
- # Figure out what the due date is and if we need to print it in the problem header.
- # We have been logging the last due date written to file.
- #
-
+ # Figure out what the due date is and if we need to print
+ # it in the problem header. We have been logging the
+ # last due date written to file.
my $duetime = &Apache::lonnet::EXT("resource.$id.duedate");
my $duedate = POSIX::strftime("%c",localtime($duetime));
my $temp_file;
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due";
- # Figure out what the last printed due date is or set it to the epoch if no duedates
- # have been printed.
+ # Figure out what the last printed due date is or set it
+ # to the epoch if no duedates have been printed.
my $due_file_content = 0; # If the file does not yet exist, time is the epoch.
if (-e $filename) {
@@ -690,9 +697,8 @@ sub start_problem {
$due_file_content = $due_file[$#due_file];
chomp $due_file_content;
}
- # The big change; Due do the comparison on
- # the absolute time rather than textual time since that is format independent.
- #
+
+ # comparisons of the absolute times
if ($due_file_content != $duetime) {
$temp_file = Apache::File->new('>'.$filename);
print $temp_file "$duetime\n";
@@ -716,7 +722,6 @@ sub start_problem {
}
}
}
- &Apache::lonxml::startredirection; # We'll do redirection to deal with duedates.
} elsif ($target eq 'edit') {
$result.=$head_tag_start."".$body_tag_start.$form_tag_start.
&problem_edit_header();
@@ -736,10 +741,8 @@ sub start_problem {
sub end_problem {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- my $result='';
- if ($target eq 'tex') {
- $result = &Apache::lonxml::endredirection;
- }
+ my $result= &Apache::lonxml::endredirection(); # started in &start_problem
+
my $status=$Apache::inputtags::status['-1'];
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex') {
@@ -807,7 +810,7 @@ sub end_problem {
$result.=&Apache::response::meta_response_order();
} elsif ($target eq 'edit') {
&Apache::lonxml::debug("in end_problem with $target, edit");
- $result = &problem_edit_footer();
+ $result .= &problem_edit_footer();
}
if ($env{'request.state'} eq 'construct' && $target eq 'web') {
@@ -1179,6 +1182,8 @@ sub ordered_show_check {
sub start_part {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ &Apache::lonxml::startredirection(); # we'll use redirection to fix up
+ # duedates.
my $result='';
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }
@@ -1287,13 +1292,11 @@ sub end_part {
my $status=$Apache::inputtags::status['-1'];
my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
my $in_order_show=&ordered_show_check();
- my $result='';
- if ( $target eq 'meta' ) {
- $result='';
- } elsif ($target eq 'grade') {
+ my $result= &Apache::lonxml::endredirection(); # started in &start_part
+ if ($target eq 'grade') {
if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) &&
!$hidden && $in_order_show) {
- $result=&Apache::inputtags::grade;
+ $result.=&Apache::inputtags::grade;
} else {
# move any submission data to .hidden
&Apache::inputtags::hidealldata($Apache::inputtags::part);
@@ -1305,10 +1308,10 @@ sub end_part {
if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') {
$gradestatus='';
}
- $result=$gradestatus;
+ $result.=$gradestatus;
if ($$tagstack[-2] eq 'td' and $target eq 'tex') {$result.='\end{minipage}';}
} elsif ($target eq 'edit') {
- $result=&Apache::edit::end_table();
+ $result.=&Apache::edit::end_table();
}
pop @Apache::inputtags::status;
$Apache::inputtags::part='';