Diff for /loncom/interface/lonindexer.pm between versions 1.49 and 1.59

version 1.49, 2002/08/12 18:21:42 version 1.59, 2003/02/03 18:03:52
Line 34 Line 34
 # 05/9-05/19/2001 H. K. Ng  # 05/9-05/19/2001 H. K. Ng
 # 05/21/2001 H. K. Ng  # 05/21/2001 H. K. Ng
 # 05/23/2001 H. K. Ng  # 05/23/2001 H. K. Ng
 # 5/31,6/1,6/2,6/15 Scott Harrison  
 # 6/26,7/8 H. K. Ng  # 6/26,7/8 H. K. Ng
 # 8/6,8/7,8/10 Scott Harrison  
 # 8/14 H. K. Ng  # 8/14 H. K. Ng
 # 8/28,10/15,11/28,11/29 Scott Harrison  
 # 11/30 Matthew Hall  # 11/30 Matthew Hall
 # 12/11,12/13 Scott Harrison  
 # YEAR=2002  # YEAR=2002
 # 1/17 Scott Harrison  
 # 6/29/2002 H. K. Ng  # 6/29/2002 H. K. Ng
 #  #
 ###  ###
Line 90  my @Omit = (); Line 85  my @Omit = ();
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     $r->content_type('text/html');      $r->content_type('text/html');
       &Apache::loncommon::no_cache($r);
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
     $fnum=0;      $fnum=0;
Line 326  function gothere(val) { Line 322  function gothere(val) {
 </script>  </script>
   
 </head>  </head>
 <body bgcolor="#FFFFFF">  
 ENDHEADER  ENDHEADER
   $r->print(&Apache::loncommon::bodytag('Browse Resources'));
 # - Evaluate actions from previous page (both cumulatively and chronologically)  # - Evaluate actions from previous page (both cumulatively and chronologically)
         if ($ENV{'form.catalogmode'} eq 'groupimport') {          if ($ENV{'form.catalogmode'} eq 'groupimport') {
     my $acts=$ENV{'form.acts'};      my $acts=$ENV{'form.acts'};
Line 371  ENDHEADER Line 366  ENDHEADER
     }      }
  }   }
   
 # ---------------------------------------------------------------- output title  
  $r->print(  
 '<h2><font color="#339933">The Learning<i>Online</i> Network with CAPA '.  
   'Network Directory Browser</font></h2>'."\n");  
 # ---------------------------------- get state of file attributes to be showing  # ---------------------------------- get state of file attributes to be showing
  if ($ENV{'form.attrs'} ne '') {   if ($ENV{'form.attrs'} ne '') {
     for (my $i=0; $i<=7; $i++) {      for (my $i=0; $i<=8; $i++) {
  delete $hash{'display_attrs_'.$i};   delete $hash{'display_attrs_'.$i};
  if ($ENV{'form.attr'.$i} == 1) {   if ($ENV{'form.attr'.$i} == 1) {
     $attrchk[$i] = 'checked';      $attrchk[$i] = 'checked';
Line 385  ENDHEADER Line 376  ENDHEADER
  }   }
     }      }
  } else {   } else {
     for (my $i=0; $i<=7; $i++) {      for (my $i=0; $i<=8; $i++) {
  $attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1;   $attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1;
     }      }
  }   }
Line 399  ENDHEADER Line 390  ENDHEADER
 <td><input type="checkbox" name="attr1" value="1" $attrchk[1] /> Size</td>  <td><input type="checkbox" name="attr1" value="1" $attrchk[1] /> Size</td>
 <td><input type="checkbox" name="attr2" value="1" $attrchk[2] /> Last access</td>  <td><input type="checkbox" name="attr2" value="1" $attrchk[2] /> Last access</td>
 <td><input type="checkbox" name="attr3" value="1" $attrchk[3] /> Last modified</td>  <td><input type="checkbox" name="attr3" value="1" $attrchk[3] /> Last modified</td>
 </tr><tr>  <td rowspan="2"><input type="checkbox" name="attr8" value="1" $attrchk[8] /> Show Resource</td></tr><tr>
 <td><input type="checkbox" name="attr4" value="1" $attrchk[4] /> Author</td>  <td><input type="checkbox" name="attr4" value="1" $attrchk[4] /> Author</td>
 <td><input type="checkbox" name="attr5" value="1" $attrchk[5] /> Keywords</td>  <td><input type="checkbox" name="attr5" value="1" $attrchk[5] /> Keywords</td>
 <td><input type="checkbox" name="attr6" value="1" $attrchk[6] /> Language</td>  <td><input type="checkbox" name="attr6" value="1" $attrchk[6] /> Language</td>
