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

1.1       www         1: # The LearningOnline Network with CAPA
1.24      harris41    2: # Directory Indexer
                      3: #
1.39    ! matthew     4: # $Id: lonindexer.pm,v 1.38 2002/03/14 21:37:04 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.17      harris41   28: # YEAR=1999
                     29: # 5/21/99, 5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer)
1.1       www        30: # 11/23 Gerd Kortemeyer
1.17      harris41   31: # YEAR=2000
1.1       www        32: # 07/20-08/04 H.K. Ng
1.17      harris41   33: # YEAR=2001
1.2       harris41   34: # 05/9-05/19/2001 H. K. Ng
1.4       harris41   35: # 05/21/2001 H. K. Ng
1.6       harris41   36: # 05/23/2001 H. K. Ng
1.17      harris41   37: # 5/31,6/1,6/2,6/15 Scott Harrison
                     38: # 6/26,7/8 H. K. Ng
                     39: # 8/6,8/7,8/10 Scott Harrison
1.18      ng         40: # 8/14 H. K. Ng
1.24      harris41   41: # 8/28,10/15,11/28,11/29 Scott Harrison
1.25      matthew    42: # 11/30 Matthew Hall
1.28      harris41   43: # 12/11,12/13 Scott Harrison
1.32      harris41   44: # YEAR=2002
                     45: # 1/17 Scott Harrison
1.23      harris41   46: #
                     47: ###
                     48: 
                     49: ###############################################################################
                     50: ##                                                                           ##
                     51: ## ORGANIZATION OF THIS PERL MODULE                                          ##
                     52: ##                                                                           ##
                     53: ## 1. Description of functions                                               ##
                     54: ## 2. Modules used by this module                                            ##
                     55: ## 3. Choices for different output views (detailed, summary, xml, etc)       ##
                     56: ## 4. BEGIN block (to be run once after compilation)                         ##
                     57: ## 5. Handling routine called via Apache and mod_perl                        ##
                     58: ## 6. Other subroutines                                                      ##
                     59: ##                                                                           ##
                     60: ###############################################################################
1.7       harris41   61: 
1.1       www        62: package Apache::lonindexer;
                     63: 
1.23      harris41   64: # ------------------------------------------------- modules used by this module
1.1       www        65: use strict;
                     66: use Apache::lonnet();
1.30      harris41   67: use Apache::loncommon();
1.1       www        68: use Apache::Constants qw(:common);
1.2       harris41   69: use Apache::File;
                     70: use GDBM_File;
                     71: 
1.23      harris41   72: # ---------------------------------------- variables used throughout the module
1.17      harris41   73: my %hash; # tied to a user-specific gdbm file
                     74: my %dirs; # keys are directories, values are the open/close status
                     75: my %language; # has the reference information present in language.tab
                     76: 
                     77: # ----- Values which are set by the handler subroutine and are accessible to
                     78: # -----     other methods.
                     79: my $extrafield; # default extra table cell
                     80: my $fnum; # file counter
                     81: my $dnum; # directory counter
1.1       www        82: 
1.23      harris41   83: # ----------------------------- Handling routine called via Apache and mod_perl
1.1       www        84: sub handler {
                     85:     my $r = shift;
                     86:     $r->content_type('text/html');
                     87:     $r->send_http_header;
                     88:     return OK if $r->header_only;
1.9       harris41   89:     $fnum=0;
1.16      harris41   90:     $dnum=0;
1.22      harris41   91:     untie %hash;
1.17      harris41   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'},
                    111: 	     ['catalogmode','launch','acts','mode','form','element']);
1.35      matthew   112:     #-------------------------------------------------------------------
1.17      harris41  113:     my $closebutton='';
1.7       harris41  114:     my $groupimportbutton='';
                    115:     my $colspan=''; 
1.14      harris41  116: 
                    117:     $extrafield='';
1.17      harris41  118:     my $diropendb = 
                    119: 	"/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db";
1.15      harris41  120: 
                    121:     if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) {
                    122: 	if ($ENV{'form.launch'} eq '1') {
1.17      harris41  123: 	    &start_fresh_session();
1.15      harris41  124: 	}
1.17      harris41  125: 
                    126: # -------------------- refresh environment with user database values (in %hash)
1.15      harris41  127: 	if ($hash{'mode_catalog'} eq 'interactive') {
                    128: 	    $ENV{'form.catalogmode'}='interactive';
                    129: 	}
                    130: 	if ($hash{'mode_catalog'} eq 'groupimport') {
                    131: 	    $ENV{'form.catalogmode'}='groupimport';
                    132: 	}
                    133: 
1.17      harris41  134: # --------------------- define extra fields and buttons in case of special mode
1.15      harris41  135: 	if ($ENV{'form.catalogmode'} eq 'interactive') {
                    136: 	    $hash{'mode_catalog'}='interactive';
                    137: 	    $extrafield='<td bgcolor="'.$fileclr.'" valign="bottom">'.
                    138: 		'<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'.
1.17      harris41  139: 		' border="0" /></td>';
1.15      harris41  140: 	    $colspan=" colspan='2' ";
                    141:             $closebutton=<<END;
1.7       harris41  142: <input type="button" name="close" value='CLOSE' onClick="self.close()">
                    143: END
1.16      harris41  144:         }
1.15      harris41  145: 	elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
                    146: 	    $hash{'mode_catalog'}='groupimport';
                    147: 	    $extrafield='<td bgcolor="'.$fileclr.'" valign="bottom">'.
                    148: 		'<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'.
1.17      harris41  149: 		' border="0" /></td>';
1.15      harris41  150: 	    $colspan=" colspan='2' ";
                    151:             $closebutton=<<END;
1.7       harris41  152: <input type="button" name="close" value='CLOSE' onClick="self.close()">
                    153: END
1.15      harris41  154:             $groupimportbutton=<<END;
1.17      harris41  155: <input type="button" name="groupimport" value='GROUP IMPORT'
                    156: onClick="javascript:select_group()">
1.7       harris41  157: END
1.15      harris41  158:         }
1.35      matthew   159: 	# Additions made by Matthew to make the browser a little easier to deal
                    160: 	# with in the future.
                    161: 	#
                    162: 	# $mode (at this time) indicates if we are in edit mode.
                    163: 	# $form is the name of the form that the URL is placed when the
                    164: 	#       selection is made.
                    165: 	# $element is the name of the element in $formname which receives
                    166: 	#       the URL.
