Annotation of loncom/interface/lonindexer.pm, revision 1.128

1.1       www         1: # The LearningOnline Network with CAPA
1.24      harris41    2: # Directory Indexer
                      3: #
1.128   ! foxr        4: # $Id: lonindexer.pm,v 1.127 2004/10/21 09:53:44 foxr Exp $
1.24      harris41    5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
1.14      harris41   14: #
1.24      harris41   15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
1.14      harris41   27: #
1.23      harris41   28: ###
                     29: 
                     30: ###############################################################################
                     31: ##                                                                           ##
                     32: ## ORGANIZATION OF THIS PERL MODULE                                          ##
                     33: ##                                                                           ##
                     34: ## 1. Description of functions                                               ##
                     35: ## 2. Modules used by this module                                            ##
                     36: ## 3. Choices for different output views (detailed, summary, xml, etc)       ##
                     37: ## 4. BEGIN block (to be run once after compilation)                         ##
                     38: ## 5. Handling routine called via Apache and mod_perl                        ##
                     39: ## 6. Other subroutines                                                      ##
                     40: ##                                                                           ##
                     41: ###############################################################################
1.7       harris41   42: 
1.1       www        43: package Apache::lonindexer;
                     44: 
1.23      harris41   45: # ------------------------------------------------- modules used by this module
1.1       www        46: use strict;
                     47: use Apache::lonnet();
1.30      harris41   48: use Apache::loncommon();
1.83      www        49: use Apache::lonhtmlcommon();
1.94      www        50: use Apache::lonsequence();
1.1       www        51: use Apache::Constants qw(:common);
1.70      ng         52: use Apache::lonmeta;
1.2       harris41   53: use Apache::File;
1.77      www        54: use Apache::lonlocal;
1.109     taceyjo1   55: use Apache::lonsource();
1.2       harris41   56: use GDBM_File;
                     57: 
1.23      harris41   58: # ---------------------------------------- variables used throughout the module
1.87      www        59: my %hash; # global user-specific gdbm file
1.17      harris41   60: my %dirs; # keys are directories, values are the open/close status
                     61: my %language; # has the reference information present in language.tab
1.111     www        62: my %dynhash; # hash of hashes for dynamic metadata
1.117     www        63: my %dynread; # hash of directories already read for dynamic metadata
1.113     www        64: my %fieldnames; # Metadata fieldnames
1.17      harris41   65: # ----- Values which are set by the handler subroutine and are accessible to
                     66: # -----     other methods.
                     67: my $extrafield; # default extra table cell
                     68: my $fnum; # file counter
                     69: my $dnum; # directory counter
1.1       www        70: 
1.40      matthew    71: # ----- Used to include or exclude files with certain extensions.
1.43      matthew    72: my @Only = ();
1.40      matthew    73: my @Omit = ();
                     74: 
                     75: 
1.125     foxr       76: 
                     77: 
1.23      harris41   78: # ----------------------------- Handling routine called via Apache and mod_perl
1.1       www        79: sub handler {
                     80:     my $r = shift;
1.67      matthew    81:     my $c = $r->connection();
1.76      www        82:     &Apache::loncommon::content_type($r,'text/html');
1.50      albertel   83:     &Apache::loncommon::no_cache($r);
1.1       www        84:     $r->send_http_header;
                     85:     return OK if $r->header_only;
1.9       harris41   86:     $fnum=0;
1.16      harris41   87:     $dnum=0;
1.17      harris41   88: 
1.43      matthew    89:     # Deal with stupid global variables (is there a way around making
                     90:     # these global to this package?  It is just so wrong....)
                     91:     undef (@Only);
                     92:     undef (@Omit);
1.113     www        93:     %fieldnames=&Apache::lonmeta::fieldnames();
1.43      matthew    94: 
1.23      harris41   95: # ------------------------------------- read in machine configuration variables
1.10      harris41   96:     my $iconpath= $r->dir_config('lonIconsURL') . "/";
1.1       www        97:     my $domain  = $r->dir_config('lonDefDomain');
                     98:     my $role    = $r->dir_config('lonRole');
                     99:     my $loadlim = $r->dir_config('lonLoadLim');
                    100:     my $servadm = $r->dir_config('lonAdmEMail');
                    101:     my $sysadm  = $r->dir_config('lonSysEMail');
                    102:     my $lonhost = $r->dir_config('lonHostID');
                    103:     my $tabdir  = $r->dir_config('lonTabDir');
                    104: 
1.7       harris41  105:     my $fileclr='#ffffe6';
1.15      harris41  106:     my $line;
                    107:     my (@attrchk,@openpath);
                    108:     my $uri=$r->uri;
                    109: 
1.7       harris41  110: # -------------------------------------- see if called from an interactive mode
1.35      matthew   111:     # Get the parameters from the query string
1.36      matthew   112:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1.40      matthew   113: 	     ['catalogmode','launch','acts','mode','form','element',
1.79      albertel  114:               'only','omit','titleelement']);
1.35      matthew   115:     #-------------------------------------------------------------------
1.17      harris41  116:     my $closebutton='';
1.7       harris41  117:     my $groupimportbutton='';
                    118:     my $colspan=''; 
1.14      harris41  119: 
                    120:     $extrafield='';
1.17      harris41  121:     my $diropendb = 
1.66      albertel  122: 	"/home/httpd/perl/tmp/$ENV{'user.domain'}_$ENV{'user.name'}_indexer.db";
1.67      matthew   123:     %hash = ();
1.68      albertel  124:     {
                    125: 	my %dbfile;
1.87      www       126: 	if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_READER(),0640)) {
1.68      albertel  127: 	    while(my($key,$value)=each(%dbfile)) {
                    128: 		$hash{$key}=$value;
                    129: 	    }
                    130: 	    untie(%dbfile);
                    131: 	}
                    132:     }
                    133:     {
1.15      harris41  134: 	if ($ENV{'form.launch'} eq '1') {
1.17      harris41  135: 	    &start_fresh_session();
1.105     taceyjo1  136:    }
                    137:   #Hijack lonindexer to verify a title and be close down.
                    138:    if ($ENV{'form.launch'} eq '2') {
1.108     albertel  139:        $r->content_type('text/html');
                    140:        my $extra='';
1.118     albertel  141:        if (defined($ENV{'form.titleelement'}) && 
                    142: 	   $ENV{'form.titleelement'} ne '') {
1.108     albertel  143: 	   my $verify_title = &Apache::lonnet::gettitle($ENV{'form.acts'});
1.113     www       144: #	   &Apache::lonnet::logthis("Hrrm $ENV{'form.acts'} -- $verify_title");
1.108     albertel  145: 	   $verify_title=~s/'/\\'/g;
                    146: 	   $extra='window.opener.document.forms["'.$ENV{'form.form'}.'"].elements["'.$ENV{'form.titleelement'}.'"].value=\''.$verify_title.'\';';
                    147:        }
                    148:        $r->print(<<ENDSUBM);
1.105     taceyjo1  149: 		<html>
1.128   ! foxr      150: 		<!-- Generated by lonindexer.pm -->
1.105     taceyjo1  151: 		<script type="text/javascript">
                    152: 		function load() {
1.125     foxr      153: 			window.opener.document.forms["$ENV{'form.form'}"]
                    154: 			    .elements["$ENV{'form.element'}"]
                    155: 			    .value='$ENV{'form.acts'}';
1.108     albertel  156: 			$extra
1.105     taceyjo1  157: 			window.close();
                    158: 		}
                    159:    	</script>
                    160:     	<body onLoad=load();>
                    161:      	</body>
                    162:     	</html>
                    163: ENDSUBM
1.108     albertel  164:        return OK;
1.105     taceyjo1  165:    }
                    166:     
1.17      harris41  167: # -------------------- refresh environment with user database values (in %hash)
1.48      matthew   168: 	&setvalues(\%hash,'form.catalogmode',\%ENV,'form.catalogmode'   );
1.15      harris41  169: 
1.17      harris41  170: # --------------------- define extra fields and buttons in case of special mode
1.15      harris41  171: 	if ($ENV{'form.catalogmode'} eq 'interactive') {
                    172: 	    $extrafield='<td bgcolor="'.$fileclr.'" valign="bottom">'.
                    173: 		'<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'.
1.17      harris41  174: 		' border="0" /></td>';
1.15      harris41  175: 	    $colspan=" colspan='2' ";
1.77      www       176:             my $cl=&mt('Close');
1.15      harris41  177:             $closebutton=<<END;
1.77      www       178: <input type="button" name="close" value='$cl' onClick="self.close()">
1.7       harris41  179: END
1.16      harris41  180:         }
1.15      harris41  181: 	elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
                    182: 	    $extrafield='<td bgcolor="'.$fileclr.'" valign="bottom">'.
                    183: 		'<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'.
1.17      harris41  184: 		' border="0" /></td>';
1.15      harris41  185: 	    $colspan=" colspan='2' ";
1.77      www       186: 	    my $cl=&mt('Close');
1.123     matthew   187:             my $gi=&mt('Import');
1.15      harris41  188:             $closebutton=<<END;
1.77      www       189: <input type="button" name="close" value='$cl' onClick="self.close()">
1.7       harris41  190: END
1.15      harris41  191:             $groupimportbutton=<<END;
1.77      www       192: <input type="button" name="groupimport" value='$gi'
1.17      harris41  193: onClick="javascript:select_group()">
1.7       harris41  194: END
1.15      harris41  195:         }
1.35      matthew   196: 	# Additions made by Matthew to make the browser a little easier to deal
                    197: 	# with in the future.
                    198: 	#
                    199: 	# $mode (at this time) indicates if we are in edit mode.
                    200: 	# $form is the name of the form that the URL is placed when the
                    201: 	#       selection is made.
                    202: 	# $element is the name of the element in $formname which receives
                    203: 	#       the URL.