Line 436  END Line 427  END
     if ($hash{'display_attrs_5'} == 1);      if ($hash{'display_attrs_5'} == 1);
  $r->print("<td><b>Language</b></td>\n")   $r->print("<td><b>Language</b></td>\n")
     if ($hash{'display_attrs_6'} == 1);      if ($hash{'display_attrs_6'} == 1);
    $r->print("<td><b>Resource</b></td>\n")
       if ($hash{'display_attrs_8'} == 1);
  $r->print('</tr>');   $r->print('</tr>');
   
 # ----------------- read in what directories have previously been set to "open"  # ----------------- read in what directories have previously been set to "open"
Line 518  sub scanDir { Line 511  sub scanDir {
     my %dupdirs = %dirs;      my %dupdirs = %dirs;
     my @list=&get_list($r,$startdir);      my @list=&get_list($r,$startdir);
     foreach my $line (@list) {      foreach my $line (@list) {
  my ($strip,$dom,$foo,$testdir,$foo)=split(/\&/,$line,5);    my ($strip,$dom,undef,$testdir,undef)=split(/\&/,$line,5); 
  next if $strip =~ /.*\.meta$/;   next if $strip =~ /.*\.meta$/;
  my (@fileparts) = split(/\./,$strip);   my (@fileparts) = split(/\./,$strip);
  if ($hash{'display_attrs_7'} != 1) {   if ($hash{'display_attrs_7'} != 1) {
Line 543  sub scanDir { Line 536  sub scanDir {
     while (my ($key,$val)= each %dupdirs) {      while (my ($key,$val)= each %dupdirs) {
  if ($key eq $compuri and $val eq "open") {   if ($key eq $compuri and $val eq "open") {
     $diropen = "opened";      $diropen = "opened";
     delete $dupdirs{key},$dirs{$key};      delete($dupdirs{$key});
       delete($dirs{$key});
  }   }
     }      }
  }   }
Line 629  sub match_ext { Line 623  sub match_ext {
 # ------------------------------- displays one line in appropriate table format  # ------------------------------- displays one line in appropriate table format
 sub display_line {  sub display_line {
     my ($r,$diropen,$line,$indent,$startdir,$hashref,@list)=@_;      my ($r,$diropen,$line,$indent,$startdir,$hashref,@list)=@_;
     my (@pathfn, $fndir, $fnptr);      my (@pathfn, $fndir);
     my $dirptr=16384;      my $dirptr=16384;
     my $fileclr="#ffffe6";      my $fileclr="#ffffe6";
     my $iconpath= $r->dir_config('lonIconsURL') . '/';      my $iconpath= $r->dir_config('lonIconsURL') . '/';
Line 688  sub display_line { Line 682  sub display_line {
  $r->print ('<a href="javascript:gothere(\''.$filecom[0].   $r->print ('<a href="javascript:gothere(\''.$filecom[0].
    '/\')"><img src="'.$iconpath.'server.gif"');     '/\')"><img src="'.$iconpath.'server.gif"');
  $r->print (' border="0" /></a>'."\n");   $r->print (' border="0" /></a>'."\n");
  $r->print("Domain - $listname $tabtag</tr></form>\n");   $r->print("Domain - $listname (".
         $Apache::lonnet::domaindescription{$listname}.") $tabtag</tr></form>\n");
  return OK;   return OK;
   
 # display user directory  # display user directory
Line 836  sub display_line { Line 831  sub display_line {
     $r->print('<td valign=bottom> '.($lang eq '' ? '&nbsp;' : $lang).      $r->print('<td valign=bottom> '.($lang eq '' ? '&nbsp;' : $lang).
       " </td>\n");        " </td>\n");
  }   }
           if ($hash{'display_attrs_8'} == 1) {
               my $output='';
               my $embstyle=&Apache::loncommon::fileembstyle($curfext);
       if ($embstyle eq 'ssi') {
          $output=&Apache::lonnet::ssi($filelink);
                  $output=~s/^.*\<body[^\>]*\>//si;
                  $output=~s/\<\/body\s*\>.*$//si;
                  $output='<font size="-2">'.$output.'</font>';
      } elsif ($embstyle eq 'img') {
                  $output='<img src="'.$filelink.'" />';
              } elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) {
                  $output='<img src="http://'.
    $Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}.
                    '/cgi-bin/thumbnail.gif?url='.$filelink.'" />';
              }
      $r->print('<td valign=bottom> '.($output eq '' ? '&nbsp;':$output).
         " </td>\n");
           }
  $r->print("</tr>\n");   $r->print("</tr>\n");
     }      }
   
Line 921  sub setvalues { Line 934  sub setvalues {
   
 1;  1;
   
   sub cleanup {
       if (tied(%hash)){
    &Apache::lonnet::logthis('Cleanup indexer: hash');
           unless (untie(%hash)) {
       &Apache::lonnet::logthis('Failed cleanup indexer: hash');
           }
       }
   }
   
 =head1 NAME  =head1 NAME
   
 Apache::lonindexer - mod_perl module for cross server filesystem browsing  Apache::lonindexer - mod_perl module for cross server filesystem browsing

Removed from v.1.49  
changed lines
  Added in v.1.59


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