1.37      matthew   167: 	# &Apache::lonxml::debug('Checking mode, form, element');
1.35      matthew   168: 	&setvalues(\%hash,'form_mode'   ,\%ENV,'form.mode'   );
                    169: 	&setvalues(\%hash,'form_form'   ,\%ENV,'form.form'   );
                    170: 	&setvalues(\%hash,'form_element',\%ENV,'form.element');
                    171: 
                    172: 	my $mode = $ENV{'form.mode'};
                    173: 	my ($form,$element);
1.39    ! matthew   174: 	if ($mode eq 'edit' || $mode eq 'parmset') {
1.35      matthew   175: 	    $form    = $ENV{'form.form'};
                    176: 	    $element = $ENV{'form.element'};
                    177: 	}
                    178: 	&Apache::lonxml::debug("mode=$mode form=$form element=$element");
1.17      harris41  179: # ------ set catalogmodefunctions to have extra needed javascript functionality
1.15      harris41  180: 	my $catalogmodefunctions='';
                    181: 	if ($ENV{'form.catalogmode'} eq 'interactive' or
                    182: 	    $ENV{'form.catalogmode'} eq 'groupimport') {
1.35      matthew   183: 	    # The if statement below sets us up to use the old version
                    184: 	    # by default (ie. if $mode is undefined).  This is the easy
                    185: 	    # way out.  Hopefully in the future I'll find a way to get 
                    186: 	    # the calls dealt with in a more comprehensive manner.
1.39    ! matthew   187: 	    if (!defined($mode) || ($mode ne 'edit' && $mode ne 'parmset')) {
1.35      matthew   188: 		$catalogmodefunctions=<<"END";
1.7       harris41  189: function select_data(title,url) {
                    190:     changeTitle(title);
                    191:     changeURL(url);
1.8       harris41  192:     self.close();
                    193: }
                    194: function select_group() {
1.20      harris41  195:     window.location="/adm/groupsort?catalogmode=groupimport&acts="+document.forms.fileattr.acts.value;
1.16      harris41  196: }
1.7       harris41  197: function changeTitle(val) {
1.35      matthew   198:     if (opener.inf) {
                    199:         if (opener.inf.document.forms.resinfo.elements.t) {
                    200:             opener.inf.document.forms.resinfo.elements.t.value=val;
                    201:         }
                    202:     }
                    203: }
                    204: function changeURL(val) {
                    205:     if (opener.inf) {
                    206:         if (opener.inf.document.forms.resinfo.elements.u) {
                    207: 	    opener.inf.document.forms.resinfo.elements.u.value=val;
                    208:         }
1.7       harris41  209:     }
                    210: }
1.35      matthew   211: END
1.39    ! matthew   212:             } elsif ($mode eq 'edit') { # we are in 'edit' mode
1.35      matthew   213: 		$catalogmodefunctions=<<END;
                    214: // mode = $mode
                    215: function select_data(title,url) {
                    216:     changeURL(url);
                    217:     self.close();
                    218: }
                    219: 
                    220: function select_group() {
                    221:     window.location="/adm/groupsort?catalogmode=interactive&form=$form&element=$element&mode=edit&acts="+document.forms.fileattr.acts.value;
                    222: }
                    223: 
1.7       harris41  224: function changeURL(val) {
1.35      matthew   225:     if (window.opener.document) {
                    226: 	window.opener.document.forms["$form"].elements["$element"].value=val;
                    227:     } else {
                    228: 	    alert("The file you selected is: "+val);
1.7       harris41  229:     }
                    230: }
1.35      matthew   231: 
1.7       harris41  232: END
1.39    ! matthew   233:             } elsif ($mode eq 'parmset') {
        !           234: 		$catalogmodefunctions=<<END;
        !           235: // mode = $mode
        !           236: function select_data(title,url) {
        !           237:     changeURL(url);
        !           238:     self.close();
        !           239: }
        !           240: 
        !           241: function select_group() {
        !           242:     window.location="/adm/groupsort?catalogmode=interactive&form=$form&element=$element&mode=parmset&acts="+document.forms.fileattr.acts.value;
        !           243: }
        !           244: 
        !           245: function changeURL(val) {
        !           246:     if (window.opener.document) {
        !           247:         var elementname  = "$element"+"_value";
        !           248:         var checkboxname = "$element"+"_setparmval";
        !           249: 	window.opener.document.forms["$form"].elements[elementname].value=val;
        !           250:         window.opener.document.forms["$form"].elements[checkboxname].checked=true;
        !           251:     } else {
        !           252: 	    alert("The file you selected is: "+val);
        !           253:     }
        !           254: }
        !           255: 
        !           256: END
        !           257:             }
1.15      harris41  258:         }
1.38      matthew   259:         $catalogmodefunctions.=<<END;
                    260: var acts='';
                    261: function rep_dirpath(suffix,val) {
                    262:     eval("document.forms.dirpath"+suffix+".acts.value=val");
                    263: }
                    264: END
1.16      harris41  265: 	if ($ENV{'form.catalogmode'} eq 'groupimport') {
1.38      matthew   266:             $catalogmodefunctions.=<<END;
1.16      harris41  267: function queue(val) {
                    268:     if (eval("document.forms."+val+".filelink.checked")) {
                    269: 	var l=val.length;
                    270: 	var v=val.substring(4,l);
                    271: 	document.forms.fileattr.acts.value+='1a'+v+'b';
                    272:     }
                    273:     else {
                    274: 	var l=val.length;
                    275: 	var v=val.substring(4,l);
                    276: 	document.forms.fileattr.acts.value+='0a'+v+'b';
                    277:     }
                    278: }
                    279: END
                    280: 	}
1.17      harris41  281: 
1.1       www       282: # ---------------------------------------------------------------- Print Header
1.15      harris41  283: 	$r->print(<<ENDHEADER);
1.1       www       284: <html>
                    285: <head>