1.91      taceyjo1  204: 	#&Apache::lonxml::debug('Checking mode, form, element');
1.79      albertel  205: 	&setvalues(\%hash,'form.mode'        ,\%ENV,'form.mode'   );
                    206: 	&setvalues(\%hash,'form.form'        ,\%ENV,'form.form'   );
                    207: 	&setvalues(\%hash,'form.element'     ,\%ENV,'form.element');
                    208: 	&setvalues(\%hash,'form.titleelement',\%ENV,'form.titleelement');
                    209: 	&setvalues(\%hash,'form.only'        ,\%ENV,'form.only'   );
                    210: 	&setvalues(\%hash,'form.omit'        ,\%ENV,'form.omit'   );
1.35      matthew   211: 
1.40      matthew   212:         # Deal with 'omit' and 'only' 
                    213:         if (exists $ENV{'form.omit'}) {
                    214:             @Omit = split(',',$ENV{'form.omit'});
                    215:         }
                    216:         if (exists $ENV{'form.only'}) {
                    217:             @Only = split(',',$ENV{'form.only'});
                    218:         }
                    219:         
1.35      matthew   220: 	my $mode = $ENV{'form.mode'};
1.79      albertel  221: 	my ($form,$element,$titleelement);
1.39      matthew   222: 	if ($mode eq 'edit' || $mode eq 'parmset') {
1.79      albertel  223: 	    $form         = $ENV{'form.form'};
                    224: 	    $element      = $ENV{'form.element'};
                    225: 	    $titleelement = $ENV{'form.titleelement'};
1.35      matthew   226: 	}
1.90      taceyjo1  227: 	#&Apache::lonxml::debug("mode=$mode form=$form element=$element titleelement=$titleelement");
1.17      harris41  228: # ------ set catalogmodefunctions to have extra needed javascript functionality
1.15      harris41  229: 	my $catalogmodefunctions='';
                    230: 	if ($ENV{'form.catalogmode'} eq 'interactive' or
                    231: 	    $ENV{'form.catalogmode'} eq 'groupimport') {
1.35      matthew   232: 	    # The if statement below sets us up to use the old version
                    233: 	    # by default (ie. if $mode is undefined).  This is the easy
                    234: 	    # way out.  Hopefully in the future I'll find a way to get 
                    235: 	    # the calls dealt with in a more comprehensive manner.
1.41      www       236: 
                    237: #
                    238: # There is now also mode "simple", which is for the simple version of the rat
                    239: #
                    240: #
1.39      matthew   241: 	    if (!defined($mode) || ($mode ne 'edit' && $mode ne 'parmset')) {
1.40      matthew   242:                 my $location = "/adm/groupsort?catalogmode=groupimport&";
1.41      www       243:                 $location .= "mode=".$mode."&";
1.40      matthew   244:                 $location .= "acts=";
1.35      matthew   245: 		$catalogmodefunctions=<<"END";
1.108     albertel  246: function select_data(url) {
1.7       harris41  247:     changeURL(url);
1.8       harris41  248:     self.close();
                    249: }
                    250: function select_group() {
1.40      matthew   251:     window.location="$location"+document.forms.fileattr.acts.value;
1.16      harris41  252: }
1.35      matthew   253: function changeURL(val) {
                    254:     if (opener.inf) {
                    255:         if (opener.inf.document.forms.resinfo.elements.u) {
                    256: 	    opener.inf.document.forms.resinfo.elements.u.value=val;
                    257:         }
1.7       harris41  258:     }
                    259: }
1.35      matthew   260: END
1.39      matthew   261:             } elsif ($mode eq 'edit') { # we are in 'edit' mode
1.40      matthew   262:                 my $location = "/adm/groupsort?catalogmode=interactive&";
                    263:                 $location .= "form=$form&element=$element&mode=edit&acts=";
1.35      matthew   264: 		$catalogmodefunctions=<<END;
                    265: // mode = $mode
1.108     albertel  266: function select_data(url) {
                    267:    var location = "/res/?launch=2&form=$form&element=$element&titleelement=$titleelement&acts=" + url;
1.105     taceyjo1  268:    window.location=location;
1.35      matthew   269: }
                    270: function select_group() {
1.40      matthew   271:     window.location="$location"+document.forms.fileattr.acts.value;
1.35      matthew   272: }
                    273: 
1.7       harris41  274: function changeURL(val) {
1.35      matthew   275:     if (window.opener.document) {
                    276: 	window.opener.document.forms["$form"].elements["$element"].value=val;
                    277:     } else {
                    278: 	    alert("The file you selected is: "+val);
1.7       harris41  279:     }
                    280: }
                    281: END
1.79      albertel  282:                 if (!$titleelement) {
                    283: 		    $catalogmodefunctions.='function changeTitle(val) {}';
                    284: 		} else {
                    285: 		    $catalogmodefunctions.=<<END;
                    286: function changeTitle(val) {
                    287:     if (window.opener.document) {
                    288: 	    window.opener.document.forms["$form"].elements["$titleelement"].value=val;
                    289:     } else {
                    290: 	    alert("The title of the file you selected is: "+val);
                    291:     }
                    292: }
                    293: END
                    294:                 }
1.39      matthew   295:             } elsif ($mode eq 'parmset') {
1.40      matthew   296:                 my $location = "/adm/groupsort?catalogmode=interactive&";
                    297:                 $location .= "form=$form&element=$element&mode=parmset&acts=";
1.39      matthew   298: 		$catalogmodefunctions=<<END;
                    299: // mode = $mode
1.108     albertel  300: function select_data(url) {
1.39      matthew   301:     changeURL(url);
                    302:     self.close();
                    303: }
                    304: 
                    305: function select_group() {
1.40      matthew   306:     window.location="$location"+document.forms.fileattr.acts.value;
1.39      matthew   307: }
                    308: 
                    309: function changeURL(val) {
                    310:     if (window.opener.document) {
                    311:         var elementname  = "$element"+"_value";
                    312:         var checkboxname = "$element"+"_setparmval";
                    313: 	window.opener.document.forms["$form"].elements[elementname].value=val;
                    314:         window.opener.document.forms["$form"].elements[checkboxname].checked=true;
                    315:     } else {
                    316: 	    alert("The file you selected is: "+val);
                    317:     }
                    318: }
                    319: 
                    320: END
                    321:             }
1.15      harris41  322:         }
1.38      matthew   323:         $catalogmodefunctions.=<<END;
                    324: var acts='';
                    325: function rep_dirpath(suffix,val) {
                    326:     eval("document.forms.dirpath"+suffix+".acts.value=val");
                    327: }
                    328: END
1.16      harris41  329: 	if ($ENV{'form.catalogmode'} eq 'groupimport') {
1.38      matthew   330:             $catalogmodefunctions.=<<END;
1.16      harris41  331: function queue(val) {
                    332:     if (eval("document.forms."+val+".filelink.checked")) {
                    333: 	var l=val.length;
                    334: 	var v=val.substring(4,l);
                    335: 	document.forms.fileattr.acts.value+='1a'+v+'b';
                    336:     }
                    337:     else {
                    338: 	var l=val.length;
                    339: 	var v=val.substring(4,l);
                    340: 	document.forms.fileattr.acts.value+='0a'+v+'b';
                    341:     }
                    342: }
                    343: END
                    344: 	}
1.17      harris41  345: 
1.1       www       346: # ---------------------------------------------------------------- Print Header
1.15      harris41  347: 	$r->print(<<ENDHEADER);
1.1       www       348: <html>
                    349: <head>
1.2       harris41  350: <title>The LearningOnline Network With CAPA Directory Browser</title>
1.3       harris41  351: 
1.128   ! foxr      352: <!-- Generated by lonindexer.pm -->
        !           353: 
1.19      harris41  354: <script type="text/javascript">
1.7       harris41  355: $catalogmodefunctions
1.69      www       356: function openWindow(url, wdwName, w, h, toolbar,scrollbar,locationbar) {
1.71      ng        357:     var xpos = (screen.width-w)/2;
                    358:     xpos = (xpos < 0) ? '0' : xpos;
                    359:     var ypos = (screen.height-h)/2-30;
                    360:     ypos = (ypos < 0) ? '0' : ypos;
                    361:     var options = "width=" + w + ",height=" + h + ",screenx="+xpos+",screeny="+ypos+",";
1.2       harris41  362:     options += "resizable=yes,scrollbars="+scrollbar+",status=no,";
1.69      www       363:     options += "menubar=no,toolbar="+toolbar+",location="+locationbar+",directories=no";
1.2       harris41  364:     var newWin = window.open(url, wdwName, options);
                    365:     newWin.focus();
                    366: }
1.16      harris41  367: function gothere(val) {
                    368:     window.location=val+'?acts='+document.forms.fileattr.acts.value;
                    369: }
1.14      harris41  370: </script>
1.3       harris41  371: 
1.1       www       372: </head>
                    373: ENDHEADER
