Diff for /loncom/interface/lonindexer.pm between versions 1.69 and 1.70

version 1.69, 2003/07/17 21:11:09 version 1.70, 2003/07/21 18:35:25
Line 62  use strict; Line 62  use strict;
 use Apache::lonnet();  use Apache::lonnet();
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
   use Apache::lonmeta;
 use Apache::File;  use Apache::File;
 use GDBM_File;  use GDBM_File;
   
Line 377  $r->print(&Apache::loncommon::bodytag('B Line 378  $r->print(&Apache::loncommon::bodytag('B
   
 # ---------------------------------- 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<=8; $i++) {      for (my $i=0; $i<=9; $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  $r->print(&Apache::loncommon::bodytag('B Line 386  $r->print(&Apache::loncommon::bodytag('B
  }   }
     }      }
  } else {   } else {
     for (my $i=0; $i<=8; $i++) {      for (my $i=0; $i<=9; $i++) {
  $attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1;   $attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1;
     }      }
  }   }
Line 399  $r->print(&Apache::loncommon::bodytag('B Line 400  $r->print(&Apache::loncommon::bodytag('B
 <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>
 <td><input type="checkbox" name="attr8" value="1" $attrchk[8] /> All versions</td></tr><tr>  <td><input type="checkbox" name="attr8" value="1" $attrchk[8] /> Statistics</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>
 <td><input type="checkbox" name="attr7" value="1" $attrchk[7] /> Show Resource</td>  <td><input type="checkbox" name="attr7" value="1" $attrchk[7] /> Show Resource</td>
   <td><input type="checkbox" name="attr9" value="1" $attrchk[9] /> All versions</td>
 <td>&nbsp;</td>  <td>&nbsp;</td>
 </tr></table>  </tr></table>
 <input type="hidden" name="dirPointer" value="on" />  <input type="hidden" name="dirPointer" value="on" />
Line 439  END Line 441  END
     if ($hash{'display_attrs_6'} == 1);      if ($hash{'display_attrs_6'} == 1);
  $r->print("<td><b>Resource</b></td>\n")   $r->print("<td><b>Resource</b></td>\n")
     if ($hash{'display_attrs_7'} == 1);      if ($hash{'display_attrs_7'} == 1);
    $r->print("<td><b>Usage Statistics <br />(Courses/Network Hits)</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 535  sub scanDir { Line 539  sub scanDir {
  my ($strip,$dom,undef,$testdir,undef)=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_8'} != 1) {   if ($hash{'display_attrs_9'} != 1) {
     if (scalar(@fileparts) >= 3) {      if (scalar(@fileparts) >= 3) {
  my $fext = pop @fileparts;   my $fext = pop @fileparts;
  my $ov = pop @fileparts;   my $ov = pop @fileparts;
Line 659  sub display_line { Line 663  sub display_line {
     my $tabtag='</td>';      my $tabtag='</td>';
     my $i=0;      my $i=0;
   
     while ($i<=7) {      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;
  $i++;   $i++;
Line 669  sub display_line { Line 673  sub display_line {
   
 # display uplink arrow  # display uplink arrow
     if ($filecom[1] eq 'viewOneUp') {      if ($filecom[1] eq 'viewOneUp') {
  $r->print("<tr bgcolor=$fileclr>$extrafield");   $r->print("<tr valign='$valign' bgcolor=$fileclr>$extrafield");
  $r->print("<td valign=$valign>\n");   $r->print("<td>\n");
  $r->print ('<form method="post" name="dirpathUP" action="'.$startdir.   $r->print ('<form method="post" name="dirpathUP" action="'.$startdir.
    '/" '.     '/" '.
    'onSubmit="return rep_dirpath(\'UP\','.     'onSubmit="return rep_dirpath(\'UP\','.
Line 694  sub display_line { Line 698  sub display_line {
     if ($filecom[1] eq 'domain') {      if ($filecom[1] eq 'domain') {
  $r->print ('<input type="hidden" name="dirPointer" value="on">'."\n")   $r->print ('<input type="hidden" name="dirPointer" value="on">'."\n")
     if ($ENV{'form.dirPointer'} eq "on");      if ($ENV{'form.dirPointer'} eq "on");
  $r->print("<tr bgcolor=$fileclr>$extrafield");   $r->print("<tr valign='$valign' bgcolor=$fileclr>$extrafield");
  $r->print("<td valign=$valign>");   $r->print("<td>");
  &begin_form ($r,$filecom[0].'/');   &begin_form ($r,$filecom[0].'/');
  my $anchor = $filecom[0].'/';   my $anchor = $filecom[0].'/';
  $anchor =~ s/\///g;   $anchor =~ s/\///g;
Line 719  sub display_line { Line 723  sub display_line {
 # display user directory  # display user directory
     }      }
     if ($filecom[1] eq 'user') {      if ($filecom[1] eq 'user') {
  $r->print("<tr bgcolor=$fileclr>$extrafield");   $r->print("<tr valign=$valign bgcolor=$fileclr>$extrafield");
  $r->print("<td valign=$valign nowrap>\n");   $r->print("<td nowrap>\n");
  my $curdir = $startdir.$filecom[0].'/';   my $curdir = $startdir.$filecom[0].'/';
  my $anchor = $curdir;   my $anchor = $curdir;
  $anchor =~ s/\///g;   $anchor =~ s/\///g;
Line 763  sub display_line { Line 767  sub display_line {
  $iconname = $curfext.".gif" unless   $iconname = $curfext.".gif" unless
     (!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn');      (!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn');
  #   #
  $r->print("<tr bgcolor=$fileclr><td nowrap valign='$valign'>");   $r->print("<tr valign='$valign' bgcolor=$fileclr><td nowrap>");
  my $metafile = grep /^\Q$filecom[0]\E\.meta\&/, @list;   my $metafile = grep /^\Q$filecom[0]\E\.meta\&/, @list;
  my $title;   my $title;
         if ($ENV{'form.catalogmode'} eq 'interactive') {          if ($ENV{'form.catalogmode'} eq 'interactive') {
Line 777  sub display_line { Line 781  sub display_line {
                       $titleesc,"','",$filelink,"')\">");                        $titleesc,"','",$filelink,"')\">");
     $r->print("<img src='",$iconpath,"select.gif' border='0' /></a>".      $r->print("<img src='",$iconpath,"select.gif' border='0' /></a>".
       "\n");        "\n");
     $r->print("</td><td valign='$valign' nowrap>");      $r->print("</td><td nowrap>");
  }   }
         elsif ($ENV{'form.catalogmode'} eq 'groupimport') {          elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
     $title=$listname;      $title=$listname;
Line 796  sub display_line { Line 800  sub display_line {
     $r->print("<input type='hidden' name='title"."' ".      $r->print("<input type='hidden' name='title"."' ".
       "value='$titleesc'>\n");        "value='$titleesc'>\n");
     $r->print("</form>\n");      $r->print("</form>\n");
     $r->print("</td><td valign='$valign' nowrap>");      $r->print("</td><td nowrap>");
     $hash{"pre_${fnum}_link"}=$filelink;      $hash{"pre_${fnum}_link"}=$filelink;
     $hash{"pre_${fnum}_title"}=$titleesc;      $hash{"pre_${fnum}_title"}=$titleesc;
      $fnum++;       $fnum++;
Line 829  sub display_line { Line 833  sub display_line {
   
  $r->print("</td>\n");   $r->print("</td>\n");
  if ($hash{'display_attrs_0'} == 1) {   if ($hash{'display_attrs_0'} == 1) {
     my $title = &Apache::lonnet::metadata($filelink,'title')      my $title = &Apache::lonnet::gettitle($filelink,'title')
  if ($metafile == 1);   if ($metafile == 1);
     $r->print('<td valign=$valign> '.($title eq '' ? '&nbsp;' : $title).      $r->print('<td> '.($title eq '' ? '&nbsp;' : $title).
       ' </td>'."\n");        ' </td>'."\n");
  }   }
  $r->print('<td align=right valign=$valign> ',   $r->print('<td align=right> ',
   $filecom[8]," </td>\n")     $filecom[8]," </td>\n") 
     if $hash{'display_attrs_1'} == 1;      if $hash{'display_attrs_1'} == 1;
  $r->print('<td valign=$valign> '.   $r->print('<td> '.
   (localtime($filecom[9]))." </td>\n")     (localtime($filecom[9]))." </td>\n") 
     if $hash{'display_attrs_2'} == 1;      if $hash{'display_attrs_2'} == 1;
  $r->print('<td valign=$valign> '.   $r->print('<td> '.
   (localtime($filecom[10]))." </td>\n")     (localtime($filecom[10]))." </td>\n") 
     if $hash{'display_attrs_3'} == 1;      if $hash{'display_attrs_3'} == 1;
   
  if ($hash{'display_attrs_4'} == 1) {   if ($hash{'display_attrs_4'} == 1) {
     my $author = &Apache::lonnet::metadata($filelink,'author')      my $author = &Apache::lonnet::metadata($filelink,'author')
  if ($metafile == 1);   if ($metafile == 1);
     $r->print('<td valign=$valign> '.($author eq '' ? '&nbsp;' : $author).      $r->print('<td> '.($author eq '' ? '&nbsp;' : $author).
       " </td>\n");        " </td>\n");
  }   }
  if ($hash{'display_attrs_5'} == 1) {   if ($hash{'display_attrs_5'} == 1) {
     my $keywords = &Apache::lonnet::metadata($filelink,'keywords')      my $keywords = &Apache::lonnet::metadata($filelink,'keywords')
  if ($metafile == 1);   if ($metafile == 1);
     # $keywords = '&nbsp;' if (!$keywords);      # $keywords = '&nbsp;' if (!$keywords);
     $r->print('<td valign=$valign> '.($keywords eq '' ? '&nbsp;' : $keywords).      $r->print('<td> '.($keywords eq '' ? '&nbsp;' : $keywords).
       " </td>\n");        " </td>\n");
  }   }
  if ($hash{'display_attrs_6'} == 1) {   if ($hash{'display_attrs_6'} == 1) {
     my $lang = &Apache::lonnet::metadata($filelink,'language')      my $lang = &Apache::lonnet::metadata($filelink,'language')
  if ($metafile == 1);   if ($metafile == 1);
     $lang = &Apache::loncommon::languagedescription($lang);      $lang = &Apache::loncommon::languagedescription($lang);
     $r->print('<td valign=$valign> '.($lang eq '' ? '&nbsp;' : $lang).      $r->print('<td> '.($lang eq '' ? '&nbsp;' : $lang).
       " </td>\n");        " </td>\n");
  }   }
         if ($hash{'display_attrs_7'} == 1) {          if ($hash{'display_attrs_7'} == 1) {
Line 877  sub display_line { Line 881  sub display_line {
  $Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}.   $Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}.
                  '/cgi-bin/thumbnail.gif?url='.$filelink.'" />';                   '/cgi-bin/thumbnail.gif?url='.$filelink.'" />';
            }             }
    $r->print('<td valign=$valign> '.($output eq '' ? '&nbsp;':$output).     $r->print('<td> '.($output eq '' ? '&nbsp;':$output).
       " </td>\n");        " </td>\n");
         }          }
    if ($hash{'display_attrs_8'} == 1) {
       my (%stat) = &Apache::lonmeta::dynamicmeta($filelink) if ($metafile == 1);
       my $stat = ($stat{'course'} eq '' ? '' : $stat{'course'}).
    (($stat{'course'} ne '' || $stat{'count'} ne '') ? '/' : '').
    ($stat{'count'} eq '' ? '' : $stat{'count'});
       $r->print('<td align=center> '.($stat eq '' ? '&nbsp;' : $stat).
         ' </td>'."\n");
    }
   
  $r->print("</tr>\n");   $r->print("</tr>\n");
     }      }
   

Removed from v.1.69  
changed lines
  Added in v.1.70


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