Diff for /loncom/interface/lonindexer.pm between versions 1.87 and 1.90

version 1.87, 2004/01/26 19:55:44 version 1.90, 2004/02/05 03:42:52
Line 164  END Line 164  END
  #       selection is made.   #       selection is made.
  # $element is the name of the element in $formname which receives   # $element is the name of the element in $formname which receives
  #       the URL.   #       the URL.
  # &Apache::lonxml::debug('Checking mode, form, element');   &Apache::lonxml::debug('Checking mode, form, element');
  &setvalues(\%hash,'form.mode'        ,\%ENV,'form.mode'   );   &setvalues(\%hash,'form.mode'        ,\%ENV,'form.mode'   );
  &setvalues(\%hash,'form.form'        ,\%ENV,'form.form'   );   &setvalues(\%hash,'form.form'        ,\%ENV,'form.form'   );
  &setvalues(\%hash,'form.element'     ,\%ENV,'form.element');   &setvalues(\%hash,'form.element'     ,\%ENV,'form.element');
Line 187  END Line 187  END
     $element      = $ENV{'form.element'};      $element      = $ENV{'form.element'};
     $titleelement = $ENV{'form.titleelement'};      $titleelement = $ENV{'form.titleelement'};
  }   }
  &Apache::lonxml::debug("mode=$mode form=$form element=$element   #&Apache::lonxml::debug("mode=$mode form=$form element=$element titleelement=$titleelement");
                                 titleelement=$titleelement");  
 # ------ set catalogmodefunctions to have extra needed javascript functionality  # ------ set catalogmodefunctions to have extra needed javascript functionality
  my $catalogmodefunctions='';   my $catalogmodefunctions='';
  if ($ENV{'form.catalogmode'} eq 'interactive' or   if ($ENV{'form.catalogmode'} eq 'interactive' or
Line 511  END Line 510  END
  my $indent = 0;   my $indent = 0;
  $uri = $uri.'/' if $uri !~ /.*\/$/;   $uri = $uri.'/' if $uri !~ /.*\/$/;
   
     if ($ENV{'form.dirPointer'} ne 'on') {
  $hash{'top.level'} = $uri;       $hash{'top.level'} = $uri;
  $toplevel = $uri;       $toplevel = $uri;
     } else {
        $toplevel = $hash{'top.level'};
     }
   
 # -------------------------------- if not at top level, provide an uplink arrow  # -------------------------------- if not at top level, provide an uplink arrow
  if ($toplevel ne '/res/'){   if ($toplevel ne '/res/'){
Line 559  sub scanDir { Line 561  sub scanDir {
     my $c = $r->connection();      my $c = $r->connection();
     my ($compuri,$curdir);      my ($compuri,$curdir);
     my $dirptr=16384;      my $dirptr=16384;
       my $obs;
     $indent++;      $indent++;
   
     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) {
         return if ($c->aborted());          return if ($c->aborted());
  my ($strip,$dom,undef,$testdir,undef)=split(/\&/,$line,5);    #This is a kludge, sorry aboot this
  next if $strip =~ /.*\.meta$/;   my ($strip,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs)=split(/\&/,$line,15); 
    next if($strip =~ /.*\.meta$/ | $obs eq '1');
  my (@fileparts) = split(/\./,$strip);   my (@fileparts) = split(/\./,$strip);
  if ($hash{'display_attrs_9'} != 1) {   if ($hash{'display_attrs_9'} != 1) {
     if (scalar(@fileparts) >= 3) {      if (scalar(@fileparts) >= 3) {
Line 619  sub get_list { Line 622  sub get_list {
  @list = &Apache::lonnet::dirlist($uri);   @list = &Apache::lonnet::dirlist($uri);
  $hash{'dirlist_files_'.$luri} = join("\n",@list);   $hash{'dirlist_files_'.$luri} = join("\n",@list);
     }      }
     return @list=&match_ext($r,@list);      @list=&match_ext($r,@list);
       return @list;
 }  }
   
 sub initdebug {  sub initdebug {
Line 691  sub display_line { Line 695  sub display_line {
   
     my $tabtag='</td>';      my $tabtag='</td>';
     my $i=0;      my $i=0;
   
     while ($i<=8) {      while ($i<=8) {
  $tabtag=join('',$tabtag,"<td>&nbsp;</td>")   $tabtag=join('',$tabtag,"<td>&nbsp;</td>")
     if $hash{'display_attrs_'.$i} == 1;      if $hash{'display_attrs_'.$i} == 1;
Line 725  sub display_line { Line 728  sub display_line {
   
 # display domain  # display domain
     if ($filecom[1] eq 'domain') {      if ($filecom[1] eq 'domain') {
     $r->print ('<input type="hidden" name="dirPointer" value="on">'."\n")
        if ($ENV{'form.dirPointer'} eq "on");
  $r->print("<tr valign='$valign' bgcolor=$fileclr>$extrafield");   $r->print("<tr valign='$valign' bgcolor=$fileclr>$extrafield");
  $r->print("<td>");   $r->print("<td>");
  &begin_form ($r,$filecom[0]);   &begin_form ($r,$filecom[0]);
Line 777  sub display_line { Line 782  sub display_line {
 # display file  # display file
     if ($fnptr == 0 and $filecom[3] ne '') {      if ($fnptr == 0 and $filecom[3] ne '') {
  my $filelink = $startdir.$filecom[0];   my $filelink = $startdir.$filecom[0];
  next if &Apache::lonnet::metadata($filelink,'obsolete');  
  my @file_ext = split (/\./,$listname);   my @file_ext = split (/\./,$listname);
  my $curfext = $file_ext[-1];   my $curfext = $file_ext[-1];
         if (@Omit) {          if (@Omit) {
Line 808  sub display_line { Line 812  sub display_line {
  }   }
         elsif ($ENV{'form.catalogmode'} eq 'groupimport') {          elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
     $title=$listname;      $title=$listname;
     $title = &Apache::lonnet::metadata($filelink,'title')      #$title = &Apache::lonnet::metadata($filelink,'title')
  if ($metafile == 1);   #if ($metafile == 1);
     $title=$listname unless $title;      $title=$listname unless $title;
     my $titleesc=&HTML::Entities::encode($title);      my $titleesc=&HTML::Entities::encode($title);
     $r->print("<form name='form$fnum'>\n");      $r->print("<form name='form$fnum'>\n");
Line 895  sub display_line { Line 899  sub display_line {
             my $output='';              my $output='';
             my $embstyle=&Apache::loncommon::fileembstyle($curfext);              my $embstyle=&Apache::loncommon::fileembstyle($curfext);
     if ($embstyle eq 'ssi') {      if ($embstyle eq 'ssi') {
        $output=&Apache::lonnet::ssi_body($filelink);   my $cache=$Apache::lonnet::perlvar{'lonDocRoot'}.$filelink.
                $output='<font size="-2">'.$output.'</font>';      '.tmp';
    if ((!$ENV{'form.updatedisplay'}) &&
       (-e $cache)) {
       open(FH,$cache);
       $output=join("\n",<FH>);
       close(FH);
    } else {
       $output=&Apache::lonnet::ssi_body($filelink);
       open(FH,">$cache");
       print FH $output;
       close(FH);
    }
    $output='<font size="-2">'.$output.'</font>';
    } elsif ($embstyle eq 'img') {     } elsif ($embstyle eq 'img') {
                $output='<img src="'.$filelink.'" />';                 $output='<img src="'.$filelink.'" />';
            } elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) {             } elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) {
Line 1009  sub begin_form { Line 1025  sub begin_form {
        'enctype="application/x-www-form-urlencoded">'."\n");         'enctype="application/x-www-form-urlencoded">'."\n");
     $r->print ('<input type="hidden" name="openuri" value="'.$uri.'">'.      $r->print ('<input type="hidden" name="openuri" value="'.$uri.'">'.
        "\n");         "\n");
       $r->print ('<input type="hidden" name="dirPointer" value="on">'."\n");
     $dnum++;      $dnum++;
 }  }
   

Removed from v.1.87  
changed lines
  Added in v.1.90


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