1.2       harris41  286: <title>The LearningOnline Network With CAPA Directory Browser</title>
1.3       harris41  287: 
1.19      harris41  288: <script type="text/javascript">
1.7       harris41  289: $catalogmodefunctions
1.2       harris41  290: function openWindow(url, wdwName, w, h, toolbar,scrollbar) {
                    291:     var options = "width=" + w + ",height=" + h + ",";
                    292:     options += "resizable=yes,scrollbars="+scrollbar+",status=no,";
                    293:     options += "menubar=no,toolbar="+toolbar+",location=no,directories=no";
                    294:     var newWin = window.open(url, wdwName, options);
                    295:     newWin.focus();
                    296: }
1.16      harris41  297: function gothere(val) {
                    298:     window.location=val+'?acts='+document.forms.fileattr.acts.value;
                    299: }
1.14      harris41  300: </script>
1.3       harris41  301: 
1.1       www       302: </head>
                    303: <body bgcolor="#FFFFFF">
                    304: ENDHEADER
1.17      harris41  305: 
                    306: # - Evaluate actions from previous page (both cumulatively and chronologically)
1.16      harris41  307:         if ($ENV{'form.catalogmode'} eq 'groupimport') {
                    308: 	    my $acts=$ENV{'form.acts'};
                    309: 	    my @Acts=split(/b/,$acts);
                    310: 	    my %ahash;
                    311: 	    my %achash;
                    312: 	    my $ac=0;
1.17      harris41  313: 	    # some initial hashes for working with data
1.27      harris41  314: 	    foreach (@Acts) {
1.16      harris41  315: 		my ($state,$ref)=split(/a/);
                    316: 		$ahash{$ref}=$state;
                    317: 		$achash{$ref}=$ac;
                    318: 		$ac++;
1.27      harris41  319: 	    }
1.17      harris41  320: 	    # sorting through the actions and changing the tied database hash
1.27      harris41  321: 	    foreach (sort {$achash{$a}<=>$achash{$b}} (keys %ahash)) {
1.16      harris41  322: 		my $key=$_;
                    323: 		if ($ahash{$key} eq '1') {
                    324: 		    $hash{'store_'.$hash{'pre_'.$key.'_link'}}=
                    325: 			$hash{'pre_'.$key.'_title'};
                    326: 		    $hash{'storectr_'.$hash{'pre_'.$key.'_link'}}=
                    327: 			$hash{'storectr'}+0;
                    328: 		    $hash{'storectr'}++;
                    329: 		}
                    330: 		if ($ahash{$key} eq '0') {
                    331: 		    if ($hash{'store_'.$hash{'pre_'.$key.'_link'}}) {
                    332: 			delete $hash{'store_'.$hash{'pre_'.$key.'_link'}};
                    333: 		    }
                    334: 		}
1.27      harris41  335: 	    }
1.17      harris41  336: 	    # deleting the previously cached listing
1.27      harris41  337: 	    foreach (keys %hash) {
1.16      harris41  338: 		if ($_ =~ /^pre_/ && $_ =~/link$/) {
                    339: 		    my $key = $_;
                    340: 		    $key =~ s/^pre_//;
                    341: 		    $key =~ s/_[^_]*$//;
                    342: 		    delete $hash{'pre_'.$key.'_title'};
                    343: 		    delete $hash{'pre_'.$key.'_link'};
                    344: 		}
1.27      harris41  345: 	    }
1.16      harris41  346: 	}
                    347: 	
1.23      harris41  348: # ---------------------------------------------------------------- output title
1.17      harris41  349: 	$r->print('<h2><font color="#888888">The LearningOnline With CAPA '.
                    350: 		  'Network Directory Browser</font></h2>'."\n");
1.23      harris41  351: # ---------------------------------- get state of file attributes to be showing
1.6       harris41  352: 	if ($ENV{'form.attrs'} ne "") {
1.18      ng        353: 	    for (my $i=0; $i<=6; $i++) {
1.6       harris41  354: 		delete $hash{'display_attrs_'.$i};
                    355: 		if ($ENV{'form.attr'.$i} == 1) {
                    356: 		    $attrchk[$i] = "checked";
                    357: 		    $hash{'display_attrs_'.$i} = 1;
                    358: 		}
                    359: 	    }
                    360: 	} else {
1.18      ng        361: 	    for (my $i=0; $i<=6; $i++) {
1.6       harris41  362: 		$attrchk[$i] = "checked" if $hash{'display_attrs_'.$i} == 1;
                    363: 	    }
                    364: 	}
1.23      harris41  365: # ------------------------------- output state of file attributes to be showing
1.15      harris41  366: 	$r->print(<<END);
1.17      harris41  367: <b><font color="#666666">Display file attributes</font></b><br />
                    368: <form method="post" name="fileattr" action="$uri"
                    369:  enctype="application/x-www-form-urlencoded">
1.1       www       370: <table border=0><tr>
1.16      harris41  371: <td><input type="checkbox" name="attr0" value="1" $attrchk[0] /> Size</td>
1.18      ng        372: <td><input type="checkbox" name="attr1" value="1" $attrchk[1] /> Last access</td>
                    373: <td><input type="checkbox" name="attr2" value="1" $attrchk[2] /> Last modified</td>
                    374: <td><input type="checkbox" name="attr6" value="1" $attrchk[6] /> All versions</td>
1.1       www       375: </tr><tr>
1.16      harris41  376: <td><input type="checkbox" name="attr3" value="1" $attrchk[3] /> Author</td>
                    377: <td><input type="checkbox" name="attr4" value="1" $attrchk[4] /> Keywords</td>
                    378: <td><input type="checkbox" name="attr5" value="1" $attrchk[5] /> Language</td>
1.18      ng        379: <td>&nbsp;</td>
1.1       www       380: </tr></table>
1.16      harris41  381: <input type="hidden" name="dirPointer" value="on" />
                    382: <input type="hidden" name="acts" value="" />
                    383: <input type="submit" name="attrs" value="Review" />&nbsp;
                    384: <input type="submit" name="attrs" value="Refresh" />
1.7       harris41  385: $closebutton
                    386: $groupimportbutton
1.1       www       387: </form>
                    388: END
                    389: 
1.23      harris41  390: # ----------------- output starting row to the indexed file/directory hierarchy
1.15      harris41  391:         my $titleclr="#ddffff";
                    392:         $r->print("<table border=0><tr><td bgcolor=#eeeeee>\n");
                    393: 	$r->print("<table border=0><tr>\n");
                    394: 	$r->print("<td $colspan bgcolor=$titleclr><b>Name</b></td>\n");
