Diff for /loncom/homework/lonhomework.pm between versions 1.273 and 1.277

version 1.273, 2007/08/31 19:32:57 version 1.277, 2007/10/17 00:22:51
Line 63  BEGIN { Line 63  BEGIN {
 }  }
   
   
   =pod
   
   =item set_bubble_lines()
   
   Called at analysis time to set the bubble lines
   hash for the problem.. This should be called in the
   end_problemtype tag in analysis mode.
   
   We fetch the hash of part id counters from lonxml
       and push them into analyze:{part_id.bubble_lines}.
   
   =cut
   
   sub set_bubble_lines {
       my %bubble_counters = &Apache::lonxml::get_bubble_line_hash();
   
       foreach my $key (keys(%bubble_counters)) {
    $Apache::lonhomework::analyze{"$key.bubble_lines"} =
       $bubble_counters{"$key"};
       }
   }
   
 #  #
 # Decides what targets to render for.  # Decides what targets to render for.
 # Implicit inputs:  # Implicit inputs:
Line 376  sub check_access { Line 398  sub check_access {
     if ($env{'request.state'} eq "construct") {      if ($env{'request.state'} eq "construct") {
  if ($env{'form.problemstate'}) {   if ($env{'form.problemstate'}) {
     if ($env{'form.problemstate'} =~ /^CANNOT_ANSWER/) {      if ($env{'form.problemstate'} =~ /^CANNOT_ANSWER/) {
  if ( ! ($env{'form.problemstate'} eq 'CANNOT_ANSWER_correct' &&   if ( ! ($env{'form.problemstate'} eq 'CANNOT_ANSWER_correct' 
  lc($Apache::lonhomework::problemstatus) eq 'no')) {   && &hide_problem_status())) {
     return ('CANNOT_ANSWER',      return ('CANNOT_ANSWER',
     &mt('is in this state due to author settings.'));      &mt('is in this state due to author settings.'));
  }   }
Line 436  sub check_access { Line 458  sub check_access {
  $date = &mt("an indeterminate date"); $passed = 0;   $date = &mt("an indeterminate date"); $passed = 0;
     } else {      } else {
  if (time < $date) { $passed = 0; } else { $passed = 1; }   if (time < $date) { $passed = 0; } else { $passed = 1; }
  $date = localtime $date;   $date = &Apache::lonlocal::locallocaltime($date);
     }      }
     if (!$passed) { $type=$temp; last; }      if (!$passed) { $type=$temp; last; }
  }   }
Line 467  sub check_access { Line 489  sub check_access {
  # if (correct and show prob status) or excused then CANNOT_ANSWER   # if (correct and show prob status) or excused then CANNOT_ANSWER
  if(($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/   if(($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/
     &&      &&
     lc($Apache::lonhomework::problemstatus) ne 'no')      &show_problem_status())
    ||     ||
    $Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) {     $Apache::lonhomework::history{"resource.$id.solved"}=~/^excused/) {
     $status = 'CANNOT_ANSWER';      $status = 'CANNOT_ANSWER';
Line 788  sub analyze { Line 810  sub analyze {
  $i++;   $i++;
     }      }
  }   }
    if (!keys(%{ $analyze{$part.'.answer'} })) {
       my $answer_part = 
    ['<span class="LC_error">'.&mt('Error').'</span>'];
       $seedexample{join("\0",$part,0,@{$answer_part})}=
    $thisseed;
       push( @{ $overall{$part.'.answer'}[0] },
     $answer_part);
    }
     }      }
  }   }
     }      }
Line 831  sub analyze { Line 861  sub analyze {
     return $result;      return $result;
 }  }
   
   {
       my $show_problem_status;
       sub reset_show_problem_status {
    undef($show_problem_status);
       }
   
       sub set_show_problem_status {
    my ($new_status) = @_;
    $show_problem_status = lc($new_status);
       }
   
       sub hide_problem_status {
    return ($show_problem_status eq 'no'
    || $show_problem_status eq 'no_feedback_ever');
       }
   
       sub show_problem_status {
    return ($show_problem_status eq 'yes'
    || $show_problem_status eq '');
       }
       
       sub show_some_problem_status {
    return ($show_problem_status eq 'no');
       }
   
       sub show_no_problem_status {
    return ($show_problem_status eq 'no_feedback_ever');
       }
   }
   
 sub editxmlmode {  sub editxmlmode {
     my ($request,$file) = @_;      my ($request,$file) = @_;
     my $result;      my $result;

Removed from v.1.273  
changed lines
  Added in v.1.277


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