Diff for /loncom/interface/lonnavmaps.pm between versions 1.509.2.14.2.9 and 1.509.2.14.2.12

version 1.509.2.14.2.9, 2023/07/06 20:32:17 version 1.509.2.14.2.12, 2025/05/28 13:42:14
Line 1366  sub cmp_title { Line 1366  sub cmp_title {
 sub render {  sub render {
     my $args = shift;      my $args = shift;
     &Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});      &Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});
     my $result = '';  
     # Configure the renderer.      # Configure the renderer.
     my $cols = $args->{'cols'};      my $cols = $args->{'cols'};
     if (!defined($cols)) {      if (!defined($cols)) {
         # no columns, no nav maps.          # no columns, no nav maps.
         return '';          return '';
     }      }
       my $legend = '';
       my $tools = '';
       my $result = '';
       my $tools_printed = 0;
       my $tablestarted = 0;
     my $navmap;      my $navmap;
     if (defined($args->{'navmap'})) {      if (defined($args->{'navmap'})) {
         $navmap = $args->{'navmap'};          $navmap = $args->{'navmap'};
Line 1584  sub render { Line 1588  sub render {
         
     # Print key?      # Print key?
     if ($printKey) {      if ($printKey) {
         $result .= '<table border="0" cellpadding="2" cellspacing="0">';          $legend = '<table border="0" cellpadding="2" cellspacing="0">';
         $result.='<tr><td align="right" valign="bottom">Key:&nbsp;&nbsp;</td>';          $legend .= '<tr><td align="right" valign="bottom">Key:&nbsp;&nbsp;</td>';
  my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");   my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");
         if ($navmap->{LAST_CHECK}) {          if ($navmap->{LAST_CHECK}) {
             $result .=               $legend .= 
                 '<img src="'.$location.'/chat.gif" alt="" /> '.&mt('New discussion since').' '.                  '<img src="'.$location.'/chat.gif" alt="" /> '.&mt('New discussion since').' '.
                 strftime("%A, %b %e at %I:%M %P", localtime($navmap->{LAST_CHECK})).                  strftime("%A, %b %e at %I:%M %P", localtime($navmap->{LAST_CHECK})).
                 '</td><td align="center" valign="bottom">&nbsp;&nbsp;'.                  '</td><td align="center" valign="bottom">&nbsp;&nbsp;'.
                 '<img src="'.$location.'/feedback.gif" alt="" /> '.&mt('New message (click to open)').'<p>'.                  '<img src="'.$location.'/feedback.gif" alt="" /> '.&mt('New message (click to open)').'<p>'.
                 '</td>';                   '</td>'; 
         } else {          } else {
             $result .= '<td align="center" valign="bottom">&nbsp;&nbsp;'.              $legend .= '<td align="center" valign="bottom">&nbsp;&nbsp;'.
                 '<img src="'.$location.'/chat.gif" alt="" /> '.&mt('Discussions').'</td><td align="center" valign="bottom">'.                  '<img src="'.$location.'/chat.gif" alt="" /> '.&mt('Discussions').'</td><td align="center" valign="bottom">'.
                 '&nbsp;&nbsp;<img src="'.$location.'/feedback.gif" alt="" /> '.&mt('New message (click to open)').                  '&nbsp;&nbsp;<img src="'.$location.'/feedback.gif" alt="" /> '.&mt('New message (click to open)').
                 '</td>';                   '</td>'; 
         }          }
   
         $result .= '</tr></table>';          $legend .= '</tr></table>';
     }      }
   
     if ($printCloseAll && !$args->{'resource_no_folder_link'}) {      if ($printCloseAll && !$args->{'resource_no_folder_link'}) {
Line 1621  sub render { Line 1625  sub render {
                               "location.href='$link'",$text);                                "location.href='$link'",$text);
             }              }
  } else {   } else {
     $result.= '<a href="'.$link.'">'.&mt($text).'</a>';      $tools = '<a href="'.$link.'">'.&mt($text).'</a>';
  }   }
         $result .= "\n";          $tools .= "\n";
     }      }
   
     # Check for any unread discussions in all resources.      # Check for any unread discussions in all resources.