1.17      harris41  395: 	$r->print("<td bgcolor=$titleclr align=right><b>Size (bytes) ".
                    396: 		  "</b></td>\n") if ($hash{'display_attrs_0'} == 1);
                    397: 	$r->print("<td bgcolor=$titleclr><b>Last accessed</b></td>\n") 
                    398: 	    if ($hash{'display_attrs_1'} == 1);
                    399: 	$r->print("<td bgcolor=$titleclr><b>Last modified</b></td>\n")
                    400: 	    if ($hash{'display_attrs_2'} == 1);
                    401: 	$r->print("<td bgcolor=$titleclr><b>Author(s)</b></td>\n")
                    402: 	    if ($hash{'display_attrs_3'} == 1);
                    403: 	$r->print("<td bgcolor=$titleclr><b>Keywords</b></td>\n")
                    404: 	    if ($hash{'display_attrs_4'} == 1);
                    405: 	$r->print("<td bgcolor=$titleclr><b>Language</b></td>\n")
                    406: 	    if ($hash{'display_attrs_5'} == 1);
1.15      harris41  407: 	$r->print("</tr>");
1.5       harris41  408: 
1.23      harris41  409: # ----------------- read in what directories have previously been set to "open"
1.27      harris41  410: 	foreach (keys %hash) {
1.4       harris41  411: 	    if ($_ =~ /^diropen_status_/) {
                    412: 		my $key = $_;
                    413: 		$key =~ s/^diropen_status_//;
                    414: 		$dirs{$key} = $hash{$_};
                    415: 	    }
1.27      harris41  416: 	}
1.4       harris41  417: 
1.2       harris41  418: 	if ($ENV{'form.openuri'}) {  # take care of review and refresh options
                    419: 	    my $uri=$ENV{'form.openuri'};
1.4       harris41  420: 	    if (exists($hash{'diropen_status_'.$uri})) {
                    421: 		my $cursta = $hash{'diropen_status_'.$uri};
1.2       harris41  422: 		$dirs{$uri} = 'open';
1.4       harris41  423: 		$hash{'diropen_status_'.$uri} = 'open';
                    424: 		if ($cursta eq 'open') {
                    425: 		    $dirs{$uri} = 'closed';
                    426: 		    $hash{'diropen_status_'.$uri} = 'closed';
                    427: 		}
1.2       harris41  428: 	    } else {
1.4       harris41  429: 		$hash{'diropen_status_'.$uri} = 'open';
1.2       harris41  430: 		$dirs{$uri} = 'open';
                    431: 	    }
                    432: 	}
1.12      ng        433: 	
                    434: 	my $bredir = $ENV{'form.dirPointer'};
                    435: 	my $toplevel;
1.13      ng        436: 	my $indent = 0;
1.12      ng        437: 	$uri = $uri.'/' if $uri !~ /.*\/$/;
1.17      harris41  438: 
1.13      ng        439: 	if ($bredir ne "on") {
1.12      ng        440: 	    $hash{'top.level'} = $uri;
                    441: 	    $toplevel = $uri;
1.13      ng        442: 
                    443: 	} else {
                    444: 	    $toplevel = $hash{'top.level'};
                    445: 	}
1.17      harris41  446: 
1.23      harris41  447: # -------------------------------- if not at top level, provide an uplink arrow
1.13      ng        448: 	if ($toplevel ne "/res/"){
                    449: 	    my (@uri_com) = split(/\//,$uri);
                    450: 	    pop @uri_com;
                    451: 	    my $upone = join('/',@uri_com);
                    452: 	    my @list = qw (0);
                    453: 	    &display_line ($r,'opened',$upone.'&viewOneUp',0,$upone,@list);
                    454: 	    $indent = 1;
1.12      ng        455: 	}
1.17      harris41  456: 
1.23      harris41  457: # -------- recursively go through all the directories and output as appropriate
1.16      harris41  458: 	&scanDir ($r,$toplevel,$indent,\%hash);
1.12      ng        459: 	
1.23      harris41  460: # ---------------------------- embed hidden information useful for group import
1.8       harris41  461: 	$r->print("<form name='fnum'>");
                    462: 	$r->print("<input type='hidden' name='fnum' value='$fnum'></form>");
1.17      harris41  463: 
1.23      harris41  464: # -------------------------------------------------------------- end the tables
1.2       harris41  465: 	$r->print("</table>");
                    466: 	$r->print("</td></tr></table>");
1.17      harris41  467: 
1.23      harris41  468: # --------------------------------------------------- end the output and return
1.2       harris41  469: 	$r->print("</body></html>\n");
1.4       harris41  470: 	untie(%hash);
1.2       harris41  471:     } else {
1.17      harris41  472: 	$r->print('<html><head></head><body>Unable to tie hash to db '.
                    473: 		  'file</body></html>');
                    474: 	return OK;
1.2       harris41  475:     }
1.1       www       476:     return OK;
                    477: }
1.2       harris41  478: 
1.17      harris41  479: # ----------------------------------------------- recursive scan of a directory
1.2       harris41  480: sub scanDir {
1.16      harris41  481:     my ($r,$startdir,$indent,$hashref)=@_;
1.3       harris41  482:     my ($compuri,$curdir);
                    483:     my $dirptr=16384;
1.1       www       484:     $indent++;
                    485: 
1.2       harris41  486:     my %dupdirs = %dirs;
                    487:     my @list=&get_list($r,$startdir);
                    488:     foreach my $line (@list) {
1.5       harris41  489: 	my ($strip,$dom,$foo,$testdir,$foo)=split(/\&/,$line,5); 
1.4       harris41  490: 	next if $strip =~ /.*\.meta$/;
1.18      ng        491: 	my (@fileparts) = split(/\./,$strip);
                    492: 	if ($hash{'display_attrs_6'} != 1) {
                    493: 	    if (scalar(@fileparts) >= 3) {
                    494: 		my $fext = pop @fileparts;
                    495: 		my $ov = pop @fileparts;
                    496: 		my $fname = join ('.',@fileparts,$fext);
                    497: 		next if (grep /$fname/,@list and $ov =~ /\d+/);
                    498: 	    }
                    499: 	}
                    500: 
1.5       harris41  501: 	if ($dom eq "domain") {
1.17      harris41  502: 	    $compuri = join('',$strip,"/");  # dom list has /res/<domain name>
1.3       harris41  503: 	    $curdir = $compuri;
1.2       harris41  504: 	} else {
1.17      harris41  505: 	    # user, dir & file have name only, i.e., w/o path
                    506: 	    $compuri = join('',$startdir,$strip,"/");
1.3       harris41  507: 	    $curdir = $startdir;
1.2       harris41  508: 	}
1.11      ng        509: 	my $diropen = "closed";
1.5       harris41  510: 	if (($dirptr&$testdir) or ($dom =~ /^(domain|user)$/)) {
1.3       harris41  511: 	    while (my ($key,$val)= each %dupdirs) {
1.5       harris41  512: 		if ($key eq $compuri and $val eq "open") {
1.11      ng        513: 		    $diropen = "opened";
1.5       harris41  514: 		    delete $dupdirs{key},$dirs{$key};
                    515: 		}
1.3       harris41  516: 	    }
1.1       www       517: 	}
1.16      harris41  518: 	&display_line($r,$diropen,$line,$indent,$curdir,$hashref,@list);
1.11      ng        519: 	&scanDir ($r,$compuri,$indent) if $diropen eq "opened";
1.1       www       520:     }
                    521:     $indent--;
                    522: }
                    523: 