1.74      www       374: my ($headerdom)=($uri=~/^\/res\/(\w+)\//);
                    375: $r->print(&Apache::loncommon::bodytag('Browse Resources',undef,undef,undef,
                    376: 				      $headerdom));
1.17      harris41  377: # - Evaluate actions from previous page (both cumulatively and chronologically)
1.16      harris41  378:         if ($ENV{'form.catalogmode'} eq 'groupimport') {
                    379: 	    my $acts=$ENV{'form.acts'};
                    380: 	    my @Acts=split(/b/,$acts);
                    381: 	    my %ahash;
                    382: 	    my %achash;
                    383: 	    my $ac=0;
1.17      harris41  384: 	    # some initial hashes for working with data
1.27      harris41  385: 	    foreach (@Acts) {
1.16      harris41  386: 		my ($state,$ref)=split(/a/);
                    387: 		$ahash{$ref}=$state;
                    388: 		$achash{$ref}=$ac;
                    389: 		$ac++;
1.27      harris41  390: 	    }
1.87      www       391: 	    # sorting through the actions and changing the global database hash
1.27      harris41  392: 	    foreach (sort {$achash{$a}<=>$achash{$b}} (keys %ahash)) {
1.16      harris41  393: 		my $key=$_;
                    394: 		if ($ahash{$key} eq '1') {
                    395: 		    $hash{'store_'.$hash{'pre_'.$key.'_link'}}=
                    396: 			$hash{'pre_'.$key.'_title'};
                    397: 		    $hash{'storectr_'.$hash{'pre_'.$key.'_link'}}=
                    398: 			$hash{'storectr'}+0;
                    399: 		    $hash{'storectr'}++;
                    400: 		}
                    401: 		if ($ahash{$key} eq '0') {
                    402: 		    if ($hash{'store_'.$hash{'pre_'.$key.'_link'}}) {
                    403: 			delete $hash{'store_'.$hash{'pre_'.$key.'_link'}};
                    404: 		    }
                    405: 		}
1.27      harris41  406: 	    }
1.17      harris41  407: 	    # deleting the previously cached listing
1.27      harris41  408: 	    foreach (keys %hash) {
1.16      harris41  409: 		if ($_ =~ /^pre_/ && $_ =~/link$/) {
                    410: 		    my $key = $_;
                    411: 		    $key =~ s/^pre_//;
                    412: 		    $key =~ s/_[^_]*$//;
                    413: 		    delete $hash{'pre_'.$key.'_title'};
                    414: 		    delete $hash{'pre_'.$key.'_link'};
                    415: 		}
1.27      harris41  416: 	    }
1.16      harris41  417: 	}
                    418: 	
1.23      harris41  419: # ---------------------------------- get state of file attributes to be showing
1.87      www       420: 	if ($ENV{'form.attrs'}) {
1.111     www       421: 	    for (my $i=0; $i<=11; $i++) {
1.6       harris41  422: 		delete $hash{'display_attrs_'.$i};
                    423: 		if ($ENV{'form.attr'.$i} == 1) {
1.45      ng        424: 		    $attrchk[$i] = 'checked';
1.6       harris41  425: 		    $hash{'display_attrs_'.$i} = 1;
                    426: 		}
                    427: 	    }
                    428: 	} else {
1.111     www       429: 	    for (my $i=0; $i<=11; $i++) {
1.45      ng        430: 		$attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1;
1.6       harris41  431: 	    }
                    432: 	}
1.87      www       433: 
1.23      harris41  434: # ------------------------------- output state of file attributes to be showing
1.71      ng        435: #                                 All versions has to the last item
                    436: #                                 since it does not take an extra col
1.77      www       437: 	my %lt=&Apache::lonlocal::texthash(
                    438: 					   'ti' => 'Title',
                    439: 					   'si' => 'Size',
                    440: 					   'la' => 'Last access',
                    441: 					   'lm' => 'Last modified',
                    442: 					   'st' => 'Statistics',
                    443: 					   'au' => 'Author',
                    444: 					   'kw' => 'Keywords',
1.78      www       445: 					   'ln' => 'Language',
1.109     taceyjo1  446: 					   'sa' => 'Source Available',
1.77      www       447: 					   'sr' => 'Show resource',
1.111     www       448: 					   'li' => 'Linked/Related Resources',
1.77      www       449: 					   'av' => 'All versions',
                    450: 					   'ud' => 'Update Display'
                    451: 					   );
1.15      harris41  452: 	$r->print(<<END);
1.17      harris41  453: <form method="post" name="fileattr" action="$uri"
                    454:  enctype="application/x-www-form-urlencoded">
1.124     matthew   455: <label><input type="checkbox" name="attr9" value="1" $attrchk[9] onClick="this.form.submit();" /> $lt{'av'}</label>
1.115     www       456: <table border="0">
                    457: <tr>
1.124     matthew   458: <td><label><input type="checkbox" name="attr0" value="1" $attrchk[0] onClick="this.form.submit();" /> $lt{'ti'}</label></td>
                    459: <td><label><input type="checkbox" name="attr4" value="1" $attrchk[4] onClick="this.form.submit();" /> $lt{'au'}</label></td>
                    460: <td><label><input type="checkbox" name="attr5" value="1" $attrchk[5] onClick="this.form.submit();" /> $lt{'kw'}</label></td>
                    461: <td><label><input type="checkbox" name="attr6" value="1" $attrchk[6] onClick="this.form.submit();" /> $lt{'ln'}</label></td>
1.115     www       462: </tr>
                    463: <tr>
1.124     matthew   464: <td><label><input type="checkbox" name="attr1" value="1" $attrchk[1] onClick="this.form.submit();" /> $lt{'si'}</label></td>
                    465: <td><label><input type="checkbox" name="attr2" value="1" $attrchk[2] onClick="this.form.submit();" /> $lt{'la'}</label></td>
                    466: <td><label><input type="checkbox" name="attr3" value="1" $attrchk[3] onClick="this.form.submit();" /> $lt{'lm'}</label></td>
                    467: <td><label><input type="checkbox" name="attr10" value="1" $attrchk[10] onClick="this.form.submit();" /> $lt{'sa'}</label></td>
1.115     www       468: </tr>
                    469: <tr>
1.124     matthew   470: <td><label><input type="checkbox" name="attr8" value="1" $attrchk[8] onClick="this.form.submit();" /> $lt{'st'}</label></td>
                    471: <td><label><input type="checkbox" name="attr11" value="1" $attrchk[11] onClick="this.form.submit();" /> $lt{'li'}</label></td>
                    472: <td><label><input type="checkbox" name="attr7" value="1" $attrchk[7] onClick="this.form.submit();" /> $lt{'sr'}</label></td>
1.115     www       473: <td>&nbsp;</td>
                    474: </tr>
                    475: </table>
1.87      www       476: <input type="hidden" name="attrs" value="1" />
                    477: <input type="submit" name="updatedisplay" value="$lt{'ud'}" />
1.16      harris41  478: <input type="hidden" name="acts" value="" />
1.87      www       479: $closebutton $groupimportbutton
1.1       www       480: END
1.97      www       481: # -------------- Filter out sequence containment in crumbs and "recent folders"
                    482: 	my $storeuri=$uri;
                    483: 	$storeuri='/'.(split(/\.(page|sequence)\/\//,$uri))[-1];
                    484: 	$storeuri=~s/\/+/\//g;
1.82      www       485: # ---------------------------------------------------------------- Bread crumbs
1.97      www       486:         $r->print(&Apache::lonhtmlcommon::crumbs($storeuri,'','',
1.87      www       487: 				(($ENV{'form.catalogmode'} eq 'groupimport')?
                    488: 				 'document.forms.fileattr':'')).
                    489: 		  &Apache::lonhtmlcommon::select_recent('residx','resrecent',
1.128   ! foxr      490: 'window.status=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.action=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.submit();'));
1.100     www       491: # -------------------------------------------------------- Resource Home Button
                    492: 	my $reshome=$ENV{'course.'.$ENV{'request.course.id'}.'.reshome'};
                    493: 	if ($reshome) {
                    494: 	    $r->print("<font size='+2'><a href='");
                    495: 	    if ($ENV{'form.catalogmode'} eq 'groupimport') {
                    496: 		$r->print('javascript:document.forms.fileattr.action="'.$reshome.'";document.forms.fileattr.submit();');
                    497: 	    } else {
                    498: 		$r->print($reshome);
                    499: 	    }
                    500: 	    $r->print("'>".&mt('Home').'</a></font>');
                    501: 	}
                    502: 	$r->print('</form>');
1.85      www       503: # ------------------------------------------------------ Remember where we were
1.97      www       504: 	&Apache::loncommon::storeresurl($storeuri);
                    505: 	&Apache::lonhtmlcommon::store_recent('residx',$storeuri,$storeuri);
1.23      harris41  506: # ----------------- output starting row to the indexed file/directory hierarchy
1.15      harris41  507:         my $titleclr="#ddffff";
1.40      matthew   508: #        $r->print(&initdebug());
                    509: #        $r->print(&writedebug("Omit:@Omit")) if (@Omit);
                    510: #        $r->print(&writedebug("Only:@Only")) if (@Only);
1.46      ng        511:         $r->print("<table width='100\%' border=0><tr><td bgcolor=#777777>\n");
1.45      ng        512: 	$r->print("<table width='100\%' border=0><tr bgcolor=$titleclr>\n");
1.77      www       513: 	$r->print("<td $colspan><b>".&mt('Name')."</b></td>\n");
                    514: 	$r->print("<td><b>".&mt('Title')."</b></td>\n") 
1.45      ng        515: 	    if ($hash{'display_attrs_0'} == 1);
1.77      www       516: 	$r->print("<td align=right><b>".&mt("Size")." (".&mt("bytes").") ".
1.45      ng        517: 		  "</b></td>\n") if ($hash{'display_attrs_1'} == 1);
1.77      www       518: 	$r->print("<td><b>".&mt("Last accessed")."</b></td>\n") 
1.17      harris41  519: 	    if ($hash{'display_attrs_2'} == 1);
1.77      www       520: 	$r->print("<td><b>".&mt("Last modified")."</b></td>\n")
1.17      harris41  521: 	    if ($hash{'display_attrs_3'} == 1);
1.77      www       522: 	$r->print("<td><b>".&mt("Author(s)")."</b></td>\n")
1.17      harris41  523: 	    if ($hash{'display_attrs_4'} == 1);
1.77      www       524: 	$r->print("<td><b>".&mt("Keywords")."</b></td>\n")
1.17      harris41  525: 	    if ($hash{'display_attrs_5'} == 1);
1.77      www       526: 	$r->print("<td><b>".&mt("Language")."</b></td>\n")
1.45      ng        527: 	    if ($hash{'display_attrs_6'} == 1);
1.77      www       528: 	$r->print("<td><b>".&mt("Usage Statistics")." <br />(".
1.120     matthew   529: 		  &mt("Courses/Network Hits").")</b> ".&mt('updated periodically')."</td>\n")
1.70      ng        530: 	    if ($hash{'display_attrs_8'} == 1);
1.109     taceyjo1  531: 	$r->print("<td><b>".&mt("Source Available")."</b></td>\n")
                    532: 	    if ($hash{'display_attrs_10'} == 1);
1.111     www       533: 	$r->print("<td><b>".&mt("Linked/Related Resources")."</b></td>\n")
                    534: 	    if ($hash{'display_attrs_11'} == 1);
1.115     www       535: 	$r->print("<td><b>".&mt("Resource")."</b></td>\n")
                    536: 	    if ($hash{'display_attrs_7'} == 1);
1.45      ng        537: 	$r->print('</tr>');
1.5       harris41  538: 
1.23      harris41  539: # ----------------- read in what directories have previously been set to "open"
1.27      harris41  540: 	foreach (keys %hash) {
1.4       harris41  541: 	    if ($_ =~ /^diropen_status_/) {
                    542: 		my $key = $_;
                    543: 		$key =~ s/^diropen_status_//;
                    544: 		$dirs{$key} = $hash{$_};
                    545: 	    }
1.27      harris41  546: 	}
1.4       harris41  547: 
1.2       harris41  548: 	if ($ENV{'form.openuri'}) {  # take care of review and refresh options
                    549: 	    my $uri=$ENV{'form.openuri'};
1.4       harris41  550: 	    if (exists($hash{'diropen_status_'.$uri})) {
                    551: 		my $cursta = $hash{'diropen_status_'.$uri};
1.2       harris41  552: 		$dirs{$uri} = 'open';
1.4       harris41  553: 		$hash{'diropen_status_'.$uri} = 'open';
                    554: 		if ($cursta eq 'open') {
                    555: 		    $dirs{$uri} = 'closed';
                    556: 		    $hash{'diropen_status_'.$uri} = 'closed';
                    557: 		}
1.2       harris41  558: 	    } else {
1.4       harris41  559: 		$hash{'diropen_status_'.$uri} = 'open';
1.2       harris41  560: 		$dirs{$uri} = 'open';
                    561: 	    }
                    562: 	}
1.12      ng        563: 	
                    564: 	my $toplevel;
1.13      ng        565: 	my $indent = 0;
1.12      ng        566: 	$uri = $uri.'/' if $uri !~ /.*\/$/;
1.17      harris41  567: 
1.88      www       568:  	if ($ENV{'form.dirPointer'} ne 'on') {
                    569:  	    $hash{'top.level'} = $uri;
                    570:  	    $toplevel = $uri;
                    571:  	} else {
                    572:  	    $toplevel = $hash{'top.level'};
                    573:  	}
1.17      harris41  574: 
1.23      harris41  575: # -------------------------------- if not at top level, provide an uplink arrow
1.45      ng        576: 	if ($toplevel ne '/res/'){
1.13      ng        577: 	    my (@uri_com) = split(/\//,$uri);
                    578: 	    pop @uri_com;
                    579: 	    my $upone = join('/',@uri_com);
                    580: 	    my @list = qw (0);
                    581: 	    &display_line ($r,'opened',$upone.'&viewOneUp',0,$upone,@list);
                    582: 	    $indent = 1;
1.12      ng        583: 	}
1.17      harris41  584: 
1.23      harris41  585: # -------- recursively go through all the directories and output as appropriate
1.16      harris41  586: 	&scanDir ($r,$toplevel,$indent,\%hash);
1.12      ng        587: 	
1.23      harris41  588: # ---------------------------- embed hidden information useful for group import
1.8       harris41  589: 	$r->print("<form name='fnum'>");
                    590: 	$r->print("<input type='hidden' name='fnum' value='$fnum'></form>");
1.17      harris41  591: 
1.23      harris41  592: # -------------------------------------------------------------- end the tables
1.45      ng        593: 	$r->print('</table>');
                    594: 	$r->print('</td></tr></table>');
1.17      harris41  595: 
1.23      harris41  596: # --------------------------------------------------- end the output and return
1.45      ng        597: 	$r->print('</body></html>'."\n");
1.2       harris41  598:     }
1.67      matthew   599:     if(! $c->aborted()) {
1.87      www       600: # write back into the temporary file
1.68      albertel  601: 	my %dbfile;
1.67      matthew   602:         if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_NEWDB(),0640)) {
                    603:             while (my($key,$value) = each(%hash)) {
                    604:                 $dbfile{$key}=$value;
                    605:             }
                    606:             untie(%dbfile);
                    607:         }
                    608:     }
                    609: 
1.1       www       610:     return OK;
                    611: }
