Diff for /loncom/interface/lonnavmaps.pm between versions 1.191 and 1.192

version 1.191, 2003/05/16 14:17:08 version 1.192, 2003/05/16 17:54:21
Line 47  use Apache::Constants qw(:common :http); Line 47  use Apache::Constants qw(:common :http);
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonmenu();  use Apache::lonmenu();
 use POSIX qw (floor strftime);  use POSIX qw (floor strftime);
   use Data::Dumper; # for debugging, not always used
   
 # symbolic constants  # symbolic constants
 sub SYMB { return 1; }  sub SYMB { return 1; }
Line 838  sub render_resource { Line 839  sub render_resource {
     my $icon = "<img src='/adm/lonIcons/html.gif' alt='' border='0' />";      my $icon = "<img src='/adm/lonIcons/html.gif' alt='' border='0' />";
           
     if ($resource->is_problem()) {      if ($resource->is_problem()) {
         if ($part eq "" || $params->{'condensed'}) {          if ($part eq '0' || $params->{'condensed'}) {
             $icon = '<img src="/adm/lonIcons/problem.gif" alt="" border="0" />';              $icon = '<img src="/adm/lonIcons/problem.gif" alt="" border="0" />';
         } else {          } else {
             $icon = $params->{'indentString'};              $icon = $params->{'indentString'};
Line 908  sub render_resource { Line 909  sub render_resource {
         $params->{'displayedHereMarker'} = 1;          $params->{'displayedHereMarker'} = 1;
     }      }
   
     if ($resource->is_problem() && $part ne "" &&       if ($resource->is_problem() && $part ne '0' && 
         !$params->{'condensed'}) {          !$params->{'condensed'}) {
         $partLabel = " (Part $part)";          $partLabel = " (Part $part)";
         $title = "";          $title = "";
Line 1000  sub render_long_status { Line 1001  sub render_long_status {
         $params->{'multipart'} && $part eq "0";          $params->{'multipart'} && $part eq "0";
                                   
     my $color;      my $color;
     if ($resource->is_problem()) {      if ($resource->is_problem() && ($resource->countParts() <= 1 || $part ne '') ) {
         $color = $colormap{$resource->status};          $color = $colormap{$resource->status};
                   
         if (dueInLessThen24Hours($resource, $part) ||          if (dueInLessThen24Hours($resource, $part) ||
Line 1373  sub render { Line 1374  sub render {
         # Decide what parts to show.          # Decide what parts to show.
         if ($curRes->is_problem() && $showParts) {          if ($curRes->is_problem() && $showParts) {
             @parts = @{$curRes->parts()};              @parts = @{$curRes->parts()};
             $args->{'multipart'} = scalar(@parts) > 1;              $args->{'multipart'} = $curRes->multipart();
                           
             if ($condenseParts) { # do the condensation              if ($condenseParts) { # do the condensation
                 if (!$curRes->opendate("0")) {                  if (!$curRes->opendate("0")) {
Line 1382  sub render { Line 1383  sub render {
                 }                  }
                 if (!$args->{'condensed'}) {                  if (!$args->{'condensed'}) {
                     # Decide whether to condense based on similarity                      # Decide whether to condense based on similarity
                     my $status = $curRes->status($parts[1]);                      my $status = $curRes->status($parts[0]);
                     my $due = $curRes->duedate($parts[1]);                      my $due = $curRes->duedate($parts[0]);
                     my $open = $curRes->opendate($parts[1]);                      my $open = $curRes->opendate($parts[0]);
                     my $statusAllSame = 1;                      my $statusAllSame = 1;
                     my $dueAllSame = 1;                      my $dueAllSame = 1;
                     my $openAllSame = 1;                      my $openAllSame = 1;
                     for (my $i = 2; $i < scalar(@parts); $i++) {                      for (my $i = 1; $i < scalar(@parts); $i++) {
                         if ($curRes->status($parts[$i]) != $status){                          if ($curRes->status($parts[$i]) != $status){
                             $statusAllSame = 0;                              $statusAllSame = 0;
                         }                          }
Line 1409  sub render { Line 1410  sub render {
                     if (($statusAllSame && defined($condenseStatuses{$status})) ||                      if (($statusAllSame && defined($condenseStatuses{$status})) ||
                         ($dueAllSame && $status == $curRes->OPEN && $statusAllSame)||                          ($dueAllSame && $status == $curRes->OPEN && $statusAllSame)||
                         ($openAllSame && $status == $curRes->OPEN_LATER && $statusAllSame) ){                          ($openAllSame && $status == $curRes->OPEN_LATER && $statusAllSame) ){
                         @parts = ();                          @parts = ($parts[0]);
                         $args->{'condensed'} = 1;                          $args->{'condensed'} = 1;
                     }                      }
                                           
Line 1420  sub render { Line 1421  sub render {
         # If the multipart problem was condensed, "forget" it was multipart          # If the multipart problem was condensed, "forget" it was multipart
         if (scalar(@parts) == 1) {          if (scalar(@parts) == 1) {
             $args->{'multipart'} = 0;              $args->{'multipart'} = 0;
           } else {
               # Add part 0 so we display it correctly.
               unshift @parts, '0';
         }          }
   
         # Now, we've decided what parts to show. Loop through them and          # Now, we've decided what parts to show. Loop through them and
         # show them.          # show them.
         foreach my $part ('', @parts) {          foreach my $part (@parts) {
             if ($part eq '0') {  
                 next;  
             }  
             $rownum ++;              $rownum ++;
             my $backgroundColor = $backgroundColors[$rownum % scalar(@backgroundColors)];              my $backgroundColor = $backgroundColors[$rownum % scalar(@backgroundColors)];
                           
Line 3223  number of parts in the problem, not incl Line 3224  number of parts in the problem, not incl
 B<parts> may return an array with more parts in it then countParts  B<parts> may return an array with more parts in it then countParts
 might lead you to believe.  might lead you to believe.
   
   =item * B<multipart>():
   
   Returns true if the problem is multipart, false otherwise.
   
 =item * B<responseType>($part):  =item * B<responseType>($part):
   
 Returns the response type of the part, without the word "response" on the  Returns the response type of the part, without the word "response" on the
Line 3239  Retreives the response ID for the given Line 3244  Retreives the response ID for the given
 sub parts {  sub parts {
     my $self = shift;      my $self = shift;
   
     if ($self->ext) { return ['0']; }      if ($self->ext) { return []; }
   
     $self->extractParts();      $self->extractParts();
     return $self->{PARTS};      return $self->{PARTS};
Line 3263  sub countParts { Line 3268  sub countParts {
     return scalar(@{$parts}); # + $delta;      return scalar(@{$parts}); # + $delta;
 }  }
   
   sub multipart {
       my $self = shift;
       return $self->countParts() > 1;
   }
   
 sub responseType {  sub responseType {
     my $self = shift;      my $self = shift;
     my $part = shift;      my $part = shift;

Removed from v.1.191  
changed lines
  Added in v.1.192


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