1.17      harris41  524: # --------------- get complete matched list based on the uri (returns an array)
1.1       www       525: sub get_list {
                    526:     my ($r,$uri)=@_;
                    527:     my @list;
1.2       harris41  528:     my $luri = $uri;
                    529:     $luri =~ s/\//_/g;
                    530: 
1.6       harris41  531:     if ($ENV{'form.attrs'} eq "Refresh") {
1.27      harris41  532: 	foreach (keys %hash) {
1.4       harris41  533: 	    delete $hash{$_} if ($_ =~ /^dirlist_files_/);
1.27      harris41  534: 	    }
1.2       harris41  535:     }
                    536: 
1.4       harris41  537:     if ($hash{'dirlist_files'.$luri}) {
                    538: 	@list = split(/\n/,$hash{'dirlist_files_'.$luri});
1.1       www       539:     } else {
1.4       harris41  540: 	@list = &Apache::lonnet::dirlist($uri);
                    541: 	$hash{'dirlist_files_'.$luri} = join('\n',@list);
1.1       www       542:     }
                    543:     return @list=&match_ext($r,@list);
                    544: }
                    545: 
1.17      harris41  546: # -------------------- filters out files based on extensions (returns an array)
1.1       www       547: sub match_ext {
                    548:     my ($r,@packlist)=@_;
                    549:     my @trimlist;
                    550:     my $nextline;
                    551:     my @fileext;
                    552:     my $dirptr=16384;
                    553: 
1.2       harris41  554:     foreach my $line (@packlist) {
                    555: 	chomp $line;
                    556: 	$line =~ s/^\/home\/httpd\/html//;
                    557: 	my @unpackline = split (/\&/,$line);
                    558: 	next if ($unpackline[0] eq ".");
                    559: 	next if ($unpackline[0] eq "..");
                    560: 	my @filecom = split (/\./,$unpackline[0]);
                    561: 	my $fext = pop(@filecom);
                    562: 	my $fnptr = $unpackline[3]&$dirptr;
                    563:  	if ($fnptr == 0 and $unpackline[3] ne "") {
1.28      harris41  564: 	    my $embstyle = &Apache::loncommon::fileembstyle($fext);
1.25      matthew   565:             push @trimlist,$line if (defined($embstyle) && 
1.32      harris41  566: 				     ($embstyle ne 'hdn' or $fext eq 'meta'));
1.1       www       567: 	} else {
1.2       harris41  568: 	    push @trimlist,$line;
1.1       www       569: 	}
                    570:     }
1.4       harris41  571:     @trimlist = sort (@trimlist);
1.1       www       572:     return @trimlist;
                    573: }
                    574: 