Line 1633  sub render { Line 1637  sub render {
       'Mark all posts read');        'Mark all posts read');
  my $time=time;   my $time=time;
         my $querystr = &HTML::Entities::encode($ENV{'QUERY_STRING'},'<>&"');          my $querystr = &HTML::Entities::encode($ENV{'QUERY_STRING'},'<>&"');
  $result .= (<<END);   $tools .= (<<END);
     <form name="clearbubbles" method="post" action="/adm/feedback">      <form name="clearbubbles" method="post" action="/adm/feedback">
  <input type="hidden" name="navurl" value="$querystr" />   <input type="hidden" name="navurl" value="$querystr" />
  <input type="hidden" name="navtime" value="$time" />   <input type="hidden" name="navtime" value="$time" />
Line 1650  END Line 1654  END
     }      }
     if ($totdisc > 0) {      if ($totdisc > 0) {
  $haveDisc =~ s/:$//;   $haveDisc =~ s/:$//;
  $result .= (<<END);   $tools .= (<<END);
  <input type="hidden" name="navmaps" value="$haveDisc" />   <input type="hidden" name="navmaps" value="$haveDisc" />
     </form>      </form>
 END  END
             }              }
  }   }
  $result.='</form>';   $tools .= '</form>';
     }      }
     if (($args->{'caller'} eq 'navmapsdisplay') && ($env{'request.course.id'})) {      if (($args->{'caller'} eq 'navmapsdisplay') && ($env{'request.course.id'})) {
         my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};          my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
Line 1678  END Line 1682  END
     }      }
   
     if ($args->{'caller'} eq 'navmapsdisplay') {      if ($args->{'caller'} eq 'navmapsdisplay') {
         $result .= &show_linkitems_toolbar($args,$condition);          $tools .= &show_linkitems_toolbar($args,$condition);
     } elsif ($args->{'sort_html'}) {       } elsif ($args->{'sort_html'}) { 
         $result.=$args->{'sort_html'};           $tools .= $args->{'sort_html'}; 
     }      }
   
     #$result .= "<br />\n";      #$tools .= "<br />\n";
     if ($r) {  
         $r->print($result);  
         $r->rflush();  
         $result = "";  
     }  
     # End parameter setting      # End parameter setting
       
     $result .= "<br />\n";  
   
     # Data      # Data
     $result.=&Apache::loncommon::start_data_table("LC_tableOfContent");      
   
     my $res = "Apache::lonnavmaps::resource";      my $res = "Apache::lonnavmaps::resource";
     my %condenseStatuses =      my %condenseStatuses =
Line 1706  END Line 1702  END
     $args->{'counter'} = 0; # counts the rows      $args->{'counter'} = 0; # counts the rows
     $args->{'indentLevel'} = 0;      $args->{'indentLevel'} = 0;
     $args->{'isNewBranch'} = 0;      $args->{'isNewBranch'} = 0;
     $args->{'condensed'} = 0;         $args->{'condensed'} = 0;
       $args->{'deeplinknolist'} = 0;
   
     my $location = &Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif");      my $location = &Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif");
     $args->{'indentString'} = setDefault($args->{'indentString'}, "<img src='$location' alt='' />");      $args->{'indentString'} = setDefault($args->{'indentString'}, "<img src='$location' alt='' />");
Line 1882  END Line 1879  END
   
         # If this has been filtered out, continue on          # If this has been filtered out, continue on
         if (!(&$filterFunc($curRes))) {          if (!(&$filterFunc($curRes))) {
               if (!$userCanSeeHidden && !$curRes->randomout && $curRes->deeplinkout) {
                   $args->{'deeplinknolist'} ++;
               }
             $args->{'isNewBranch'} = 0; # Don't falsely remember this              $args->{'isNewBranch'} = 0; # Don't falsely remember this
             next;              next;
         }           } 
Line 1906  END Line 1906  END
                     if ($userCanSeeHidden) {                      if ($userCanSeeHidden) {
                         $args->{'mapHiddenDeepLink'} = 1;                          $args->{'mapHiddenDeepLink'} = 1;
                     } else {                      } else {
                           $args->{'deeplinknolist'} ++;
                         next;                          next;
                     }                      }
                 } else {                  } else {
Line 1915  END Line 1916  END
                         if ($userCanSeeHidden) {                          if ($userCanSeeHidden) {
                             $args->{'mapUnlisted'} = 1;                              $args->{'mapUnlisted'} = 1;
                         } else {                          } else {
                               $args->{'deeplinknolist'} ++;
                             next;                              next;
                         }                          }
                     }                      }