1.2       harris41  612: 
1.17      harris41  613: # ----------------------------------------------- recursive scan of a directory
1.2       harris41  614: sub scanDir {
1.16      harris41  615:     my ($r,$startdir,$indent,$hashref)=@_;
1.67      matthew   616:     my $c = $r->connection();
1.3       harris41  617:     my ($compuri,$curdir);
                    618:     my $dirptr=16384;
1.90      taceyjo1  619:     my $obs;
1.1       www       620:     $indent++;
1.2       harris41  621:     my %dupdirs = %dirs;
                    622:     my @list=&get_list($r,$startdir);
                    623:     foreach my $line (@list) {
1.67      matthew   624:         return if ($c->aborted());
1.90      taceyjo1  625: 	#This is a kludge, sorry aboot this
1.92      taceyjo1  626: 	my ($strip,$dom,undef,$testdir,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
1.90      taceyjo1  627: 	next if($strip =~ /.*\.meta$/ | $obs eq '1');
1.18      ng        628: 	my (@fileparts) = split(/\./,$strip);
1.70      ng        629: 	if ($hash{'display_attrs_9'} != 1) {
1.95      www       630: # if not all versions to be shown
1.18      ng        631: 	    if (scalar(@fileparts) >= 3) {
                    632: 		my $fext = pop @fileparts;
                    633: 		my $ov = pop @fileparts;
                    634: 		my $fname = join ('.',@fileparts,$fext);
1.75      albertel  635: 		next if (grep /\Q$fname\E/,@list and $ov =~ /^\d+$/);
1.18      ng        636: 	    }
                    637: 	}
                    638: 
1.45      ng        639: 	if ($dom eq 'domain') {
1.72      albertel  640: 	    # dom list has full path /res/<domain name>/ already
                    641: 	    $curdir='';
1.73      albertel  642: 	    $compuri = (split(/\&/,$line))[0];
1.2       harris41  643: 	} else {
1.17      harris41  644: 	    # user, dir & file have name only, i.e., w/o path
1.45      ng        645: 	    $compuri = join('',$startdir,$strip,'/');
1.3       harris41  646: 	    $curdir = $startdir;
1.2       harris41  647: 	}
1.45      ng        648: 	my $diropen = 'closed';
1.96      www       649: 	if (($dirptr&$testdir) or ($dom =~ /^(domain|user)$/) or ($compuri=~/\.(sequence|page)\/$/)) {
1.3       harris41  650: 	    while (my ($key,$val)= each %dupdirs) {
1.5       harris41  651: 		if ($key eq $compuri and $val eq "open") {
1.11      ng        652: 		    $diropen = "opened";
1.53      albertel  653: 		    delete($dupdirs{$key});
                    654: 		    delete($dirs{$key});
1.5       harris41  655: 		}
1.3       harris41  656: 	    }
1.1       www       657: 	}
1.16      harris41  658: 	&display_line($r,$diropen,$line,$indent,$curdir,$hashref,@list);
1.45      ng        659: 	&scanDir ($r,$compuri,$indent) if $diropen eq 'opened';
1.1       www       660:     }
                    661:     $indent--;
                    662: }
                    663: 
1.17      harris41  664: # --------------- get complete matched list based on the uri (returns an array)
1.1       www       665: sub get_list {
                    666:     my ($r,$uri)=@_;
1.97      www       667:     my @list=();
1.45      ng        668:     (my $luri = $uri) =~ s/\//_/g;
1.87      www       669:     if ($ENV{'form.updatedisplay'}) {
1.27      harris41  670: 	foreach (keys %hash) {
1.4       harris41  671: 	    delete $hash{$_} if ($_ =~ /^dirlist_files_/);
1.121     albertel  672: 	    delete $hash{$_} if ($_ =~ /^dirlist_timestamp_files_/);
1.87      www       673: 	}
1.2       harris41  674:     }
                    675: 
1.121     albertel  676:     if (defined($hash{'dirlist_files_'.$luri}) &&
                    677: 	$hash{'dirlist_timestamp_files_'.$luri}+600 > (time)) {
1.4       harris41  678: 	@list = split(/\n/,$hash{'dirlist_files_'.$luri});
1.97      www       679:     } elsif ($uri=~/\.(page|sequence)\/$/) {
1.94      www       680: # is a page or a sequence
1.97      www       681: 	$uri=~s/\/$//;
                    682: 	$uri='/'.(split(/\.(page|sequence)\/\//,$uri))[-1];
                    683: 	$uri=~s/\/+/\//g;
                    684: 	foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$uri))) {
                    685: 	    my @ratpart=split(/\:/,$_);
                    686: 	    push @list,$ratpart[1];
                    687: 	} 
1.94      www       688: 	$hash{'dirlist_files_'.$luri} = join("\n",@list);
1.1       www       689:     } else {
1.94      www       690: # is really a directory
1.4       harris41  691: 	@list = &Apache::lonnet::dirlist($uri);
1.87      www       692: 	$hash{'dirlist_files_'.$luri} = join("\n",@list);
1.121     albertel  693: 	$hash{'dirlist_timestamp_files_'.$luri} = time;
1.1       www       694:     }
1.91      taceyjo1  695:     return @list=&match_ext($r,@list);
1.1       www       696: }
                    697: 
