--- loncom/interface/lonindexer.pm 2003/12/22 18:58:26 1.82
+++ loncom/interface/lonindexer.pm 2004/05/10 08:34:50 1.103
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Directory Indexer
#
-# $Id: lonindexer.pm,v 1.82 2003/12/22 18:58:26 www Exp $
+# $Id: lonindexer.pm,v 1.103 2004/05/10 08:34:50 taceyjo1 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,21 +25,6 @@
#
# http://www.lon-capa.org/
#
-# YEAR=1999
-# 5/21/99, 5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer)
-# 11/23 Gerd Kortemeyer
-# YEAR=2000
-# 07/20-08/04 H.K. Ng
-# YEAR=2001
-# 05/9-05/19/2001 H. K. Ng
-# 05/21/2001 H. K. Ng
-# 05/23/2001 H. K. Ng
-# 6/26,7/8 H. K. Ng
-# 8/14 H. K. Ng
-# 11/30 Matthew Hall
-# YEAR=2002
-# 6/29/2002 H. K. Ng
-#
###
###############################################################################
@@ -61,6 +46,8 @@ package Apache::lonindexer;
use strict;
use Apache::lonnet();
use Apache::loncommon();
+use Apache::lonhtmlcommon();
+use Apache::lonsequence();
use Apache::Constants qw(:common);
use Apache::lonmeta;
use Apache::File;
@@ -68,7 +55,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
@@ -83,20 +70,6 @@ my @Only = ();
my @Omit = ();
-# ------------------------------------------------------- Puts directory header
-
-sub crumbs {
- my $uri=shift;
- my $output='
/';
- my $path='/';
- foreach (split('/',$uri)) {
- unless ($_) { next; }
- $path.=$_.'/';
- $output.=''.$_.'/';
- }
- return $output.'
';
-}
-
# ----------------------------- Handling routine called via Apache and mod_perl
sub handler {
my $r = shift;
@@ -144,7 +117,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;
}
@@ -192,7 +165,7 @@ END
# selection is made.
# $element is the name of the element in $formname which receives
# 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.form' ,\%ENV,'form.form' );
&setvalues(\%hash,'form.element' ,\%ENV,'form.element');
@@ -215,8 +188,7 @@ END
$element = $ENV{'form.element'};
$titleelement = $ENV{'form.titleelement'};
}
- &Apache::lonxml::debug("mode=$mode form=$form element=$element
- titleelement=$titleelement");
+ #&Apache::lonxml::debug("mode=$mode form=$form element=$element titleelement=$titleelement");
# ------ set catalogmodefunctions to have extra needed javascript functionality
my $catalogmodefunctions='';
if ($ENV{'form.catalogmode'} eq 'interactive' or
@@ -388,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') {
@@ -417,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) {
@@ -430,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
@@ -452,28 +425,49 @@ $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'} |