Diff for /loncom/homework/structuretags.pm between versions 1.152 and 1.157

version 1.152, 2003/03/03 15:59:42 version 1.157, 2003/04/02 19:52:05
Line 241  ENDCHECKOUT Line 241  ENDCHECKOUT
 sub start_problem {  sub start_problem {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;    my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   
     $Apache::lonhomework::parsing_a_problem=1;
   # meta is called from lonpublisher, which doesn't uses the normal    # meta is called from lonpublisher, which doesn't uses the normal
   # lonhomework method of parsing the file which means that inputtags     # lonhomework method of parsing the file which means that inputtags 
   # won't get reset    # won't get reset
Line 253  sub start_problem { Line 254  sub start_problem {
   $Apache::inputtags::part='0';    $Apache::inputtags::part='0';
   @Apache::inputtags::responselist = ();    @Apache::inputtags::responselist = ();
   @Apache::inputtags::previous=();    @Apache::inputtags::previous=();
     @Apache::inputtags::previous_version=();
   $Apache::structuretags::printanswer='No';    $Apache::structuretags::printanswer='No';
   if ($target ne 'analyze') {    if ($target ne 'analyze') {
     &initialize_storage();      &initialize_storage();
Line 335  sub start_problem { Line 337  sub start_problem {
       my $name= &get_resource_name($parstack,$safeeval);        my $name= &get_resource_name($parstack,$safeeval);
       if ($status eq 'CAN_ANSWER') {        if ($status eq 'CAN_ANSWER') {
  # create a page header and exit   # create a page header and exit
    my $WeightOfProblem = '';
    if ($Apache::lonhomework::type eq 'exam') {
        my $weight = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.weight");
             $WeightOfProblem = "<table border=1><tr><td><i>$weight pt</i></td></tr></table>";
    }
  $result.="$head_tag_start<title>$name</title></head>   $result.="$head_tag_start<title>$name</title></head>
               $body_tag_start \n $form_tag_start".                $body_tag_start \n $form_tag_start $WeightOfProblem".
  '<input type="hidden" name="submitted" value="yes" />';   '<input type="hidden" name="submitted" value="yes" />';
  if ($ENV{'request.state'} eq "construct") {   if ($ENV{'request.state'} eq "construct") {
   $result.= &problem_web_to_edit_header($rndseed);    $result.= &problem_web_to_edit_header($rndseed);
Line 382  sub start_problem { Line 389  sub start_problem {
  my @due_file_content = <$temp_file>;   my @due_file_content = <$temp_file>;
  my $due_file_content = $due_file_content[$#due_file_content];   my $due_file_content = $due_file_content[$#due_file_content];
         chomp $due_file_content;          chomp $due_file_content;
    my $name_of_resourse= &get_resource_name($parstack,$safeeval);
         if ($due_file_content ne $duedate) {              if ($due_file_content ne $duedate) {    
  $temp_file = Apache::File->new('>'.$filename);    $temp_file = Apache::File->new('>'.$filename); 
     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/ and $Apache::lonhomework::type ne 'exam') {   if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
     $result .= '\begin{document} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent \begin{minipage}{\textwidth}';      $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent \begin{minipage}{\textwidth}';
  } else {   } else {
     $result .= '\begin{document} \noindent \vskip 1 mm \noindent\begin{minipage}{\textwidth}';      $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm \noindent\begin{minipage}{\textwidth}';
     if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';}      if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
  }   }
     } else {      } else {
Line 397  sub start_problem { Line 405  sub start_problem {
     }       } 
  } else {   } else {
     if (not $ENV{'request.symb'} =~ m/\.page_/) {      if (not $ENV{'request.symb'} =~ m/\.page_/) {
  $result .= '\begin{document} \noindent \vskip 1 mm\noindent\begin{minipage}{\textwidth}';   $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm\noindent\begin{minipage}{\textwidth}';
  if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}   if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
     } else {      } else {
  $result .= '\vskip 1mm \\\\\\\\';   $result .= '\vskip 1mm \\\\\\\\';
Line 432  sub end_problem { Line 440  sub end_problem {
       # 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,$target);        my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target);
       if ($Apache::lonhomework::type ne 'exam') {$result.= $gradestatus;}        $result.= $gradestatus;
     }      }
     if (      if (
  (($target eq 'web') && ($ENV{'request.state'} ne 'construct')) ||   (($target eq 'web') && ($ENV{'request.state'} ne 'construct')) ||
Line 475  sub end_problem { Line 483  sub end_problem {
     &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();
   }    }
   
     undef(%Apache::lonhomework::history);
     undef(%Apache::lonhomework::results);
     undef($Apache::inputtags::part);
     undef($Apache::lonhomework::parsing_a_problem);
   
   return $result;    return $result;
 }  }
   
Line 678  sub start_part { Line 692  sub start_part {
   $Apache::inputtags::part=$id;    $Apache::inputtags::part=$id;
   @Apache::inputtags::responselist = ();    @Apache::inputtags::responselist = ();
   @Apache::inputtags::previous=();    @Apache::inputtags::previous=();
     @Apache::inputtags::previous_version=();
   my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);    my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
   
   if ($target eq 'meta') {    if ($target eq 'meta') {
Line 741  sub end_part { Line 756  sub end_part {
     $result=$gradestatus;      $result=$gradestatus;
   }    }
   pop @Apache::inputtags::status;    pop @Apache::inputtags::status;
     $Apache::inputtags::part='';
   return $result;    return $result;
 }  }
   

Removed from v.1.152  
changed lines
  Added in v.1.157


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>