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

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

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