--- loncom/interface/lonindexer.pm 2004/01/05 15:02:43 1.86 +++ loncom/interface/lonindexer.pm 2004/01/26 19:55:44 1.87 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.86 2004/01/05 15:02:43 www Exp $ +# $Id: lonindexer.pm,v 1.87 2004/01/26 19:55:44 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -54,7 +54,7 @@ use Apache::lonlocal; use GDBM_File; # ---------------------------------------- variables used throughout the module -my %hash; # tied to a user-specific gdbm file +my %hash; # global user-specific gdbm file my %dirs; # keys are directories, values are the open/close status my %language; # has the reference information present in language.tab @@ -116,7 +116,7 @@ sub handler { %hash = (); { my %dbfile; - if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { + if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_READER(),0640)) { while(my($key,$value)=each(%dbfile)) { $hash{$key}=$value; } @@ -360,7 +360,7 @@ $r->print(&Apache::loncommon::bodytag('B $achash{$ref}=$ac; $ac++; } - # sorting through the actions and changing the tied database hash + # sorting through the actions and changing the global database hash foreach (sort {$achash{$a}<=>$achash{$b}} (keys %ahash)) { my $key=$_; if ($ahash{$key} eq '1') { @@ -389,7 +389,7 @@ $r->print(&Apache::loncommon::bodytag('B } # ---------------------------------- get state of file attributes to be showing - if ($ENV{'form.attrs'} ne '') { + if ($ENV{'form.attrs'}) { for (my $i=0; $i<=9; $i++) { delete $hash{'display_attrs_'.$i}; if ($ENV{'form.attr'.$i} == 1) { @@ -402,6 +402,7 @@ $r->print(&Apache::loncommon::bodytag('B $attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1; } } + # ------------------------------- output state of file attributes to be showing # All versions has to the last item # since it does not take an extra col @@ -424,30 +425,34 @@ $r->print(&Apache::loncommon::bodytag('B enctype="application/x-www-form-urlencoded"> $Displayfileattributes
- - - - - + + + + + - - - - - + + + + +
$lt{'ti'} $lt{'si'} $lt{'la'} $lt{'lm'} $lt{'st'} $lt{'ti'} $lt{'si'} $lt{'la'} $lt{'lm'} $lt{'st'}
$lt{'au'} $lt{'kw'} $lt{'ln'} $lt{'sr'} $lt{'av'} $lt{'au'} $lt{'kw'} $lt{'ln'} $lt{'sr'} $lt{'av'}  
- + + - -$closebutton -$groupimportbutton - +$closebutton $groupimportbutton END # ---------------------------------------------------------------- Bread crumbs - $r->print(&Apache::lonhtmlcommon::crumbs($uri)); + $r->print(&Apache::lonhtmlcommon::crumbs($uri,'','', + (($ENV{'form.catalogmode'} eq 'groupimport')? + 'document.forms.fileattr':'')). + &Apache::lonhtmlcommon::select_recent('residx','resrecent', +'this.form.action=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.submit();'). + ''); # ------------------------------------------------------ Remember where we were &Apache::loncommon::storeresurl($uri); + &Apache::lonhtmlcommon::store_recent('residx',$uri,$uri); # ----------------- output starting row to the indexed file/directory hierarchy my $titleclr="#ddffff"; # $r->print(&initdebug()); @@ -502,18 +507,13 @@ END } } - my $bredir = $ENV{'form.dirPointer'}; my $toplevel; my $indent = 0; $uri = $uri.'/' if $uri !~ /.*\/$/; - if ($bredir ne 'on') { - $hash{'top.level'} = $uri; - $toplevel = $uri; - } else { - $toplevel = $hash{'top.level'}; - } + $hash{'top.level'} = $uri; + $toplevel = $uri; # -------------------------------- if not at top level, provide an uplink arrow if ($toplevel ne '/res/'){ @@ -538,12 +538,9 @@ END # --------------------------------------------------- end the output and return $r->print(''."\n"); -# } else { -# $r->print('Unable to tie hash to db '. -# 'file'); -# return OK; } if(! $c->aborted()) { +# write back into the temporary file my %dbfile; if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_NEWDB(),0640)) { while (my($key,$value) = each(%hash)) { @@ -610,18 +607,17 @@ sub get_list { my ($r,$uri)=@_; my @list; (my $luri = $uri) =~ s/\//_/g; - - if ($ENV{'form.attrs'} eq &mt('Update Display')) { + if ($ENV{'form.updatedisplay'}) { foreach (keys %hash) { delete $hash{$_} if ($_ =~ /^dirlist_files_/); - } + } } - if ($hash{'dirlist_files'.$luri}) { + if ($hash{'dirlist_files_'.$luri}) { @list = split(/\n/,$hash{'dirlist_files_'.$luri}); } else { @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); } @@ -729,8 +725,6 @@ sub display_line { # display domain if ($filecom[1] eq 'domain') { - $r->print (''."\n") - if ($ENV{'form.dirPointer'} eq "on"); $r->print("$extrafield"); $r->print(""); &begin_form ($r,$filecom[0]); @@ -1015,7 +1009,6 @@ sub begin_form { 'enctype="application/x-www-form-urlencoded">'."\n"); $r->print (''. "\n"); - $r->print (''."\n"); $dnum++; }