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