1.17      harris41  575: # ------------------------------- displays one line in appropriate table format
1.23      harris41  576: sub display_line {
1.16      harris41  577:     my ($r,$diropen,$line,$indent,$startdir,$hashref,@list)=@_;
1.1       www       578:     my (@pathfn, $fndir, $fnptr);
                    579:     my $dirptr=16384;
                    580:     my $fileclr="#ffffe6";
1.10      harris41  581:     my $iconpath= $r->dir_config('lonIconsURL') . "/";
1.1       www       582: 
                    583:     my @filecom = split (/\&/,$line);
                    584:     my @pathcom = split (/\//,$filecom[0]);
                    585:     my $listname = $pathcom[scalar(@pathcom)-1];
                    586:     my $fnptr = $filecom[3]&$dirptr;
1.4       harris41  587:     my $msg = 'View '.$filecom[0].' resources';
1.11      ng        588:     $msg = 'Close '.$filecom[0].' directory' if $diropen eq "opened";
1.1       www       589: 
                    590:     my $tabtag="</td>";
                    591:     my $i=0;
                    592: 
                    593:     while ($i<=5) {
1.17      harris41  594: 	$tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,">&nbsp;</td>")
                    595: 	    if $hash{'display_attrs_'.$i} == 1;
1.1       www       596: 	$i++;
                    597:     }
1.17      harris41  598: 
                    599: # display uplink arrow
1.13      ng        600:     if ($filecom[1] eq "viewOneUp") {
                    601: 	$r->print("<tr>$extrafield");
                    602: 	$r->print("<td bgcolor=$fileclr valign=bottom>\n");
1.16      harris41  603: 	$r->print ('<form method="post" name="dirpathUP" action="'.$startdir.
                    604: 		   '/" '.
1.17      harris41  605: 		   'onSubmit="return rep_dirpath(\'UP\','.
                    606: 		   'document.forms.fileattr.acts.value)" '.
1.16      harris41  607: 		   'enctype="application/x-www-form-urlencoded"'.
                    608:                    '>'."\n");
1.17      harris41  609: 	$r->print ('<input type=hidden name=openuri value="'.
                    610: 		   $startdir.'">'."\n");
1.16      harris41  611: 	$r->print ('<input type="hidden" name="acts" value="">'."\n");
1.13      ng        612: 	$r->print ('<input src="'.$iconpath.'arrow_up.gif"');
1.17      harris41  613: 	$r->print (' name="'.$msg.'" height="22" type="image" border="0">'.
                    614: 		   "\n");
1.13      ng        615: 	$r->print("Up $tabtag</tr></form>\n");
                    616: 	return OK;
                    617:     }
1.17      harris41  618: 
                    619: # display domain
1.1       www       620:     if ($filecom[1] eq "domain") {
1.17      harris41  621: 	$r->print ('<input type="hidden" name="dirPointer" value="on">'."\n")
                    622: 	    if ($ENV{'form.dirPointer'} eq "on");
1.7       harris41  623: 	$r->print("<tr>$extrafield");
1.1       www       624: 	$r->print("<td bgcolor=$fileclr valign=bottom>");
1.2       harris41  625: 	&begin_form ($r,$filecom[0].'/');
1.3       harris41  626: 	my $anchor = $filecom[0].'/';
                    627: 	$anchor =~ s/\///g;
1.13      ng        628: 	$r->print ('<a name="'.$anchor.'">');
1.16      harris41  629: 	$r->print ('<input type="hidden" name="acts" value="">');
1.17      harris41  630: 	$r->print ('<input src="'.$iconpath.'folder_pointer_'.
                    631: 		   $diropen.'.gif"'); 
                    632: 	$r->print (' name="'.$msg.'" height="22" type="image" border="0">'.
                    633: 		   "\n");
                    634: 	$r->print ('<a href="javascript:gothere(\''.$filecom[0].
                    635: 		   '/\')"><img src="'.$iconpath.'server.gif"');
                    636: 	$r->print (' border="0" /></a>'."\n");
1.1       www       637: 	$r->print("Domain - $listname $tabtag</tr></form>\n");
                    638: 	return OK;
1.17      harris41  639: 
                    640: # display user directory
1.1       www       641:     }
                    642:     if ($filecom[1] eq "user") {
1.7       harris41  643: 	$r->print("<tr>$extrafield");
1.13      ng        644: 	$r->print("<td bgcolor=$fileclr valign=bottom nowrap>\n");
1.2       harris41  645: 	my $curdir = $startdir.$filecom[0].'/';
1.3       harris41  646: 	my $anchor = $curdir;
                    647: 	$anchor =~ s/\///g;
1.13      ng        648: 	&begin_form ($r,$curdir);
1.17      harris41  649: 	$r->print ('<a name="'.$anchor.'"><img src="'.$iconpath.
                    650: 		   'whitespace1.gif" border="0" />'."\n");
1.16      harris41  651: 	$r->print ('<input type="hidden" name="acts" value="">');
1.17      harris41  652: 	$r->print ('<input src="'.$iconpath.'folder_pointer_'.$diropen.
                    653: 		   '.gif"'); 
                    654: 	$r->print (' name="'.$msg.'" height="22" type="image" border="0">'.
                    655: 		   "\n");
                    656: 	$r->print ('<a href="javascript:gothere(\''.$curdir.'\')"><img src='.
                    657: 		   $iconpath.'quill.gif border="0" name="'.$msg.
                    658: 		   '" height="22" /></a>');
1.13      ng        659: 	$r->print ($listname.$tabtag.'</tr></form>'."\n");
1.1       www       660: 	return OK;
                    661:     }
1.17      harris41  662: 
1.1       www       663: # display file
                    664:     if ($fnptr == 0 and $filecom[3] ne "") {
                    665: 	my @file_ext = split (/\./,$listname);
1.25      matthew   666: 	my $curfext = $file_ext[-1];
                    667: 	# Set the icon for the file
1.26      matthew   668: 	my $iconname = "unknown.gif";
1.28      harris41  669: 	my $embstyle = &Apache::loncommon::fileembstyle($curfext);
1.25      matthew   670: 	# The unless conditional that follows is a bit of overkill
                    671: 	$iconname = $curfext.".gif" unless
1.26      matthew   672: 	    (!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn');
1.25      matthew   673: 	#
1.2       harris41  674: 	my $filelink = $startdir.$filecom[0];
1.8       harris41  675: 	$r->print("<tr><td nowrap valign='bottom' bgcolor=$fileclr>");
1.7       harris41  676: 	my $metafile = grep /^$filecom[0]\.meta\&/, @list;
                    677: 	my $title;
                    678:         if ($ENV{'form.catalogmode'} eq 'interactive') {
                    679: 	    $title=$listname;
1.8       harris41  680: 	    $title = &Apache::lonnet::metadata($filelink,'title')
                    681: 		if ($metafile == 1);
1.7       harris41  682: 	    $title=$listname unless $title;
1.33      harris41  683: 	    my $titleesc=$title;
1.35      matthew   684: 	    $titleesc=~s/\'/\\'/; #' (clean up this spare quote
                    685:             $r->print("<a href=\"javascript:select_data(\'",
1.34      harris41  686:                       $titleesc,"','",$filelink,"')\">");
1.17      harris41  687: 	    $r->print("<img src='",$iconpath,"select.gif' border='0' /></a>".
                    688: 		      "\n");
1.8       harris41  689: 	    $r->print("</td><td valign='bottom' nowrap bgcolor=$fileclr>");
                    690: 	}
                    691:         elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
                    692: 	    $title=$listname;
                    693: 	    $title = &Apache::lonnet::metadata($filelink,'title')
                    694: 		if ($metafile == 1);
                    695: 	    $title=$listname unless $title;
                    696: 	    $r->print("<form name='form$fnum'>\n");
                    697: 	    $r->print("<input type='checkbox' name='filelink"."' ".
1.16      harris41  698: 		      "value='$filelink' onClick='".
                    699: 		      "javascript:queue(\"form$fnum\")' ");
                    700: 	    if ($hash{'store_'.$filelink}) {
                    701: 		$r->print("checked");
                    702: 	    }
                    703: 	    $r->print(">\n");
1.8       harris41  704: 	    $r->print("<input type='hidden' name='title"."' ".
                    705: 		      "value='$title'>\n");
                    706: 	    $r->print("</form>\n");
                    707: 	    $r->print("</td><td valign='bottom' nowrap bgcolor=$fileclr>");
1.16      harris41  708: 	    $hash{"pre_${fnum}_link"}=$filelink;
                    709: 	    $hash{"pre_${fnum}_title"}=$title;
1.8       harris41  710:   	    $fnum++;
1.7       harris41  711: 	}
1.4       harris41  712: 
1.12      ng        713: 	if ($indent > 0 and $indent < 11) {
1.17      harris41  714: 	    $r->print("<img src=",$iconpath,"whitespace",$indent,
                    715: 		      ".gif border='0' />\n");
1.11      ng        716: 	} elsif ($indent >0) {
1.4       harris41  717: 	    my $ten = int($indent/10.);
                    718: 	    my $rem = $indent%10.0;
                    719: 	    my $count = 0;
                    720: 	    while ($count < $ten) {
1.17      harris41  721: 		$r->print("<img src=",$iconpath,
                    722: 			  "whitespace10.gif border='0' />\n");
1.1       www       723: 	    $count++;
1.4       harris41  724: 	    }
1.17      harris41  725: 	    $r->print("<img src=",$iconpath,"whitespace",$rem,
                    726: 		      ".gif border='0' />\n") if $rem > 0;
1.1       www       727: 	}
1.4       harris41  728: 
1.25      matthew   729: 	$r->print("<img src=$iconpath$iconname border='0' />\n");
1.17      harris41  730: 	$r->print (" <a href=\"javascript:openWindow('".$filelink.
                    731: 		   "', 'metadatafile', '450', '500', 'no', 'yes')\";".
                    732: 		   " TARGET=_self>$listname</a> ");
                    733: 
                    734: 	$r->print (" (<a href=\"javascript:openWindow('".$filelink.
                    735: 		   ".meta', 'metadatafile', '400', '450', 'no', 'yes')\"; ".
                    736: 		   "TARGET=_self>metadata</a>) ") if ($metafile == 1);
1.2       harris41  737: 
1.7       harris41  738: 	$r->print("</td>\n");
1.17      harris41  739: 	$r->print("<td bgcolor=$fileclr align=right valign=bottom> ",
                    740: 		  $filecom[8]," </td>\n") 
1.11      ng        741: 	    if $hash{'display_attrs_0'} == 1;
1.17      harris41  742: 	$r->print("<td bgcolor=$fileclr valign=bottom> ".
                    743: 		  (localtime($filecom[9]))." </td>\n") 
1.11      ng        744: 	    if $hash{'display_attrs_1'} == 1;
1.17      harris41  745: 	$r->print("<td bgcolor=$fileclr valign=bottom> ".
                    746: 		  (localtime($filecom[10]))." </td>\n") 
1.11      ng        747: 	    if $hash{'display_attrs_2'} == 1;
1.2       harris41  748: 
1.6       harris41  749: 	if ($hash{'display_attrs_3'} == 1) {
1.17      harris41  750: 	    my $author = &Apache::lonnet::metadata($filelink,'author')
                    751: 		if ($metafile == 1);
1.2       harris41  752: 	    $author = '&nbsp;' if (!$author);
1.17      harris41  753: 	    $r->print("<td bgcolor=$fileclr valign=bottom> ".$author.
                    754: 		      " </td>\n");
1.2       harris41  755: 	}
1.6       harris41  756: 	if ($hash{'display_attrs_4'} == 1) {
1.17      harris41  757: 	    my $keywords = &Apache::lonnet::metadata($filelink,'keywords')
                    758: 		if ($metafile == 1);
1.2       harris41  759: 	    $keywords = '&nbsp;' if (!$keywords);
1.17      harris41  760: 	    $r->print("<td bgcolor=$fileclr valign=bottom> ".$keywords.
                    761: 		      " </td>\n");
1.2       harris41  762: 	}
1.6       harris41  763: 	if ($hash{'display_attrs_5'} == 1) {
1.17      harris41  764: 	    my $lang = &Apache::lonnet::metadata($filelink,'language')
                    765: 		if ($metafile == 1);
1.28      harris41  766: 	    $lang = &Apache::loncommon::languagedescription($lang);
1.2       harris41  767: 	    $lang = '&nbsp;' if (!$lang);
1.17      harris41  768: 	    $r->print("<td bgcolor=$fileclr valign=bottom> ".$lang.
                    769: 		      " </td>\n");
1.2       harris41  770: 	}
1.1       www       771: 	$r->print("</tr>\n");
                    772:     }
1.17      harris41  773: 
1.2       harris41  774: # -- display directory
1.1       www       775:     if ($fnptr == $dirptr) {
                    776: 	my @file_ext = split (/\./,$listname);
                    777: 	my $curfext = $file_ext[scalar(@file_ext)-1];
1.2       harris41  778: 	my $curdir = $startdir.$filecom[0].'/';
1.3       harris41  779: 	my $anchor = $curdir;
                    780: 	$anchor =~ s/\///g;
1.7       harris41  781: 	$r->print("<tr>$extrafield<td bgcolor=$fileclr valign=bottom>");
1.2       harris41  782: 	&begin_form ($r,$curdir);
1.4       harris41  783: 	my $indentm1 = $indent-1;
1.11      ng        784: 	if ($indentm1 < 11 and $indentm1 > 0) {
1.17      harris41  785: 	    $r->print("<img src=",$iconpath,"whitespace",$indentm1,
                    786: 		      ".gif border='0' />\n");
1.4       harris41  787: 	} else {
                    788: 	    my $ten = int($indentm1/10.);
                    789: 	    my $rem = $indentm1%10.0;
                    790: 	    my $count = 0;
                    791: 	    while ($count < $ten) {
1.17      harris41  792: 		$r->print ("<img src=",$iconpath
                    793: 			   ,"whitespace10.gif border='0' />\n");
1.12      ng        794: 		$count++;
1.4       harris41  795: 	    }
1.17      harris41  796: 	    $r->print ("<img src=",$iconpath,"whitespace",$rem,
                    797: 		       ".gif border='0' />\n") if $rem > 0;
1.1       www       798: 	}
1.16      harris41  799: 	$r->print ('<input type="hidden" name="acts" value="">');
1.17      harris41  800: 	$r->print ('<a name="'.$anchor.'"><input src="'.$iconpath.
                    801: 		   'folder_pointer_'.$diropen.'.gif"');
                    802: 	$r->print (' name="'.$msg.'" height="22" type="image" border="0">'.
                    803: 		   "\n");
                    804: 	$r->print ('<a href="javascript:gothere(\''.$curdir.'\')"><img src="'.
                    805: 		   $iconpath.'folder_'.$diropen.'.gif" border="0" /></a>'.
                    806: 		   "\n");
1.13      ng        807: 	$r->print ("$listname$tabtag</tr></form>\n");
1.1       www       808:     }
1.2       harris41  809: 
1.1       www       810: }
                    811: 
