Diff for /loncom/interface/lonnavmaps.pm between versions 1.458 and 1.459

version 1.458, 2011/03/14 15:48:00 version 1.459, 2011/05/18 11:26:44
Line 483  use POSIX qw (floor strftime); Line 483  use POSIX qw (floor strftime);
 use Time::HiRes qw( gettimeofday tv_interval );  use Time::HiRes qw( gettimeofday tv_interval );
 use LONCAPA;  use LONCAPA;
 use DateTime();  use DateTime();
   use Data::Dumper;
 # symbolic constants  # symbolic constants
 sub SYMB { return 1; }  sub SYMB { return 1; }
 sub URL { return 2; }  sub URL { return 2; }
Line 2399  sub parmval { Line 2399  sub parmval {
     my $self = shift;      my $self = shift;
     my ($what,$symb,$recurse)=@_;      my ($what,$symb,$recurse)=@_;
     my $hashkey = $what."|||".$symb;      my $hashkey = $what."|||".$symb;
       my $cache = $self->{PARM_CACHE};
     if (defined($self->{PARM_CACHE}->{$hashkey})) {      if (defined($self->{PARM_CACHE}->{$hashkey})) {
         if (ref($self->{PARM_CACHE}->{$hashkey}) eq 'ARRAY') {           if (ref($self->{PARM_CACHE}->{$hashkey}) eq 'ARRAY') { 
             if (defined($self->{PARM_CACHE}->{$hashkey}->[0])) {              if (defined($self->{PARM_CACHE}->{$hashkey}->[0])) {
Line 2414  sub parmval { Line 2414  sub parmval {
         }          }
     }      }
     my $result = $self->parmval_real($what, $symb, $recurse);      my $result = $self->parmval_real($what, $symb, $recurse);
       my $dumper = Data::Dumper->new([$result]);
     $self->{PARM_CACHE}->{$hashkey} = $result;      $self->{PARM_CACHE}->{$hashkey} = $result;
     if (wantarray) {      if (wantarray) {
         return @{$result};          return @{$result};
Line 3743  my %incomplete_hash = Line 3744  my %incomplete_hash =
 sub is_incomplete {  sub is_incomplete {
     my $self = shift;      my $self = shift;
     if ($self->is_problem()) {      if ($self->is_problem()) {
  &Apache::lonnet::logthis('is problem');  
  foreach my $part (@{$self->parts()}) {   foreach my $part (@{$self->parts()}) {
     &Apache::lonnet::logthis("$part status ".$self->status($part));  
     if (exists($incomplete_hash{$self->status($part)})) {      if (exists($incomplete_hash{$self->status($part)})) {
  return 1;   return 1;
     }      }
Line 3930  their code.) Line 3929  their code.)
   
 =over 4  =over 4
   
 =item * B<acc>:  =item * B<printable>
   
   returns true if the current date is such that the 
   specified resource part is printable.
   
   =item * B<resprintable>
   
   Returns true if all parts in the resource are printable making the
   entire resource printable.
   
   =item * B<acc>
   
 Get the Client IP/Name Access Control information.  Get the Client IP/Name Access Control information.
   
Line 3983  Get the weight for the problem. Line 3992  Get the weight for the problem.
   
 =cut  =cut
   
   sub printable {
   
       &Apache::lonnet::logthis("Printable");
       my ($self, $part) = @_;
   
       # Get the print open/close dates for the resource.
   
       my $start = $self->parmval("printopendate", $part);
       my $end   = $self->parmval("printclosedate", $part);
       my $dumper = Data::Dumper->new([$self, $part, $start, $end]);
       &Apache::lonnet::logthis("Start for " . $dumper->Dump);
   
       #  The following cases apply:
       #  - No dates set: Printable.
       #  - Start date set but no end date: Printable if now >= start date.
       #  - End date set but no start date: Printable if now <= end date.
       #  - both defined: printable if start <= now <= end
       #
       my $now  = time();
   
       my $startok = 1;
       my $endok   = 1;
   
       if ($start ne '') {
    $startok = $start <= $now;
       }
       if ($end  ne '') {
    $endok = $end >= $now;
       }
       return $startok && $endok;
   }
   
   sub resprintable {
       my $self = shift;
   
       # get parts...or realize there are no parts.
   
       my $parts = $self->parts();
       if ($parts == 0) {
    return $self->printable(0);
       } else {
    foreach my $part  (@$parts) {
       if (!$self->printable($part)) { return 0; }
    }
    return 1;
       }
   }
   
 sub acc {  sub acc {
     (my $self, my $part) = @_;      (my $self, my $part) = @_;
     my $acc = $self->parmval("acc", $part);      my $acc = $self->parmval("acc", $part);
Line 4035  sub checkedin { Line 4092  sub checkedin {
     }      }
 }  }
 # this should work exactly like the copy in lonhomework.pm  # this should work exactly like the copy in lonhomework.pm
   # Why is there a copy in lonhomework?  Why not centralized?
   #
   #  TODO: Centralize duedate.
   #
   
 sub duedate {  sub duedate {
     (my $self, my $part) = @_;      (my $self, my $part) = @_;
     my $date;      my $date;

Removed from v.1.458  
changed lines
  Added in v.1.459


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