--- loncom/interface/lonindexer.pm 2003/07/17 21:11:09 1.69 +++ loncom/interface/lonindexer.pm 2003/07/21 18:35:25 1.70 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.69 2003/07/17 21:11:09 www Exp $ +# $Id: lonindexer.pm,v 1.70 2003/07/21 18:35:25 ng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,6 +62,7 @@ use strict; use Apache::lonnet(); use Apache::loncommon(); use Apache::Constants qw(:common); +use Apache::lonmeta; use Apache::File; use GDBM_File; @@ -377,7 +378,7 @@ $r->print(&Apache::loncommon::bodytag('B # ---------------------------------- get state of file attributes to be showing if ($ENV{'form.attrs'} ne '') { - for (my $i=0; $i<=8; $i++) { + for (my $i=0; $i<=9; $i++) { delete $hash{'display_attrs_'.$i}; if ($ENV{'form.attr'.$i} == 1) { $attrchk[$i] = 'checked'; @@ -385,7 +386,7 @@ $r->print(&Apache::loncommon::bodytag('B } } } else { - for (my $i=0; $i<=8; $i++) { + for (my $i=0; $i<=9; $i++) { $attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1; } } @@ -399,11 +400,12 @@ $r->print(&Apache::loncommon::bodytag('B Size Last access Last modified - All versions + Statistics Author Keywords Language Show Resource + All versions   @@ -439,6 +441,8 @@ END if ($hash{'display_attrs_6'} == 1); $r->print("Resource\n") if ($hash{'display_attrs_7'} == 1); + $r->print("Usage Statistics
(Courses/Network Hits)
\n") + if ($hash{'display_attrs_8'} == 1); $r->print(''); # ----------------- read in what directories have previously been set to "open" @@ -535,7 +539,7 @@ sub scanDir { my ($strip,$dom,undef,$testdir,undef)=split(/\&/,$line,5); next if $strip =~ /.*\.meta$/; my (@fileparts) = split(/\./,$strip); - if ($hash{'display_attrs_8'} != 1) { + if ($hash{'display_attrs_9'} != 1) { if (scalar(@fileparts) >= 3) { my $fext = pop @fileparts; my $ov = pop @fileparts; @@ -659,7 +663,7 @@ sub display_line { my $tabtag=''; my $i=0; - while ($i<=7) { + while ($i<=8) { $tabtag=join('',$tabtag," ") if $hash{'display_attrs_'.$i} == 1; $i++; @@ -669,8 +673,8 @@ sub display_line { # display uplink arrow if ($filecom[1] eq 'viewOneUp') { - $r->print("$extrafield"); - $r->print("\n"); + $r->print("$extrafield"); + $r->print("\n"); $r->print ('
'."\n") if ($ENV{'form.dirPointer'} eq "on"); - $r->print("$extrafield"); - $r->print(""); + $r->print("$extrafield"); + $r->print(""); &begin_form ($r,$filecom[0].'/'); my $anchor = $filecom[0].'/'; $anchor =~ s/\///g; @@ -719,8 +723,8 @@ sub display_line { # display user directory } if ($filecom[1] eq 'user') { - $r->print("$extrafield"); - $r->print("\n"); + $r->print("$extrafield"); + $r->print("\n"); my $curdir = $startdir.$filecom[0].'/'; my $anchor = $curdir; $anchor =~ s/\///g; @@ -763,7 +767,7 @@ sub display_line { $iconname = $curfext.".gif" unless (!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn'); # - $r->print(""); + $r->print(""); my $metafile = grep /^\Q$filecom[0]\E\.meta\&/, @list; my $title; if ($ENV{'form.catalogmode'} eq 'interactive') { @@ -777,7 +781,7 @@ sub display_line { $titleesc,"','",$filelink,"')\">"); $r->print("". "\n"); - $r->print(""); + $r->print(""); } elsif ($ENV{'form.catalogmode'} eq 'groupimport') { $title=$listname; @@ -796,7 +800,7 @@ sub display_line { $r->print("\n"); $r->print("
\n"); - $r->print(""); + $r->print(""); $hash{"pre_${fnum}_link"}=$filelink; $hash{"pre_${fnum}_title"}=$titleesc; $fnum++; @@ -829,39 +833,39 @@ sub display_line { $r->print("\n"); if ($hash{'display_attrs_0'} == 1) { - my $title = &Apache::lonnet::metadata($filelink,'title') + my $title = &Apache::lonnet::gettitle($filelink,'title') if ($metafile == 1); - $r->print(' '.($title eq '' ? ' ' : $title). + $r->print(' '.($title eq '' ? ' ' : $title). ' '."\n"); } - $r->print(' ', + $r->print(' ', $filecom[8]," \n") if $hash{'display_attrs_1'} == 1; - $r->print(' '. + $r->print(' '. (localtime($filecom[9]))." \n") if $hash{'display_attrs_2'} == 1; - $r->print(' '. + $r->print(' '. (localtime($filecom[10]))." \n") if $hash{'display_attrs_3'} == 1; if ($hash{'display_attrs_4'} == 1) { my $author = &Apache::lonnet::metadata($filelink,'author') if ($metafile == 1); - $r->print(' '.($author eq '' ? ' ' : $author). + $r->print(' '.($author eq '' ? ' ' : $author). " \n"); } if ($hash{'display_attrs_5'} == 1) { my $keywords = &Apache::lonnet::metadata($filelink,'keywords') if ($metafile == 1); # $keywords = ' ' if (!$keywords); - $r->print(' '.($keywords eq '' ? ' ' : $keywords). + $r->print(' '.($keywords eq '' ? ' ' : $keywords). " \n"); } if ($hash{'display_attrs_6'} == 1) { my $lang = &Apache::lonnet::metadata($filelink,'language') if ($metafile == 1); $lang = &Apache::loncommon::languagedescription($lang); - $r->print(' '.($lang eq '' ? ' ' : $lang). + $r->print(' '.($lang eq '' ? ' ' : $lang). " \n"); } if ($hash{'display_attrs_7'} == 1) { @@ -877,9 +881,18 @@ sub display_line { $Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}. '/cgi-bin/thumbnail.gif?url='.$filelink.'" />'; } - $r->print(' '.($output eq '' ? ' ':$output). + $r->print(' '.($output eq '' ? ' ':$output). " \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(' '.($stat eq '' ? ' ' : $stat). + ' '."\n"); + } + $r->print("\n"); }