1.14      harris41  812: # ------------------- prints the beginning of a form for directory or file link
1.1       www       813: sub begin_form {
                    814:     my ($r,$uri) = @_;
1.3       harris41  815:     my $anchor = $uri;
                    816:     $anchor =~ s/\///g;
1.17      harris41  817:     $r->print ('<form method="post" name="dirpath'.$dnum.'" action="'.$uri.
                    818: 	       '#'.$anchor.
                    819: 	       '" onSubmit="return rep_dirpath(\''.$dnum.'\''.
                    820: 	       ',document.forms.fileattr.acts.value)" '.
1.16      harris41  821: 	       'enctype="application/x-www-form-urlencoded">'."\n");
1.17      harris41  822:     $r->print ('<input type="hidden" name="openuri" value="'.$uri.'">'.
                    823: 	       "\n");
                    824:     $r->print ('<input type="hidden" name="dirPointer" value="on">'."\n");
1.16      harris41  825:     $dnum++;
1.17      harris41  826: }
                    827: 
                    828: # --------- settings whenever the user causes the indexer window to be launched
                    829: sub start_fresh_session {
                    830:     delete $hash{'mode_catalog'};
1.35      matthew   831:     delete $hash{'form_mode'};
                    832:     delete $hash{'form_form'};
                    833:     delete $hash{'form_element'};
1.27      harris41  834:     foreach (keys %hash) {
1.17      harris41  835: 	if ($_ =~ /^pre_/) {
                    836: 	    delete $hash{$_};
                    837: 	}
                    838: 	if ($_ =~ /^store/) {
                    839: 	    delete $hash{$_};
                    840: 	}
1.27      harris41  841:     }
1.1       www       842: }
                    843: 
