Diff for /loncom/interface/lonnavmaps.pm between versions 1.366 and 1.376

version 1.366, 2006/03/04 05:55:43 version 1.376, 2006/04/10 21:40:08
Line 194  MENU Line 194  MENU
 MENU  MENU
  }   }
         $r->send_http_header;          $r->send_http_header;
  my $html=&Apache::lonxml::xmlbegin();   my $js =<<"ENDSUBM";
  $r->print(<<"ENDSUBM");  
  $html  
         <head>  
   <script type="text/javascript">    <script type="text/javascript">
      function submitthis() {       function submitthis() {
     $menu      $menu
Line 205  MENU Line 202  MENU
     }      }
   
    </script>     </script>
         </head>  
  <body bgcolor="#FFFFFF" onLoad="submitthis()"></body>  
         </html>  
 ENDSUBM  ENDSUBM
           $r->print(&Apache::loncommon::start_page(undef,$js,
    {'only_body' => 1,
     'bgcolor'   => '#FFFFFF',
     'add_entries' => 
         {'onload' =>
      "submitthis()"}}).
     &Apache::loncommon::end_page());
   
         return OK;          return OK;
     }      }
     if ($ENV{QUERY_STRING} =~ /^launchExternal/) {      if ($ENV{QUERY_STRING} =~ /^launchExternal/) {
Line 239  MENU Line 241  MENU
         return HTTP_NOT_ACCEPTABLE;          return HTTP_NOT_ACCEPTABLE;
     }      }
     $r->send_http_header;      $r->send_http_header;
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print("$html<head>\n");  
     $r->print("<title>".&mt('Navigate Course Contents')."</title>");  
 # ------------------------------------------------------------ Get query string  # ------------------------------------------------------------ Get query string
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort','showOnlyHomework','postsymb']);      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort','showOnlyHomework','postsymb']);
           
 # ----------------------------------------------------- Force menu registration  # ----------------------------------------------------- Force menu registration
     my $addentries='';  
     my $more_unload;  
     my $body_only='';      my $body_only='';
       my $js;
     if ($env{'environment.remotenavmap'} eq 'on') {      if ($env{'environment.remotenavmap'} eq 'on') {
  $r->print('<script type="text/javascript">   $js='<script type="text/javascript">
                       function collapse() {                  function collapse() {
                          this.document.location="/adm/navmaps?collapseExternal";                     this.document.location="/adm/navmaps?collapseExternal";
                       }                  }
                    </script>');               </script>';
 # FIXME need to be smarter to only catch window close events  
 # $more_unload="collapse()"  
  $body_only=1;   $body_only=1;
     }      }
     if ($env{'form.register'}) {  
  $addentries=' onLoad="'.&Apache::lonmenu::loadevents().  
     '" onUnload="'.&Apache::lonmenu::unloadevents().';'.  
     $more_unload.'"';  
  $r->print(&Apache::lonmenu::registerurl(1));  
     } else {  
  $addentries=' onUnload="'.$more_unload.'"';  
     }  
   
     # Header      # Header
     $r->print('</head>'.      $r->print(&Apache::loncommon::start_page('Navigate Course Contents',$js,
               &Apache::loncommon::bodytag('Navigate Course Contents','',       {'only_body'       => $body_only,
   $addentries,$body_only,'',        'force_register'  =>
   $env{'form.register'}));    $env{'form.register'},}));
     $r->print('<script>window.focus();</script>');      $r->print('<script type="text/javascript">window.focus();</script>');
             
     $r->rflush();      $r->rflush();
   
     # Check that it's defined      # Check that it's defined
     if (!($navmap->courseMapDefined())) {      if (!($navmap->courseMapDefined())) {
  $r->print(&Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT'));   $r->print(&Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT'));
         $r->print('<font size="+2" color="red">Coursemap undefined.</font>' .          $r->print('<font size="+2" color="red">'.&mt('Coursemap undefined.').
                   '</body></html>');    '</font>' .
                     &Apache::loncommon::end_page());
         return OK;          return OK;
     }      }
   
Line 434  MENU Line 424  MENU
     #my $td=&tv_interval($t0);      #my $td=&tv_interval($t0);
     #$r->print("<br />$td");      #$r->print("<br />$td");
   
     $r->print("</body></html>");      $r->print(&Apache::loncommon::end_page());
     $r->rflush();      $r->rflush();
   
     return OK;      return OK;
