Diff for /loncom/interface/lonindexer.pm between versions 1.116 and 1.121

version 1.116, 2004/06/18 01:27:04 version 1.121, 2004/07/26 22:38:16
Line 60  my %hash; # global user-specific gdbm fi Line 60  my %hash; # global user-specific gdbm fi
 my %dirs; # keys are directories, values are the open/close status  my %dirs; # keys are directories, values are the open/close status
 my %language; # has the reference information present in language.tab  my %language; # has the reference information present in language.tab
 my %dynhash; # hash of hashes for dynamic metadata  my %dynhash; # hash of hashes for dynamic metadata
   my %dynread; # hash of directories already read for dynamic metadata
 my %fieldnames; # Metadata fieldnames  my %fieldnames; # Metadata fieldnames
 # ----- Values which are set by the handler subroutine and are accessible to  # ----- Values which are set by the handler subroutine and are accessible to
 # -----     other methods.  # -----     other methods.
Line 135  sub handler { Line 136  sub handler {
    if ($ENV{'form.launch'} eq '2') {     if ($ENV{'form.launch'} eq '2') {
        $r->content_type('text/html');         $r->content_type('text/html');
        my $extra='';         my $extra='';
        if (defined($ENV{'form.titleelement'})) {         if (defined($ENV{'form.titleelement'}) && 
      $ENV{'form.titleelement'} ne '') {
    my $verify_title = &Apache::lonnet::gettitle($ENV{'form.acts'});     my $verify_title = &Apache::lonnet::gettitle($ENV{'form.acts'});
 #   &Apache::lonnet::logthis("Hrrm $ENV{'form.acts'} -- $verify_title");  #   &Apache::lonnet::logthis("Hrrm $ENV{'form.acts'} -- $verify_title");
    $verify_title=~s/'/\\'/g;     $verify_title=~s/'/\\'/g;
Line 517  END Line 519  END
  $r->print("<td><b>".&mt("Language")."</b></td>\n")   $r->print("<td><b>".&mt("Language")."</b></td>\n")
     if ($hash{'display_attrs_6'} == 1);      if ($hash{'display_attrs_6'} == 1);
  $r->print("<td><b>".&mt("Usage Statistics")." <br />(".   $r->print("<td><b>".&mt("Usage Statistics")." <br />(".
   &mt("Courses/Network Hits").")</b></td>\n")    &mt("Courses/Network Hits").")</b> ".&mt('updated periodically')."</td>\n")
     if ($hash{'display_attrs_8'} == 1);      if ($hash{'display_attrs_8'} == 1);
  $r->print("<td><b>".&mt("Source Available")."</b></td>\n")   $r->print("<td><b>".&mt("Source Available")."</b></td>\n")
     if ($hash{'display_attrs_10'} == 1);      if ($hash{'display_attrs_10'} == 1);
Line 660  sub get_list { Line 662  sub get_list {
     if ($ENV{'form.updatedisplay'}) {      if ($ENV{'form.updatedisplay'}) {
  foreach (keys %hash) {   foreach (keys %hash) {
     delete $hash{$_} if ($_ =~ /^dirlist_files_/);      delete $hash{$_} if ($_ =~ /^dirlist_files_/);
       delete $hash{$_} if ($_ =~ /^dirlist_timestamp_files_/);
  }   }
     }      }
   
     if ($hash{'dirlist_files_'.$luri}) {      if (defined($hash{'dirlist_files_'.$luri}) &&
    $hash{'dirlist_timestamp_files_'.$luri}+600 > (time)) {
    &Apache::lonnet::logthis("using old n:".time." s:".$hash{'dirlist_timestamp_files_'.$luri});
  @list = split(/\n/,$hash{'dirlist_files_'.$luri});   @list = split(/\n/,$hash{'dirlist_files_'.$luri});
     } elsif ($uri=~/\.(page|sequence)\/$/) {      } elsif ($uri=~/\.(page|sequence)\/$/) {
 # is a page or a sequence  # is a page or a sequence
Line 677  sub get_list { Line 682  sub get_list {
  $hash{'dirlist_files_'.$luri} = join("\n",@list);   $hash{'dirlist_files_'.$luri} = join("\n",@list);
     } else {      } else {
 # is really a directory  # is really a directory
    &Apache::lonnet::logthis("getting fresh n:".time." s:".$hash{'dirlist_timestamp_files_'.$luri});
  @list = &Apache::lonnet::dirlist($uri);   @list = &Apache::lonnet::dirlist($uri);
  $hash{'dirlist_files_'.$luri} = join("\n",@list);   $hash{'dirlist_files_'.$luri} = join("\n",@list);
  &dynmetaread($uri);   $hash{'dirlist_timestamp_files_'.$luri} = time;
     }      }
     return @list=&match_ext($r,@list);      return @list=&match_ext($r,@list);
 }  }
Line 687  sub get_list { Line 693  sub get_list {
 sub dynmetaread {  sub dynmetaread {
     my $uri=shift;      my $uri=shift;
     if (($hash{'display_attrs_8'}==1) || ($hash{'display_attrs_11'}==1)) {      if (($hash{'display_attrs_8'}==1) || ($hash{'display_attrs_11'}==1)) {
   # We don't want the filename
    $uri=~s/\/[^\/]+$//;
   # Did we already see this?
    my $builddir=$uri;
    while ($builddir) {
       if ($dynread{$builddir}) {
    return 0;
       }
       $builddir=~s/\/[^\/]+$//;
    }
   # Actually get the data
  %dynhash=   %dynhash=
     (%dynhash,&Apache::lonmeta::get_dynamic_metadata_from_sql($uri));      (%dynhash,&Apache::lonmeta::get_dynamic_metadata_from_sql($uri));
   # Remember that we got it
    $dynread{$uri}=1;
     }       } 
 }  }
   
Line 985  sub display_line { Line 1004  sub display_line {
  }   }
  if ($hash{'display_attrs_8'} == 1) {   if ($hash{'display_attrs_8'} == 1) {
 # statistics  # statistics
       &dynmetaread($filelink);
     $r->print("<td>");      $r->print("<td>");
     &dynmetaprint($r,$filelink,'count');      &dynmetaprint($r,$filelink,'count');
     &dynmetaprint($r,$filelink,'course');      &dynmetaprint($r,$filelink,'course');
Line 1003  sub display_line { Line 1023  sub display_line {
  if ($hash{'display_attrs_10'} == 1) {   if ($hash{'display_attrs_10'} == 1) {
     my $source = &Apache::lonnet::metadata($filelink,'sourceavail');      my $source = &Apache::lonnet::metadata($filelink,'sourceavail');
     if($source eq 'open') {      if($source eq 'open') {
  my $sourcelink = &Apache::lonsource::make_link($filelink);   my $sourcelink = &Apache::lonsource::make_link($filelink,$listname);
  $r->print('<td>'."<a href=\"javascript:openWindow('".$sourcelink.   $r->print('<td>'."<a href=\"javascript:openWindow('".$sourcelink.
   "', 'previewsource', '700', '700', 'no', 'yes','yes')\";".    "', 'previewsource', '700', '700', 'no', 'yes','yes')\";".
   " TARGET=_self>Yes</a> "."</td>\n");    " TARGET=_self>Yes</a> "."</td>\n");
Line 1013  sub display_line { Line 1033  sub display_line {
  }   }
  if ($hash{'display_attrs_11'} == 1) {   if ($hash{'display_attrs_11'} == 1) {
 # links  # links
      &dynmetaread($filelink);
    $r->print('<td>');     $r->print('<td>');
    &dynmetaprint($r,$filelink,'goto_list');     &dynmetaprint($r,$filelink,'goto_list');
    &dynmetaprint($r,$filelink,'comefrom_list');     &dynmetaprint($r,$filelink,'comefrom_list');

Removed from v.1.116  
changed lines
  Added in v.1.121


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