Line 1928  END Line 1930  END
         }          }
   
         $args->{'counter'}++;          $args->{'counter'}++;
           unless ($tablestarted) {
               $result .= "<br />\n".&Apache::loncommon::start_data_table("LC_tableOfContent");
               $tablestarted = 1;
           }
   
         # Does it have multiple parts?          # Does it have multiple parts?
         $args->{'multipart'} = 0;          $args->{'multipart'} = 0;
Line 2078  END Line 2084  END
         }          }
   
         if ($r && $rownum % 20 == 0) {          if ($r && $rownum % 20 == 0) {
               unless ($tools_printed) {
                   $r->print($legend.$tools);
                   $legend = "";
                   $tools = "";
                   $tools_printed = 1;
               }
             $r->print($result);              $r->print($result);
             $result = "";              $result = "";
             $r->rflush();              $r->rflush();
Line 2093  END Line 2105  END
  }   }
     }      }
   
     $result.=&Apache::loncommon::end_data_table();      if ($tablestarted) {
               $result.=&Apache::loncommon::end_data_table();
       }
   
     # Print out the part that jumps to #curloc if it exists      # Print out the part that jumps to #curloc if it exists
     # delay needed because the browser is processing the jump before      # delay needed because the browser is processing the jump before
     # it finishes rendering, so it goes to the wrong place!      # it finishes rendering, so it goes to the wrong place!