1.112     www       698: sub dynmetaread {
                    699:     my $uri=shift;
                    700:     if (($hash{'display_attrs_8'}==1) || ($hash{'display_attrs_11'}==1)) {
1.117     www       701: # We don't want the filename
                    702: 	$uri=~s/\/[^\/]+$//;
                    703: # Did we already see this?
                    704: 	my $builddir=$uri;
                    705: 	while ($builddir) {
                    706: 	    if ($dynread{$builddir}) {
                    707: 		return 0;
                    708: 	    }
                    709: 	    $builddir=~s/\/[^\/]+$//;
                    710: 	}
                    711: # Actually get the data
1.112     www       712: 	%dynhash=
                    713: 	    (%dynhash,&Apache::lonmeta::get_dynamic_metadata_from_sql($uri));
1.117     www       714: # Remember that we got it
                    715: 	$dynread{$uri}=1;
1.112     www       716:     } 
                    717: }
                    718: 
1.40      matthew   719: sub initdebug {
                    720:     return <<ENDJS;
                    721: <script>
                    722: var debugging = true;
                    723: if (debugging) {
                    724:     var debuggingWindow = window.open('','Debug','width=400,height=300',true);
                    725: } 
                    726: 
                    727: function output(text) {
                    728:     if (debugging) {
                    729:         debuggingWindow.document.writeln(text);
                    730:     }
                    731: }
1.128   ! foxr      732: output("<html><head><title>Debugging Window</title><!-- for lonindexer.pm --></head><body><pre>");   
1.40      matthew   733: </script>
                    734: ENDJS
                    735: }
                    736: 
                    737: sub writedebug {
                    738:     my $text = shift;
                    739:     return "<script>output('$text');</script>";
                    740: }
                    741: 
1.17      harris41  742: # -------------------- filters out files based on extensions (returns an array)
1.1       www       743: sub match_ext {
                    744:     my ($r,@packlist)=@_;
                    745:     my @trimlist;
                    746:     my $nextline;
                    747:     my @fileext;
                    748:     my $dirptr=16384;
                    749: 
1.2       harris41  750:     foreach my $line (@packlist) {
                    751: 	chomp $line;
                    752: 	$line =~ s/^\/home\/httpd\/html//;
                    753: 	my @unpackline = split (/\&/,$line);
1.45      ng        754: 	next if ($unpackline[0] eq '.');
                    755: 	next if ($unpackline[0] eq '..');
1.2       harris41  756: 	my @filecom = split (/\./,$unpackline[0]);
                    757: 	my $fext = pop(@filecom);
1.96      www       758: 	my $fnptr = ($unpackline[3]&$dirptr) || ($fext=~/\.(page|sequence)$/);
1.2       harris41  759:  	if ($fnptr == 0 and $unpackline[3] ne "") {
1.28      harris41  760: 	    my $embstyle = &Apache::loncommon::fileembstyle($fext);
1.25      matthew   761:             push @trimlist,$line if (defined($embstyle) && 
1.32      harris41  762: 				     ($embstyle ne 'hdn' or $fext eq 'meta'));
1.1       www       763: 	} else {
1.2       harris41  764: 	    push @trimlist,$line;
1.1       www       765: 	}
                    766:     }
1.80      albertel  767:     @trimlist = sort {uc($a) cmp uc($b)} (@trimlist);
1.1       www       768:     return @trimlist;
                    769: }
                    770: 