Line 2280  sub get_discussion_data { Line 2270  sub get_discussion_data {
     my $cdom=$env{'course.'.$cid.'.domain'};      my $cdom=$env{'course.'.$cid.'.domain'};
     my $cnum=$env{'course.'.$cid.'.num'};      my $cnum=$env{'course.'.$cid.'.num'};
     # Retrieve discussion data for resources in course      # Retrieve discussion data for resources in course
     my %discussion_data = &Apache::lonnet::dump($cid,$cdom,$cnum);      my %discussion_data = &Apache::lonnet::dumpstore($cid,$cdom,$cnum);
   
   
     $self->{DISCUSSION_DATA} = \%discussion_data;      $self->{DISCUSSION_DATA} = \%discussion_data;
Line 2356  sub unread_discussion { Line 2346  sub unread_discussion {
     my $symb = shift;      my $symb = shift;
   
     $self->get_discussion_data();      $self->get_discussion_data();
       
     my $ressymb = $self->wrap_symb($symb);  
   
     my $version = $self->{DISCUSSION_DATA}{'version:'.$ressymb};      my $ressymb = $self->wrap_symb($symb);
       # keys used to store bulletinboard postings use 'unwrapped' symb. 
       my $discsymb = $self->unwrap_symb($ressymb);
       my $version = $self->{DISCUSSION_DATA}{'version:'.$discsymb};
     if (!$version) { return; }      if (!$version) { return; }
   
     my $prevread = $self->{LAST_READ}{$ressymb};      my $prevread = $self->{LAST_READ}{$ressymb};
Line 2372  sub unread_discussion { Line 2363  sub unread_discussion {
     my %subjects;      my %subjects;
   
     for (my $id=$version; $id>0; $id--) {      for (my $id=$version; $id>0; $id--) {
  my $vkeys=$self->{DISCUSSION_DATA}{$id.':keys:'.$ressymb};   my $vkeys=$self->{DISCUSSION_DATA}{$id.':keys:'.$discsymb};
  my @keys=split(/:/,$vkeys);   my @keys=split(/:/,$vkeys);
  if (grep(/^hidden$/ ,@keys)) {   if (grep(/^hidden$/ ,@keys)) {
     if (!$hiddenflag) {      if (!$hiddenflag) {
  $hidden = $self->{DISCUSSION_DATA}{$id.':'.$ressymb.':hidden'};   $hidden = $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':hidden'};
  $hiddenflag = 1;   $hiddenflag = 1;
     }      }
  } elsif (grep(/^deleted$/,@keys)) {   } elsif (grep(/^deleted$/,@keys)) {
     if (!$deletedflag) {      if (!$deletedflag) {
  $deleted = $self->{DISCUSSION_DATA}{$id.':'.$ressymb.':deleted'};   $deleted = $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':deleted'};
  $deletedflag = 1;   $deletedflag = 1;
     }      }
  } else {   } else {
     if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./)      if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./)
  && $prevread < $self->{DISCUSSION_DATA}{$id.':'.$ressymb.':timestamp'}) {   && $prevread < $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':timestamp'}) {
     $unreadcount++;      $unreadcount++;
     $subjects{$unreadcount}=      $subjects{$unreadcount}=
  $id.': '.$self->{DISCUSSION_DATA}{$id.':'.$ressymb.':subject'};   $id.': '.$self->{DISCUSSION_DATA}{$id.':'.$discsymb.':subject'};
  }   }
  }   }
     }      }
Line 2402  sub unread_discussion { Line 2393  sub unread_discussion {
 sub wrap_symb {  sub wrap_symb {
     my $self = shift;      my $self = shift;
     my $symb = shift;      my $symb = shift;
     if ($symb =~ m-___(adm/\w+/\w+/)(\d+)(/bulletinboard)$-) {      if ($symb =~ m-___(adm/[^/]+/[^/]+/)(\d+)(/bulletinboard)$-) {
         unless ($symb =~ m|adm/wrapper/adm|) {          unless ($symb =~ m|adm/wrapper/adm|) {
             $symb = 'bulletin___'.$2.'___adm/wrapper/'.$1.$2.$3;              $symb = 'bulletin___'.$2.'___adm/wrapper/'.$1.$2.$3;
         }          }
Line 2410  sub wrap_symb { Line 2401  sub wrap_symb {
     return $symb;      return $symb;
 }  }
   
   sub unwrap_symb {
       my $self = shift;
       my $ressymb = shift;
       my $discsymb = $ressymb;
       if ($ressymb =~ m-^(bulletin___\d+___)adm/wrapper/(adm/[^/]+/[^/]+/\d+/bulletinboard)$-) {
            $discsymb = $1.$2;
       }
       return $discsymb;
   }
   
 # Private method: Does the given resource (as a symb string) have  # Private method: Does the given resource (as a symb string) have
 # current feedback? Returns the string in the feedback hash, which  # current feedback? Returns the string in the feedback hash, which
 # will be false if it does not exist.  # will be false if it does not exist.
Line 3657  sub kind { my $self=shift; return $self- Line 3658  sub kind { my $self=shift; return $self-
 sub randomout { my $self=shift; return $self->navHash("randomout_", 1); }  sub randomout { my $self=shift; return $self->navHash("randomout_", 1); }
 sub randompick {   sub randompick { 
     my $self = shift;      my $self = shift;
     return $self->{NAV_MAP}->{PARM_HASH}->{$self->symb .      return $self->parmval('randompick');
                                                '.0.parameter_randompick'};  
 }  }
 sub link {  sub link {
     my $self=shift;      my $self=shift;
Line 3776  sub retrieveResources { Line 3776  sub retrieveResources {
    return $self->{NAV_MAP}->retrieveResources(@_);     return $self->{NAV_MAP}->retrieveResources(@_);
 }  }
   
   sub is_exam {
       my ($self,$part) = @_;
       if ($self->parmval('type',$part) eq 'exam') {
           return 1;
       }
       if ($self->src() =~ /\.(exam)$/) {
           return 1;
       }
       return 0;
   }
 sub is_html {  sub is_html {
     my $self=shift;      my $self=shift;
     my $src = $self->src();      my $src = $self->src();
Line 4258  sub countResponses { Line 4268  sub countResponses {
 sub responseTypes {  sub responseTypes {
     my $self = shift;      my $self = shift;
     my %responses;      my %responses;
     foreach my $part ($self->parts()) {      foreach my $part (@{$self->parts()}) {
         foreach my $responsetype ($self->responseType($part)) {          foreach my $responsetype ($self->responseType($part)) {
             $responses{$responsetype}++ if (defined($responsetype));              $responses{$responsetype}++ if (defined($responsetype));
         }          }

Removed from v.1.366  
changed lines
  Added in v.1.376


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