Line 2111  if (location.href.indexOf('#curloc')==-1 Line 2125  if (location.href.indexOf('#curloc')==-1
     }      }
   
     if ($r) {      if ($r) {
           unless ($tools_printed) {
               if (($args->{'counter'}) || ($userCanSeeHidden) ||
                   (($args->{'caller'} eq 'navmapsdisplay') &&
                    ($env{'form.showOnlyHomework'} ||
                     $ENV{QUERY_STRING} =~ /^jumpToFirstHomework/))) {
                   $r->print($legend.$tools);
               }
               $legend = "";
               $tools = "";
               $tools_printed = 1;
           }
         $r->print($result);          $r->print($result);
         $result = "";          $result = "";
         $r->rflush();          $r->rflush();
     }      }
                   
     return $result;      return $legend.$tools.$result;
 }  }
   
 sub add_linkitem {  sub add_linkitem {
Line 2274  sub new { Line 2299  sub new {
   
     $self->{USERNAME} = shift || $env{'user.name'};      $self->{USERNAME} = shift || $env{'user.name'};
     $self->{DOMAIN}   = shift || $env{'user.domain'};      $self->{DOMAIN}   = shift || $env{'user.domain'};
       $self->{SECTION}  = shift;
     $self->{CODE}     = shift;      $self->{CODE}     = shift;
     $self->{NOHIDE} = shift;      $self->{NOHIDE}   = shift;
   
   
       if (($self->{SECTION} eq '') && ($env{'request.course.sec'} ne '')) {
           if (($self->{USERNAME} eq $env{'user.name'}) &&
               ($self->{USERNAME} eq $env{'user.domain'})) {
               $self->{SECTION} = $env{'request.course.sec'};
           }
       }
   
     # Resource cache stores navmap resources as we reference them. We generate      # Resource cache stores navmap resources as we reference them. We generate
     # them on-demand so we don't pay for creating resources unless we use them.      # them on-demand so we don't pay for creating resources unless we use them.
Line 2319  sub new { Line 2351  sub new {
  $self->{PARM_HASH} = \%parmhash;   $self->{PARM_HASH} = \%parmhash;
  $self->{PARM_CACHE} = {};   $self->{PARM_CACHE} = {};
     } else {      } else {
  $self->change_user($self->{USERNAME}, $self->{DOMAIN},  $self->{CODE}, $self->{NOHIDE});   $self->change_user($self->{USERNAME}, $self->{DOMAIN}, $self->{SECTION}, $self->{CODE}, $self->{NOHIDE});
     }      }
   
     return $self;      return $self;
Line 2330  sub new { Line 2362  sub new {
 # username/domain associated with a navmap (e.g. to navigate for someone  # username/domain associated with a navmap (e.g. to navigate for someone
 # else besides the current user...if sufficiently privileged.  # else besides the current user...if sufficiently privileged.
 # Parameters:  # Parameters:
 #    user  - New user.  #    user    - New user.
 #    domain- Domain the user belongs to.  #    domain  - Domain to which the user belongs.
 #    code  - Anonymous CODE in use.  #    section - Section to which the user belongs.
   #    code    - Anonymous CODE in use.
 # Implicit inputs:  # Implicit inputs:
 #     #   
 sub change_user {  sub change_user {
     my $self = shift;      my $self = shift;
     $self->{USERNAME} = shift;      $self->{USERNAME} = shift;
     $self->{DOMAIN}   = shift;      $self->{DOMAIN}   = shift;
       $self->{SECTION}  = shift;
     $self->{CODE}     = shift;      $self->{CODE}     = shift;
     $self->{NOHIDE}   = shift;      $self->{NOHIDE}   = shift;
   
Line 2844  sub parmval_real { Line 2878  sub parmval_real {
     $self->generate_course_user_opt();      $self->generate_course_user_opt();
   
     my $cid=$env{'request.course.id'};      my $cid=$env{'request.course.id'};
     my $csec=$env{'request.course.sec'};      my $csec=$self->{SECTION};
     my $cgroup='';      my $cgroup='';
     my @cgrps=split(/:/,$env{'request.course.groups'});      my @cgrps=split(/:/,$env{'request.course.groups'});
     if (@cgrps > 0) {      if (@cgrps > 0) {
Line 2957  sub parmval_real { Line 2991  sub parmval_real {
 }  }
   
 sub recurseup_maps {  sub recurseup_maps {
     my ($self,$mapname) = @_;      my ($self,$mapname,$getsymb) = @_;
     my @recurseup;      my @recurseup;
     if ($mapname) {      if ($mapname) {
         my $res = $self->getResourceByUrl($mapname);          my $res = $self->getResourceByUrl($mapname);
Line 2965  sub recurseup_maps { Line 2999  sub recurseup_maps {
             my @pcs = split(/,/,$res->map_hierarchy());              my @pcs = split(/,/,$res->map_hierarchy());
             shift(@pcs);              shift(@pcs);
             if (@pcs) {              if (@pcs) {
                 @recurseup = map { &Apache::lonnet::declutter($self->getByMapPc($_)->src()); } reverse(@pcs);                  if ($getsymb) {
                       @recurseup = map { &Apache::lonnet::declutter($self->getByMapPc($_)->symb()); } reverse(@pcs);
                   } else {
                       @recurseup = map { &Apache::lonnet::declutter($self->getByMapPc($_)->src()); } reverse(@pcs);
                   }
             }              }
         }          }
     }      }
Line 3093  sub get_mapparam { Line 3131  sub get_mapparam {
     # Get the course id and section if there is one.      # Get the course id and section if there is one.
   
     my $cid=$env{'request.course.id'};      my $cid=$env{'request.course.id'};
     my $csec=$env{'request.course.sec'};      my $csec=$self->{SECTION};
     my $cgroup='';      my $cgroup='';
     my @cgrps=split(/:/,$env{'request.course.groups'});      my @cgrps=split(/:/,$env{'request.course.groups'});
     if (@cgrps > 0) {      if (@cgrps > 0) {
Line 3262  sub getcourseparam { Line 3300  sub getcourseparam {
   
     my $uname = $self->{USERNAME};      my $uname = $self->{USERNAME};
     my $udom  = $self->{DOMAIN};      my $udom  = $self->{DOMAIN};
       my $csec  = $self->{SECTION};
           
     # Course, section, group ids come from the env:      # Course and group ids come from the env:
   
     my $cid   = $env{'request.course.id'};      my $cid   = $env{'request.course.id'};
     my $csec  = $env{'request.course.sec'};  
     my $cgroup = ''; # Assume no group      my $cgroup = ''; # Assume no group
   
     my @cgroups = split(/:/, $env{'request.course.groups'});      my @cgroups = split(/:/, $env{'request.course.groups'});
Line 5128  sub weight { Line 5166  sub weight {
     my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight',      my $weight = &Apache::lonnet::EXT('resource.'.$part.'.weight',
                                 $self->{SYMB}, $self->{DOMAIN},                                  $self->{SYMB}, $self->{DOMAIN},
                                 $self->{USERNAME},                                  $self->{USERNAME},
                                 $env{'request.course.sec'});                                  $self->{SECTION});
     return $weight;      return $weight;
 }  }
 sub part_display {  sub part_display {

Removed from v.1.509.2.14.2.9  
changed lines
  Added in v.1.509.2.14.2.12


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