1.17      harris41  771: # ------------------------------- displays one line in appropriate table format
1.23      harris41  772: sub display_line {
1.16      harris41  773:     my ($r,$diropen,$line,$indent,$startdir,$hashref,@list)=@_;
1.53      albertel  774:     my (@pathfn, $fndir);
1.97      www       775: # there could be relative paths (files actually belonging into this directory)
                    776: # or absolute paths (for example, from sequences)
                    777:     my $absolute;
                    778:     my $pathprefix;
1.107     albertel  779:     if ($line=~m|^/res/| && $startdir ne '') {
1.97      www       780: 	$absolute=1;
                    781: 	$pathprefix='';
                    782:     } else {
                    783: 	$absolute=0;
                    784: 	$pathprefix=$startdir;
                    785:     }
1.1       www       786:     my $dirptr=16384;
                    787:     my $fileclr="#ffffe6";
1.45      ng        788:     my $iconpath= $r->dir_config('lonIconsURL') . '/';
1.1       www       789: 
                    790:     my @filecom = split (/\&/,$line);
                    791:     my @pathcom = split (/\//,$filecom[0]);
                    792:     my $listname = $pathcom[scalar(@pathcom)-1];
                    793:     my $fnptr = $filecom[3]&$dirptr;
1.77      www       794:     my $msg = &mt('View').' '.$filecom[0].' '.&mt('resources');
                    795:     $msg = &mt('Close').' '.$filecom[0].' '.&mt('directory') if $diropen eq 'opened';
1.1       www       796: 
1.45      ng        797:     my $tabtag='</td>';
1.1       www       798:     my $i=0;
1.109     taceyjo1  799:     while ($i<=11) {
1.45      ng        800: 	$tabtag=join('',$tabtag,"<td>&nbsp;</td>")
1.17      harris41  801: 	    if $hash{'display_attrs_'.$i} == 1;
1.1       www       802: 	$i++;
                    803:     }
1.63      ng        804:     my $valign = ($hash{'display_attrs_7'} == 1 ? 'top' : 'bottom');
1.17      harris41  805: 
                    806: # display uplink arrow
1.45      ng        807:     if ($filecom[1] eq 'viewOneUp') {
1.98      www       808: 	my $updir=$startdir;
                    809: # -------------- Filter out sequence containment in crumbs and "recent folders"
                    810: 	$updir='/'.(split(/\.(page|sequence)\/\//,$startdir))[-1];
                    811: 	$updir=~s/\/+/\//g;
                    812: 
1.70      ng        813: 	$r->print("<tr valign='$valign' bgcolor=$fileclr>$extrafield");
                    814: 	$r->print("<td>\n");
1.98      www       815: 	$r->print ('<form method="post" name="dirpathUP" action="'.$updir.
1.16      harris41  816: 		   '/" '.
1.17      harris41  817: 		   'onSubmit="return rep_dirpath(\'UP\','.
                    818: 		   'document.forms.fileattr.acts.value)" '.
1.16      harris41  819: 		   'enctype="application/x-www-form-urlencoded"'.
                    820:                    '>'."\n");
1.17      harris41  821: 	$r->print ('<input type=hidden name=openuri value="'.
                    822: 		   $startdir.'">'."\n");
1.16      harris41  823: 	$r->print ('<input type="hidden" name="acts" value="">'."\n");
1.13      ng        824: 	$r->print ('<input src="'.$iconpath.'arrow_up.gif"');
1.17      harris41  825: 	$r->print (' name="'.$msg.'" height="22" type="image" border="0">'.
                    826: 		   "\n");
1.77      www       827: 	$r->print(&mt("Up")." $tabtag</tr></form>\n");
1.13      ng        828: 	return OK;
                    829:     }
1.97      www       830: # Do we have permission to look at this?
                    831: 
                    832:     if($filecom[15] ne '1') { return OK if (!&Apache::lonnet::allowed('bre',$pathprefix.$filecom[0])); }
                    833: 
                    834: # make absolute links appear on different background
1.112     www       835:     if ($absolute) { $fileclr='#ccdd99'; }
1.17      harris41  836: 
                    837: # display domain
1.45      ng        838:     if ($filecom[1] eq 'domain') {
1.88      www       839:  	$r->print ('<input type="hidden" name="dirPointer" value="on">'."\n")
                    840:  	    if ($ENV{'form.dirPointer'} eq "on");
1.70      ng        841: 	$r->print("<tr valign='$valign' bgcolor=$fileclr>$extrafield");
                    842: 	$r->print("<td>");
1.73      albertel  843: 	&begin_form ($r,$filecom[0]);
                    844: 	my $anchor = $filecom[0];
1.3       harris41  845: 	$anchor =~ s/\///g;
1.13      ng        846: 	$r->print ('<a name="'.$anchor.'">');
1.16      harris41  847: 	$r->print ('<input type="hidden" name="acts" value="">');
1.17      harris41  848: 	$r->print ('<input src="'.$iconpath.'folder_pointer_'.
                    849: 		   $diropen.'.gif"'); 
                    850: 	$r->print (' name="'.$msg.'" height="22" type="image" border="0">'.
                    851: 		   "\n");
1.128   ! foxr      852: 	my $quotable_filecom = &Apache::loncommon::escape_single($filecom[0]);
1.125     foxr      853: 	$r->print ('<a href="javascript:gothere(\''.$quotable_filecom.
1.73      albertel  854: 		   '\')"><img src="'.$iconpath.'server.gif"');
1.17      harris41  855: 	$r->print (' border="0" /></a>'."\n");
1.77      www       856: 	$r->print (&mt("Domain")." - $listname ");
1.60      albertel  857: 	if ($Apache::lonnet::domaindescription{$listname}) {
                    858: 	    $r->print("(".$Apache::lonnet::domaindescription{$listname}.
                    859: 		      ")");
                    860: 	}
                    861: 	$r->print (" $tabtag</tr></form>\n");
1.1       www       862: 	return OK;
1.17      harris41  863: 
                    864: # display user directory
1.1       www       865:     }
1.45      ng        866:     if ($filecom[1] eq 'user') {
1.70      ng        867: 	$r->print("<tr valign=$valign bgcolor=$fileclr>$extrafield");
                    868: 	$r->print("<td nowrap>\n");
1.2       harris41  869: 	my $curdir = $startdir.$filecom[0].'/';
1.3       harris41  870: 	my $anchor = $curdir;
                    871: 	$anchor =~ s/\///g;
1.13      ng        872: 	&begin_form ($r,$curdir);
1.17      harris41  873: 	$r->print ('<a name="'.$anchor.'"><img src="'.$iconpath.
                    874: 		   'whitespace1.gif" border="0" />'."\n");
1.16      harris41  875: 	$r->print ('<input type="hidden" name="acts" value="">');
1.17      harris41  876: 	$r->print ('<input src="'.$iconpath.'folder_pointer_'.$diropen.
                    877: 		   '.gif"'); 
                    878: 	$r->print (' name="'.$msg.'" height="22" type="image" border="0">'.
                    879: 		   "\n");
1.128   ! foxr      880: 	my $quotable_curdir = &Apache::loncommon::escape_single($curdir);
1.125     foxr      881: 	$r->print ('<a href="javascript:gothere(\''.$quotable_curdir
                    882: 		   .'\')"><img src='.
1.17      harris41  883: 		   $iconpath.'quill.gif border="0" name="'.$msg.
                    884: 		   '" height="22" /></a>');
1.60      albertel  885: 	my $domain=(split(m|/|,$startdir))[2];
                    886: 	my $plainname=&Apache::loncommon::plainname($listname,$domain);
                    887: 	$r->print ($listname);
                    888: 	if (defined($plainname) && $plainname) { $r->print(" ($plainname) "); }
                    889: 	$r->print ($tabtag.'</tr></form>'."\n");
1.1       www       890: 	return OK;
                    891:     }
1.17      harris41  892: 
1.1       www       893: # display file
1.97      www       894:     if (($fnptr == 0 and $filecom[3] ne '') or $absolute) {
                    895: 	my $filelink = $pathprefix.$filecom[0];
1.1       www       896: 	my @file_ext = split (/\./,$listname);
1.25      matthew   897: 	my $curfext = $file_ext[-1];
1.40      matthew   898:         if (@Omit) {
                    899:             foreach (@Omit) { return OK if ($curfext eq $_); }
                    900:         }
                    901:         if (@Only) {
                    902:             my $skip = 1;
                    903:             foreach (@Only) { $skip = 0 if ($curfext eq $_); }
                    904:             return OK if ($skip > 0);
                    905:         }
1.25      matthew   906: 	# Set the icon for the file
1.84      albertel  907: 	my $iconname = &Apache::loncommon::icon($listname);
1.114     www       908: 	$r->print("<tr valign='$valign' bgcolor=$fileclr><td nowrap='1' align='top'>");
1.104     albertel  909: 	
1.7       harris41  910:         if ($ENV{'form.catalogmode'} eq 'interactive') {
1.128   ! foxr      911: 	    my $quotable_filelink = &Apache::loncommon::escape_single($filelink);
1.35      matthew   912:             $r->print("<a href=\"javascript:select_data(\'",
1.125     foxr      913:                       $quotable_filelink,"')\">");
1.17      harris41  914: 	    $r->print("<img src='",$iconpath,"select.gif' border='0' /></a>".
                    915: 		      "\n");
1.70      ng        916: 	    $r->print("</td><td nowrap>");
1.95      www       917: 	} elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
1.8       harris41  918: 	    $r->print("<form name='form$fnum'>\n");
                    919: 	    $r->print("<input type='checkbox' name='filelink"."' ".
1.16      harris41  920: 		      "value='$filelink' onClick='".
                    921: 		      "javascript:queue(\"form$fnum\")' ");
                    922: 	    if ($hash{'store_'.$filelink}) {
                    923: 		$r->print("checked");
                    924: 	    }
                    925: 	    $r->print(">\n");
1.8       harris41  926: 	    $r->print("</form>\n");
1.70      ng        927: 	    $r->print("</td><td nowrap>");
1.16      harris41  928: 	    $hash{"pre_${fnum}_link"}=$filelink;
1.8       harris41  929:   	    $fnum++;
1.7       harris41  930: 	}
1.95      www       931: # Form to open or close sequences
                    932: 	if ($filelink=~/\.(page|sequence)$/) {
                    933: 	    my $curdir = $startdir.$filecom[0].'/';
                    934: 	    my $anchor = $curdir;
                    935: 	    $anchor =~ s/\///g;
                    936: 	    &begin_form($r,$curdir);
                    937: 	    $indent--;
                    938: 	}
                    939: # General indentation
1.12      ng        940: 	if ($indent > 0 and $indent < 11) {
1.17      harris41  941: 	    $r->print("<img src=",$iconpath,"whitespace",$indent,
                    942: 		      ".gif border='0' />\n");
1.11      ng        943: 	} elsif ($indent >0) {
1.4       harris41  944: 	    my $ten = int($indent/10.);
                    945: 	    my $rem = $indent%10.0;
                    946: 	    my $count = 0;
                    947: 	    while ($count < $ten) {
1.17      harris41  948: 		$r->print("<img src=",$iconpath,
                    949: 			  "whitespace10.gif border='0' />\n");
1.1       www       950: 	    $count++;
1.4       harris41  951: 	    }
1.17      harris41  952: 	    $r->print("<img src=",$iconpath,"whitespace",$rem,
                    953: 		      ".gif border='0' />\n") if $rem > 0;
1.1       www       954: 	}
1.95      www       955: # Sequence open/close icon
                    956: 	if ($filelink=~/\.(page|sequence)$/) {
                    957: 	    my $curdir = $startdir.$filecom[0].'/';
                    958: 	    my $anchor = $curdir;
                    959: 	    $anchor =~ s/\///g;
                    960: 	    $r->print ('<input type="hidden" name="acts" value="">');
                    961: 	    $r->print ('<a name="'.$anchor.'"><input src="'.$iconpath.
                    962: 		       'folder_pointer_'.$diropen.'.gif"');
                    963: 	    $r->print (' name="'.$msg.'" height="22" type="image" border="0">'.
                    964: 		       "\n");
                    965: 	}
                    966: # Filetype icons
1.84      albertel  967: 	$r->print("<img src='$iconname' border='0' />\n");
1.95      www       968: # Close form to open/close sequence
                    969: 	if ($filelink=~/\.(page|sequence)$/) {
                    970: 	    $r->print('</form>');
                    971: 	}
1.128   ! foxr      972: 	my $quotable_filelink = &Apache::loncommon::escape_single($filelink);
1.125     foxr      973: 
                    974: 
                    975: 	$r->print (" <a href=\"javascript:openWindow('".$quotable_filelink.
1.69      www       976: 		   "', 'previewfile', '450', '500', 'no', 'yes','yes')\";".
1.17      harris41  977: 		   " TARGET=_self>$listname</a> ");
                    978: 
1.125     foxr      979: 	$r->print (" (<a href=\"javascript:openWindow('".$quotable_filelink.
1.71      ng        980: 		   ".meta', 'metadatafile', '500', '550', 'no', 'yes','no')\"; ".
1.104     albertel  981: 		   "TARGET=_self>metadata</a>) ");
1.7       harris41  982: 	$r->print("</td>\n");
1.45      ng        983: 	if ($hash{'display_attrs_0'} == 1) {
1.104     albertel  984: 	    my $title = &Apache::lonnet::gettitle($filelink,'title');
1.70      ng        985: 	    $r->print('<td> '.($title eq '' ? '&nbsp;' : $title).
1.45      ng        986: 		      ' </td>'."\n");
                    987: 	}
1.70      ng        988: 	$r->print('<td align=right> ',
1.17      harris41  989: 		  $filecom[8]," </td>\n") 
1.45      ng        990: 	    if $hash{'display_attrs_1'} == 1;
1.70      ng        991: 	$r->print('<td> '.
1.17      harris41  992: 		  (localtime($filecom[9]))." </td>\n") 
1.45      ng        993: 	    if $hash{'display_attrs_2'} == 1;
1.70      ng        994: 	$r->print('<td> '.
1.17      harris41  995: 		  (localtime($filecom[10]))." </td>\n") 
1.45      ng        996: 	    if $hash{'display_attrs_3'} == 1;
1.2       harris41  997: 
1.45      ng        998: 	if ($hash{'display_attrs_4'} == 1) {
1.104     albertel  999: 	    my $author = &Apache::lonnet::metadata($filelink,'author');
1.70      ng       1000: 	    $r->print('<td> '.($author eq '' ? '&nbsp;' : $author).
1.17      harris41 1001: 		      " </td>\n");
1.2       harris41 1002: 	}
1.45      ng       1003: 	if ($hash{'display_attrs_5'} == 1) {
1.104     albertel 1004: 	    my $keywords = &Apache::lonnet::metadata($filelink,'keywords');
1.45      ng       1005: 	    # $keywords = '&nbsp;' if (!$keywords);
1.70      ng       1006: 	    $r->print('<td> '.($keywords eq '' ? '&nbsp;' : $keywords).
1.17      harris41 1007: 		      " </td>\n");
1.2       harris41 1008: 	}
1.109     taceyjo1 1009: #'
                   1010: 
1.45      ng       1011: 	if ($hash{'display_attrs_6'} == 1) {
1.104     albertel 1012: 	    my $lang = &Apache::lonnet::metadata($filelink,'language');
1.28      harris41 1013: 	    $lang = &Apache::loncommon::languagedescription($lang);
1.70      ng       1014: 	    $r->print('<td> '.($lang eq '' ? '&nbsp;' : $lang).
1.17      harris41 1015: 		      " </td>\n");
1.2       harris41 1016: 	}
1.70      ng       1017: 	if ($hash{'display_attrs_8'} == 1) {
1.111     www      1018: # statistics
1.117     www      1019: 	    &dynmetaread($filelink);
1.112     www      1020: 	    $r->print("<td>");
1.114     www      1021: 	    &dynmetaprint($r,$filelink,'count');
                   1022: 	    &dynmetaprint($r,$filelink,'course');
                   1023: 	    &dynmetaprint($r,$filelink,'stdno');
                   1024: 	    &dynmetaprint($r,$filelink,'avetries');
                   1025: 	    &dynmetaprint($r,$filelink,'difficulty');
                   1026: 	    &dynmetaprint($r,$filelink,'disc');
                   1027: 	    &dynmetaprint($r,$filelink,'clear');
                   1028: 	    &dynmetaprint($r,$filelink,'technical');
                   1029: 	    &dynmetaprint($r,$filelink,'correct');
                   1030: 	    &dynmetaprint($r,$filelink,'helpful');
                   1031: 	    &dynmetaprint($r,$filelink,'depth');
1.112     www      1032: 	    $r->print("&nbsp;</td>\n");
1.111     www      1033: 
1.70      ng       1034: 	}
1.109     taceyjo1 1035: 	if ($hash{'display_attrs_10'} == 1) {
                   1036: 	    my $source = &Apache::lonnet::metadata($filelink,'sourceavail');
1.110     albertel 1037: 	    if($source eq 'open') {
1.119     taceyjo1 1038: 		my $sourcelink = &Apache::lonsource::make_link($filelink,$listname);
1.128   ! foxr     1039: 		my $quotable_sourcelink = &Apache::loncommon::escape_single($sourcelink);
1.125     foxr     1040: 		$r->print('<td>'."<a href=\"javascript:openWindow('"
                   1041: 			  .$quotable_sourcelink.
1.110     albertel 1042: 			  "', 'previewsource', '700', '700', 'no', 'yes','yes')\";".
                   1043: 			  " TARGET=_self>Yes</a> "."</td>\n");
                   1044: 	    } else { #A cuddled else. :P
1.111     www      1045: 		$r->print("<td>&nbsp;</td>\n");
1.110     albertel 1046: 	    }
1.109     taceyjo1 1047: 	}
1.111     www      1048: 	if ($hash{'display_attrs_11'} == 1) {
                   1049: # links
1.117     www      1050: 	   &dynmetaread($filelink);
1.113     www      1051: 	   $r->print('<td>');
                   1052: 	   &dynmetaprint($r,$filelink,'goto_list');
                   1053: 	   &dynmetaprint($r,$filelink,'comefrom_list');
                   1054: 	   &dynmetaprint($r,$filelink,'sequsage_list');
1.114     www      1055: 	   &dynmetaprint($r,$filelink,'dependencies');
1.113     www      1056: 	   $r->print('</td>');
1.114     www      1057:         }
1.115     www      1058:         if ($hash{'display_attrs_7'} == 1) {
                   1059: # Show resource
                   1060:             my $output='';
                   1061:             my $embstyle=&Apache::loncommon::fileembstyle($curfext);
                   1062: 	    if ($embstyle eq 'ssi') {
                   1063: 		my $cache=$Apache::lonnet::perlvar{'lonDocRoot'}.$filelink.
                   1064: 		    '.tmp';
                   1065: 		if ((!$ENV{'form.updatedisplay'}) &&
                   1066: 		    (-e $cache)) {
                   1067: 		    open(FH,$cache);
                   1068: 		    $output=join("\n",<FH>);
                   1069: 		    close(FH);
                   1070: 		} else {
                   1071: 		    $output=&Apache::lonnet::ssi_body($filelink);
                   1072: 		    open(FH,">$cache");
                   1073: 		    print FH $output;
                   1074: 		    close(FH);
                   1075: 		}
                   1076: 		$output='<font size="-2">'.$output.'</font>';
                   1077: 	   } elsif ($embstyle eq 'img') {
                   1078:                $output='<img src="'.$filelink.'" />';
                   1079:            } elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) {
                   1080:                $output='<img src="http://'.
                   1081: 		 $Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}.
                   1082:                  '/cgi-bin/thumbnail.gif?url='.$filelink.'" />';
                   1083:            }
                   1084: 	   $r->print('<td> '.($output eq '' ? '&nbsp;':$output).
                   1085: 		      " </td>\n");
                   1086:         }
1.1       www      1087: 	$r->print("</tr>\n");
                   1088:     }
1.17      harris41 1089: 
1.2       harris41 1090: # -- display directory
1.1       www      1091:     if ($fnptr == $dirptr) {
1.2       harris41 1092: 	my $curdir = $startdir.$filecom[0].'/';
1.3       harris41 1093: 	my $anchor = $curdir;
                   1094: 	$anchor =~ s/\///g;
1.63      ng       1095: 	$r->print("<tr bgcolor=$fileclr>$extrafield<td valign=$valign>");
1.2       harris41 1096: 	&begin_form ($r,$curdir);
1.4       harris41 1097: 	my $indentm1 = $indent-1;
1.11      ng       1098: 	if ($indentm1 < 11 and $indentm1 > 0) {
1.17      harris41 1099: 	    $r->print("<img src=",$iconpath,"whitespace",$indentm1,
                   1100: 		      ".gif border='0' />\n");
1.4       harris41 1101: 	} else {
                   1102: 	    my $ten = int($indentm1/10.);
                   1103: 	    my $rem = $indentm1%10.0;
                   1104: 	    my $count = 0;
                   1105: 	    while ($count < $ten) {
1.17      harris41 1106: 		$r->print ("<img src=",$iconpath
                   1107: 			   ,"whitespace10.gif border='0' />\n");
1.12      ng       1108: 		$count++;
1.4       harris41 1109: 	    }
1.17      harris41 1110: 	    $r->print ("<img src=",$iconpath,"whitespace",$rem,
                   1111: 		       ".gif border='0' />\n") if $rem > 0;
1.1       www      1112: 	}
1.16      harris41 1113: 	$r->print ('<input type="hidden" name="acts" value="">');
1.17      harris41 1114: 	$r->print ('<a name="'.$anchor.'"><input src="'.$iconpath.
                   1115: 		   'folder_pointer_'.$diropen.'.gif"');
                   1116: 	$r->print (' name="'.$msg.'" height="22" type="image" border="0">'.
                   1117: 		   "\n");
1.128   ! foxr     1118: 	my $quotable_curdir = &Apache::loncommon::escape_single($curdir);
1.125     foxr     1119: 	$r->print ('<a href="javascript:gothere(\''
                   1120: 		   .$quotable_curdir.'\')"><img src="'.
1.17      harris41 1121: 		   $iconpath.'folder_'.$diropen.'.gif" border="0" /></a>'.
                   1122: 		   "\n");
1.86      www      1123: 	$r->print ("$listname</td>\n");
                   1124: # Attributes
                   1125: 	my $filelink = $startdir.$filecom[0].'/default';
                   1126: 
                   1127: 	if ($hash{'display_attrs_0'} == 1) {
                   1128: 	    my $title = &Apache::lonnet::gettitle($filelink,'title');
                   1129: 	    $r->print('<td> '.($title eq '' ? '&nbsp;' : $title).
                   1130: 		      ' </td>'."\n");
                   1131: 	}
                   1132: 	$r->print('<td align=right> ',
                   1133: 		  $filecom[8]," </td>\n") 
                   1134: 	    if $hash{'display_attrs_1'} == 1;
                   1135: 	$r->print('<td> '.
                   1136: 		  (localtime($filecom[9]))." </td>\n") 
                   1137: 	    if $hash{'display_attrs_2'} == 1;
                   1138: 	$r->print('<td> '.
                   1139: 		  (localtime($filecom[10]))." </td>\n") 
                   1140: 	    if $hash{'display_attrs_3'} == 1;
                   1141: 
                   1142: 	if ($hash{'display_attrs_4'} == 1) {
                   1143: 	    my $author = &Apache::lonnet::metadata($filelink,'author');
                   1144: 	    $r->print('<td> '.($author eq '' ? '&nbsp;' : $author).
                   1145: 		      " </td>\n");
                   1146: 	}
                   1147: 	if ($hash{'display_attrs_5'} == 1) {
                   1148: 	    my $keywords = &Apache::lonnet::metadata($filelink,'keywords');
                   1149: 	    # $keywords = '&nbsp;' if (!$keywords);
                   1150: 	    $r->print('<td> '.($keywords eq '' ? '&nbsp;' : $keywords).
                   1151: 		      " </td>\n");
                   1152: 	}
                   1153: 	if ($hash{'display_attrs_6'} == 1) {
                   1154: 	    my $lang = &Apache::lonnet::metadata($filelink,'language');
                   1155: 	    $lang = &Apache::loncommon::languagedescription($lang);
                   1156: 	    $r->print('<td> '.($lang eq '' ? '&nbsp;' : $lang).
                   1157: 		      " </td>\n");
                   1158: 	}
                   1159: 	if ($hash{'display_attrs_8'} == 1) {
                   1160: 	   $r->print('<td>&nbsp;</td>');
                   1161: 	}
1.115     www      1162:  	if ($hash{'display_attrs_10'} == 1) {
1.109     taceyjo1 1163: 	   $r->print('<td>&nbsp;</td>');
                   1164: 	}
1.111     www      1165: 	if ($hash{'display_attrs_11'} == 1) {
                   1166: 	   $r->print('<td>&nbsp;</td>');
                   1167: 	}
1.115     www      1168: 	if ($hash{'display_attrs_7'} == 1) {
                   1169: 	   $r->print('<td>&nbsp;</td>');
                   1170:         }
1.86      www      1171: 	$r->print('</form></tr>');
1.1       www      1172:     }
1.2       harris41 1173: 
1.1       www      1174: }
                   1175: 