1.35      matthew   844: # ------------------------------------------------------------------- setvalues
                    845: sub setvalues {
                    846:     # setvalues is used in registerurl to synchronize the database
                    847:     # hash and environment hashes
                    848:     my ($H1,$h1key,$H2,$h2key) =@_;
                    849:     #
                    850:     if (exists $H2->{$h2key}) {
                    851: 	$H1->{$h1key} = $H2->{$h2key};
                    852:     } elsif (exists $H1->{$h1key}) {
                    853: 	$H2->{$h2key} = $H1->{$h1key};
                    854:     } 
                    855: }
                    856: 
1.1       www       857: 1;
1.23      harris41  858: 
                    859: =head1 NAME
                    860: 
                    861: Apache::lonindexer - mod_perl module for cross server filesystem browsing
                    862: 
                    863: =head1 SYNOPSIS
                    864: 
                    865: Invoked by /etc/httpd/conf/srm.conf:
                    866: 
                    867:  <LocationMatch "^/res.*/$">
                    868:  SetHandler perl-script
                    869:  PerlHandler Apache::lonindexer
                    870:  </LocationMatch>
                    871: 
                    872: =head1 INTRODUCTION
                    873: 
                    874: This module enables a scheme of browsing across a cross server.
                    875: 
                    876: This is part of the LearningOnline Network with CAPA project
                    877: described at http://www.lon-capa.org.
                    878: 
                    879: =head1 BEGIN SUBROUTINE
                    880: 
                    881: This routine is only run once after compilation.
                    882: 
                    883: =over 4
                    884: 
                    885: =item *
                    886: 
                    887: Initializes %language hash table.
                    888: 
                    889: =back
                    890: 
                    891: =head1 HANDLER SUBROUTINE
                    892: 
                    893: This routine is called by Apache and mod_perl.
                    894: 
                    895: =over 4
                    896: 
                    897: =item *
                    898: 
                    899: read in machine configuration variables
                    900: 
                    901: =item *
                    902: 
                    903: see if called from an interactive mode
                    904: 
                    905: =item *
                    906: 
                    907: refresh environment with user database values (in %hash)
                    908: 
                    909: =item *
                    910: 
                    911: define extra fields and buttons in case of special mode
                    912: 
                    913: =item *
                    914: 
                    915: set catalogmodefunctions to have extra needed javascript functionality
                    916: 
                    917: =item *
                    918: 
                    919: print header
                    920: 
                    921: =item *
                    922: 
                    923: evaluate actions from previous page (both cumulatively and chronologically)
                    924: 
                    925: =item *
                    926: 
                    927: output title
                    928: 
                    929: =item *
                    930: 
                    931: get state of file attributes to be showing
                    932: 
                    933: =item *
                    934: 
                    935: output state of file attributes to be showing
                    936: 
                    937: =item *
                    938: 
                    939: output starting row to the indexed file/directory hierarchy
                    940: 
                    941: =item *
                    942: 
                    943: read in what directories have previously been set to "open"
                    944: 
                    945: =item *
                    946: 
                    947: if not at top level, provide an uplink arrow
                    948: 
                    949: =item *
                    950: 
                    951: recursively go through all the directories and output as appropriate
                    952: 
                    953: =item *
                    954: 
                    955: information useful for group import
                    956: 
                    957: =item *
                    958: 
                    959: end the tables
                    960: 
                    961: =item *
                    962: 
                    963: end the output and return
                    964: 
                    965: =back
                    966: 
                    967: =head1 OTHER SUBROUTINES
                    968: 
                    969: =over 4
                    970: 
                    971: =item *
                    972: 
                    973: scanDir - recursive scan of a directory
                    974: 
                    975: =item *
                    976: 
                    977: get_list - get complete matched list based on the uri (returns an array)
                    978: 
                    979: =item *
                    980: 
                    981: match_ext - filters out files based on extensions (returns an array)
                    982: 
                    983: =item *
                    984: 
                    985: display_line - displays one line in appropriate table format
                    986: 
                    987: =item *
                    988: 
                    989: begin_form - prints the beginning of a form for directory or file link
                    990: 
                    991: =item *
                    992: 
                    993: start_fresh_session - settings whenever the user causes the indexer window
                    994: to be launched
                    995: 
                    996: =back
                    997: 
                    998: =cut

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