--- loncom/interface/lonindexer.pm 2004/06/16 23:39:01 1.111 +++ loncom/interface/lonindexer.pm 2004/06/17 20:43:04 1.114 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.111 2004/06/16 23:39:01 www Exp $ +# $Id: lonindexer.pm,v 1.114 2004/06/17 20:43:04 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -53,7 +53,6 @@ use Apache::lonmeta; use Apache::File; use Apache::lonlocal; use Apache::lonsource(); -use LONCAPA::lonmetadata(); use GDBM_File; # ---------------------------------------- variables used throughout the module @@ -61,7 +60,7 @@ my %hash; # global user-specific gdbm fi my %dirs; # keys are directories, values are the open/close status my %language; # has the reference information present in language.tab my %dynhash; # hash of hashes for dynamic metadata - +my %fieldnames; # Metadata fieldnames # ----- Values which are set by the handler subroutine and are accessible to # ----- other methods. my $extrafield; # default extra table cell @@ -88,6 +87,7 @@ sub handler { # these global to this package? It is just so wrong....) undef (@Only); undef (@Omit); + %fieldnames=&Apache::lonmeta::fieldnames(); # ------------------------------------- read in machine configuration variables my $iconpath= $r->dir_config('lonIconsURL') . "/"; @@ -137,7 +137,7 @@ sub handler { my $extra=''; if (defined($ENV{'form.titleelement'})) { 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; $extra='window.opener.document.forms["'.$ENV{'form.form'}.'"].elements["'.$ENV{'form.titleelement'}.'"].value=\''.$verify_title.'\';'; } @@ -675,10 +675,19 @@ sub get_list { # is really a directory @list = &Apache::lonnet::dirlist($uri); $hash{'dirlist_files_'.$luri} = join("\n",@list); + &dynmetaread($uri); } return @list=&match_ext($r,@list); } +sub dynmetaread { + my $uri=shift; + if (($hash{'display_attrs_8'}==1) || ($hash{'display_attrs_11'}==1)) { + %dynhash= + (%dynhash,&Apache::lonmeta::get_dynamic_metadata_from_sql($uri)); + } +} + sub initdebug { return < @@ -795,7 +804,7 @@ sub display_line { if($filecom[15] ne '1') { return OK if (!&Apache::lonnet::allowed('bre',$pathprefix.$filecom[0])); } # make absolute links appear on different background - if ($absolute) { $fileclr='#aaaa88'; } + if ($absolute) { $fileclr='#ccdd99'; } # display domain if ($filecom[1] eq 'domain') { @@ -865,7 +874,7 @@ sub display_line { } # Set the icon for the file my $iconname = &Apache::loncommon::icon($listname); - $r->print(""); + $r->print(""); my $metafile = $Apache::lonnet::perlvar{'lonDocRoot'}.$pathprefix. $filecom[0].'.meta'; @@ -1007,7 +1016,19 @@ sub display_line { } if ($hash{'display_attrs_8'} == 1) { # statistics - $r->print(" \n"); + $r->print(""); + &dynmetaprint($r,$filelink,'count'); + &dynmetaprint($r,$filelink,'course'); + &dynmetaprint($r,$filelink,'stdno'); + &dynmetaprint($r,$filelink,'avetries'); + &dynmetaprint($r,$filelink,'difficulty'); + &dynmetaprint($r,$filelink,'disc'); + &dynmetaprint($r,$filelink,'clear'); + &dynmetaprint($r,$filelink,'technical'); + &dynmetaprint($r,$filelink,'correct'); + &dynmetaprint($r,$filelink,'helpful'); + &dynmetaprint($r,$filelink,'depth'); + $r->print(" \n"); } if ($hash{'display_attrs_10'} == 1) { @@ -1023,8 +1044,13 @@ sub display_line { } if ($hash{'display_attrs_11'} == 1) { # links - $r->print(" \n"); - } + $r->print(''); + &dynmetaprint($r,$filelink,'goto_list'); + &dynmetaprint($r,$filelink,'comefrom_list'); + &dynmetaprint($r,$filelink,'sequsage_list'); + &dynmetaprint($r,$filelink,'dependencies'); + $r->print(''); + } $r->print("\n"); } @@ -1112,6 +1138,18 @@ sub display_line { } +sub dynmetaprint { + my ($r,$filelink,$item)=@_; + if ($dynhash{$filelink}->{$item}) { + $r->print("\n
".$fieldnames{$item}.': '. + &Apache::lonmeta::prettyprint($item, + $dynhash{$filelink}->{$item}, + (($ENV{'form.catalogmode'} ne 'groupimport')?'preview':''), + '', + (($ENV{'form.catalogmode'} eq 'groupimport')?'document.forms.fileattr':''),1)); + } +} + # ------------------- prints the beginning of a form for directory or file link sub begin_form { my ($r,$uri) = @_;