1.113     www      1176: sub dynmetaprint {
                   1177:     my ($r,$filelink,$item)=@_;
                   1178:     if ($dynhash{$filelink}->{$item}) {
1.114     www      1179: 	$r->print("\n<br />".$fieldnames{$item}.': '.
1.113     www      1180: 		  &Apache::lonmeta::prettyprint($item,
                   1181: 						$dynhash{$filelink}->{$item},
                   1182: 		  (($ENV{'form.catalogmode'} ne 'groupimport')?'preview':''),
                   1183: 		  '',
                   1184: 		  (($ENV{'form.catalogmode'} eq 'groupimport')?'document.forms.fileattr':''),1));
                   1185:     }
                   1186: }
                   1187: 
1.14      harris41 1188: # ------------------- prints the beginning of a form for directory or file link
1.1       www      1189: sub begin_form {
                   1190:     my ($r,$uri) = @_;
1.3       harris41 1191:     my $anchor = $uri;
                   1192:     $anchor =~ s/\///g;
1.17      harris41 1193:     $r->print ('<form method="post" name="dirpath'.$dnum.'" action="'.$uri.
                   1194: 	       '#'.$anchor.
                   1195: 	       '" onSubmit="return rep_dirpath(\''.$dnum.'\''.
                   1196: 	       ',document.forms.fileattr.acts.value)" '.
1.16      harris41 1197: 	       'enctype="application/x-www-form-urlencoded">'."\n");
1.17      harris41 1198:     $r->print ('<input type="hidden" name="openuri" value="'.$uri.'">'.
                   1199: 	       "\n");
1.88      www      1200:     $r->print ('<input type="hidden" name="dirPointer" value="on">'."\n");
1.16      harris41 1201:     $dnum++;
1.17      harris41 1202: }
                   1203: 
                   1204: # --------- settings whenever the user causes the indexer window to be launched
                   1205: sub start_fresh_session {
1.48      matthew  1206:     delete $hash{'form.catalogmode'};
                   1207:     delete $hash{'form.mode'};
                   1208:     delete $hash{'form.form'};
                   1209:     delete $hash{'form.element'};
                   1210:     delete $hash{'form.omit'};
                   1211:     delete $hash{'form.only'};
1.27      harris41 1212:     foreach (keys %hash) {
1.48      matthew  1213:         delete $hash{$_} if (/^(pre_|store)/);
1.27      harris41 1214:     }
1.1       www      1215: }
                   1216: 
1.35      matthew  1217: # ------------------------------------------------------------------- setvalues
                   1218: sub setvalues {
                   1219:     # setvalues is used in registerurl to synchronize the database
                   1220:     # hash and environment hashes
                   1221:     my ($H1,$h1key,$H2,$h2key) =@_;
                   1222:     #
                   1223:     if (exists $H2->{$h2key}) {
                   1224: 	$H1->{$h1key} = $H2->{$h2key};
                   1225:     } elsif (exists $H1->{$h1key}) {
                   1226: 	$H2->{$h2key} = $H1->{$h1key};
                   1227:     } 
                   1228: }
                   1229: 
1.1       www      1230: 1;
1.54      www      1231: 
                   1232: sub cleanup {
1.55      www      1233:     if (tied(%hash)){
                   1234: 	&Apache::lonnet::logthis('Cleanup indexer: hash');
                   1235:     }
1.54      www      1236: }
1.23      harris41 1237: 
1.126     foxr     1238: 
                   1239: 
                   1240: 
                   1241: 
1.23      harris41 1242: =head1 NAME
                   1243: 
                   1244: Apache::lonindexer - mod_perl module for cross server filesystem browsing
                   1245: 
                   1246: =head1 SYNOPSIS
                   1247: 
                   1248: Invoked by /etc/httpd/conf/srm.conf:
                   1249: 
                   1250:  <LocationMatch "^/res.*/$">
                   1251:  SetHandler perl-script
                   1252:  PerlHandler Apache::lonindexer
                   1253:  </LocationMatch>
                   1254: 
                   1255: =head1 INTRODUCTION
                   1256: 
                   1257: This module enables a scheme of browsing across a cross server.
                   1258: 
                   1259: This is part of the LearningOnline Network with CAPA project
                   1260: described at http://www.lon-capa.org.
                   1261: 
                   1262: =head1 BEGIN SUBROUTINE
                   1263: 
                   1264: This routine is only run once after compilation.
                   1265: 
                   1266: =over 4
                   1267: 
                   1268: =item *
                   1269: 
                   1270: Initializes %language hash table.
                   1271: 
                   1272: =back
                   1273: 
                   1274: =head1 HANDLER SUBROUTINE
                   1275: 
                   1276: This routine is called by Apache and mod_perl.
                   1277: 
                   1278: =over 4
                   1279: 
                   1280: =item *
                   1281: 
                   1282: read in machine configuration variables
                   1283: 
                   1284: =item *
                   1285: 
                   1286: see if called from an interactive mode
                   1287: 
                   1288: =item *
                   1289: 
                   1290: refresh environment with user database values (in %hash)
                   1291: 
                   1292: =item *
                   1293: 
                   1294: define extra fields and buttons in case of special mode
                   1295: 
                   1296: =item *
                   1297: 
                   1298: set catalogmodefunctions to have extra needed javascript functionality
                   1299: 
                   1300: =item *
                   1301: 
                   1302: print header
                   1303: 
                   1304: =item *
                   1305: 
                   1306: evaluate actions from previous page (both cumulatively and chronologically)
                   1307: 
                   1308: =item *
                   1309: 
                   1310: output title
                   1311: 
                   1312: =item *
                   1313: 
                   1314: get state of file attributes to be showing
                   1315: 
                   1316: =item *
                   1317: 
                   1318: output state of file attributes to be showing
                   1319: 
                   1320: =item *
                   1321: 
                   1322: output starting row to the indexed file/directory hierarchy
                   1323: 
                   1324: =item *
                   1325: 
                   1326: read in what directories have previously been set to "open"
                   1327: 
                   1328: =item *
                   1329: 
                   1330: if not at top level, provide an uplink arrow
                   1331: 
                   1332: =item *
                   1333: 
                   1334: recursively go through all the directories and output as appropriate
                   1335: 
                   1336: =item *
                   1337: 
                   1338: information useful for group import
                   1339: 
                   1340: =item *
                   1341: 
                   1342: end the tables
                   1343: 
                   1344: =item *
                   1345: 
                   1346: end the output and return
                   1347: 
                   1348: =back
                   1349: 
                   1350: =head1 OTHER SUBROUTINES
                   1351: 
                   1352: =over 4
                   1353: 
                   1354: =item *
                   1355: 
                   1356: scanDir - recursive scan of a directory
                   1357: 
                   1358: =item *
                   1359: 
                   1360: get_list - get complete matched list based on the uri (returns an array)
                   1361: 
                   1362: =item *
                   1363: 
                   1364: match_ext - filters out files based on extensions (returns an array)
                   1365: 
                   1366: =item *
                   1367: 
                   1368: display_line - displays one line in appropriate table format
                   1369: 
                   1370: =item *
                   1371: 
                   1372: begin_form - prints the beginning of a form for directory or file link
                   1373: 
                   1374: =item *
                   1375: 
                   1376: start_fresh_session - settings whenever the user causes the indexer window
                   1377: to be launched
                   1378: 
                   1379: =back
                   1380: 
                   1381: =cut

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