File:  [LON-CAPA] / loncom / interface / lonindexer.pm
Revision 1.8: download - view: text, annotated - select for diffs
Thu May 31 21:38:58 2001 UTC (23 years, 1 month ago) by harris41
Branches: MAIN
CVS tags: HEAD
beginning to implement group import -Scott

    1: # The LearningOnline Network with CAPA
    2: # Directory Indexer
    3: # (Login Screen
    4: # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer)
    5: # 11/23 Gerd Kortemeyer
    6: # 07/20-08/04 H.K. Ng
    7: #
    8: # 05/9-05/19/2001 H. K. Ng
    9: # 05/21/2001 H. K. Ng
   10: # 05/23/2001 H. K. Ng
   11: # 05/31/2001 Scott Harrison
   12: 
   13: package Apache::lonindexer;
   14: 
   15: use strict;
   16: use Apache::lonnet();
   17: use Apache::Constants qw(:common);
   18: use Apache::File;
   19: use GDBM_File;
   20: 
   21: my %hash;
   22: my %dirs;
   23: my %language;
   24: my $hidden;
   25: my $extrafield;
   26: my $fnum=0;
   27: sub BEGIN {
   28:     my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.'/language.tab');
   29:     map {
   30: 	$_=~/(\w+)\s+([\w\s\-]+)/;
   31: 	$language{$1}=$2;
   32:     } <$fh>;
   33: }
   34: 
   35: sub handler {
   36:     my $r = shift;
   37:     $r->content_type('text/html');
   38:     $r->send_http_header;
   39:     return OK if $r->header_only;
   40: 
   41:     my $iconpath= $r->dir_config('lonIconsURL');
   42:     my $domain  = $r->dir_config('lonDefDomain');
   43:     my $role    = $r->dir_config('lonRole');
   44:     my $loadlim = $r->dir_config('lonLoadLim');
   45:     my $servadm = $r->dir_config('lonAdmEMail');
   46:     my $sysadm  = $r->dir_config('lonSysEMail');
   47:     my $lonhost = $r->dir_config('lonHostID');
   48:     my $tabdir  = $r->dir_config('lonTabDir');
   49: 
   50:     my $iconpath='/res/adm/pages/indexericons/';
   51:     my $fileclr='#ffffe6';
   52: # -------------------------------------- see if called from an interactive mode
   53:     map {
   54:        my ($name, $value) = split(/=/,$_);
   55:        $value =~ tr/+/ /;
   56:        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
   57:        if ($name eq 'catalogmode') {
   58:            $ENV{'form.'.$name}=$value;
   59: 	   }
   60:     } (split(/&/,$ENV{'QUERY_STRING'}));
   61: 
   62:     $hidden=''; my $closebutton='';
   63:     my $groupimportbutton='';
   64:     my $colspan=''; 
   65:     if ($ENV{'form.catalogmode'} eq 'interactive') {
   66: 	$extrafield='<td bgcolor="'.$fileclr.'" valign="bottom">'.
   67: 	    '<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'.
   68: 	    ' border="0"></td>';
   69: 	$colspan=" colspan='2' ";
   70: 	$hidden=<<END;
   71: <input type='hidden' name='catalogmode' value='interactive'>
   72: END
   73:         $closebutton=<<END;
   74: <input type="button" name="close" value='CLOSE' onClick="self.close()">
   75: END
   76:     }
   77:     elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
   78: 	$extrafield='<td bgcolor="'.$fileclr.'" valign="bottom">'.
   79: 	    '<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'.
   80: 	    ' border="0"></td>';
   81: 	$colspan=" colspan='2' ";
   82: 	$hidden=<<END;
   83: <input type='hidden' name='catalogmode' value='groupimport'>
   84: END
   85:         $closebutton=<<END;
   86: <input type="button" name="close" value='CLOSE' onClick="self.close()">
   87: END
   88:         $groupimportbutton=<<END;
   89: <input type="button" name="groupimport" value='GROUP IMPORT' onClick="javascript:select_group()">
   90: END
   91:     }
   92: 
   93:     my $catalogmodefunctions='';
   94:     if ($ENV{'form.catalogmode'} eq 'interactive' or
   95: 	$ENV{'form.catalogmode'} eq 'groupimport') {
   96: 	$catalogmodefunctions=<<END;
   97: function select_data(title,url) {
   98:     changeTitle(title);
   99:     changeURL(url);
  100:     self.close();
  101: }
  102: function save_group() {
  103:     for (var num=0; num<document.forms.fnum.fnum.value; num++) {
  104: 	if (eval("document.forms.form"+num+".filelink.checked")) {
  105: 	    alert(eval("document.forms.form"+num+".title.value")+
  106: 		       eval("document.forms.form"+num+".filelink.value"));
  107: 	}
  108:     }
  109: }
  110: function select_group() {
  111:     for (var num=0; num<document.forms.fnum.fnum.value; num++) {
  112: 	if (eval("document.forms.form"+num+".filelink.checked")) {
  113: 	    alert(eval("document.forms.form"+num+".title.value")+
  114: 		       eval("document.forms.form"+num+".filelink.value"));
  115: 	}
  116:     }
  117: //    changeTitle(title);
  118: //    changeURL(url);
  119: }
  120: function changeTitle(val) {
  121:     if (opener.inf.document.forms.resinfo.elements.t) {
  122:         opener.inf.document.forms.resinfo.elements.t.value=val;
  123:     }
  124: }
  125: function changeURL(val) {
  126:     if (opener.inf.document.forms.resinfo.elements.u) {
  127: 	opener.inf.document.forms.resinfo.elements.u.value=val;
  128:     }
  129: }
  130: END
  131:     }
  132: 
  133: # ---------------------------------------------------------------- Print Header
  134:     $r->print(<<ENDHEADER);
  135: <html>
  136: <head>
  137: <title>The LearningOnline Network With CAPA Directory Browser</title>
  138: 
  139: <SCRIPT language="javascript">
  140: $catalogmodefunctions
  141: function openWindow(url, wdwName, w, h, toolbar,scrollbar) {
  142:     var options = "width=" + w + ",height=" + h + ",";
  143:     options += "resizable=yes,scrollbars="+scrollbar+",status=no,";
  144:     options += "menubar=no,toolbar="+toolbar+",location=no,directories=no";
  145:     var newWin = window.open(url, wdwName, options);
  146:     newWin.focus();
  147: }
  148: </SCRIPT>
  149: 
  150: </head>
  151: <body bgcolor="#FFFFFF">
  152: ENDHEADER
  153: 
  154:     my $line;
  155:     my (@attrchk,@openpath);
  156:     my $uri=$r->uri;
  157: 
  158:     $r->print("<h2><font color=\"\#888888\">The LearningOnline With CAPA Network Directory Browser</font></h2>\n");
  159: 
  160:     my $diropen = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db";
  161: 
  162:     if (tie(%hash,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) {
  163: 
  164: 	if ($ENV{'form.attrs'} ne "") {
  165: 	    for (my $i=0; $i<=5; $i++) {
  166: 		delete $hash{'display_attrs_'.$i};
  167: 		if ($ENV{'form.attr'.$i} == 1) {
  168: 		    $attrchk[$i] = "checked";
  169: 		    $hash{'display_attrs_'.$i} = 1;
  170: 		}
  171: 	    }
  172: 	} else {
  173: 	    for (my $i=0; $i<=5; $i++) {
  174: 		$attrchk[$i] = "checked" if $hash{'display_attrs_'.$i} == 1;
  175: 	    }
  176: 	}
  177:     $r->print(<<END);
  178: <b><font color="#666666">Display file attributes</font></b><br>
  179: <form method="post" name="fileattr" action="$uri" enctype="application/x-www-form-urlencoded">
  180: <table border=0><tr>
  181: <td><input type=checkbox name=attr0 value="1" $attrchk[0]> Size</td>
  182: <td><input type=checkbox name=attr1 value="1" $attrchk[1]> Last access</td>
  183: <td><input type=checkbox name=attr2 value="1" $attrchk[2]> Last modified</td>
  184: </tr><tr>
  185: <td><input type=checkbox name=attr3 value="1" $attrchk[3]> Author</td>
  186: <td><input type=checkbox name=attr4 value="1" $attrchk[4]> Keywords</td>
  187: <td><input type=checkbox name=attr5 value="1" $attrchk[5]> Language</td>
  188: </tr></table>
  189: <input type="submit" name="attrs" value="Review">&nbsp;
  190: <input type="submit" name="attrs" value="Refresh">
  191: $hidden
  192: $closebutton
  193: $groupimportbutton
  194: </form>
  195: END
  196: 
  197:     my $titleclr="#ddffff";
  198:     $r->print("<table border=0><tr><td bgcolor=#eeeeee>\n");
  199:     $r->print("<table border=0><tr>\n");
  200:     $r->print("<td $colspan bgcolor=$titleclr><b>Name</b></td>\n");
  201:     $r->print("<td bgcolor=$titleclr align=right><b>Size (bytes) </b></td>\n") if ($hash{'display_attrs_0'} == 1);
  202:     $r->print("<td bgcolor=$titleclr><b>Last accessed</b></td>\n") if ($hash{'display_attrs_1'} == 1);
  203:     $r->print("<td bgcolor=$titleclr><b>Last modified</b></td>\n") if ($hash{'display_attrs_2'} == 1);
  204:     $r->print("<td bgcolor=$titleclr><b>Author(s)</b></td>\n") if ($hash{'display_attrs_3'} == 1);
  205:     $r->print("<td bgcolor=$titleclr><b>Keywords</b></td>\n") if ($hash{'display_attrs_4'} == 1);
  206:     $r->print("<td bgcolor=$titleclr><b>Language</b></td>\n") if ($hash{'display_attrs_5'} == 1);
  207:     $r->print("</tr>");
  208: 
  209: 	map {
  210: 	    if ($_ =~ /^diropen_status_/) {
  211: 		my $key = $_;
  212: 		$key =~ s/^diropen_status_//;
  213: 		$dirs{$key} = $hash{$_};
  214: 	    }
  215: 	} keys %hash;
  216: 
  217: 	if ($ENV{'form.openuri'}) {  # take care of review and refresh options
  218: 	    my $uri=$ENV{'form.openuri'};
  219: 	    if (exists($hash{'diropen_status_'.$uri})) {
  220: 		my $cursta = $hash{'diropen_status_'.$uri};
  221: 		$dirs{$uri} = 'open';
  222: 		$hash{'diropen_status_'.$uri} = 'open';
  223: 		if ($cursta eq 'open') {
  224: 		    $dirs{$uri} = 'closed';
  225: 		    $hash{'diropen_status_'.$uri} = 'closed';
  226: 		}
  227: 	    } else {
  228: 		$hash{'diropen_status_'.$uri} = 'open';
  229: 		$dirs{$uri} = 'open';
  230: 	    }
  231: 	}
  232: 
  233: 	my $toplevel = "/res/";
  234: 	my $indent = 0;
  235: 	&scanDir ($r,$toplevel,$indent);
  236: 
  237: 	$r->print("<form name='fnum'>");
  238: 	$r->print("<input type='hidden' name='fnum' value='$fnum'></form>");
  239: 	$r->print("</table>");
  240: 	$r->print("</td></tr></table>");
  241: 	$r->print("</body></html>\n");
  242: 	untie(%hash);
  243:     } else {
  244: 	$r->print("Unable to tie hash to db file");
  245:     }
  246:     return OK;
  247: }
  248: 
  249: 
  250: # --------------------recursive scan of a directory
  251: sub scanDir {
  252:     my ($r,$startdir,$indent)=@_;
  253:     my ($compuri,$curdir);
  254:     my $dirptr=16384;
  255:     $indent++;
  256: 
  257:     my %dupdirs = %dirs;
  258:     my @list=&get_list($r,$startdir);
  259:     foreach my $line (@list) {
  260: 	my ($strip,$dom,$foo,$testdir,$foo)=split(/\&/,$line,5); 
  261: 	next if $strip =~ /.*\.meta$/;
  262: 	if ($dom eq "domain") {
  263: 	    $compuri = join('',$strip,"/");  # domain list has /res/<domain name>
  264: 	    $curdir = $compuri;
  265: 	} else {
  266: 	    $compuri = join('',$startdir,$strip,"/"); # user, dir & file having name only, i.e., w/o path
  267: 	    $curdir = $startdir;
  268: 	}
  269: 	my $diropen = 0;
  270: 	if (($dirptr&$testdir) or ($dom =~ /^(domain|user)$/)) {
  271: 	    while (my ($key,$val)= each %dupdirs) {
  272: 		if ($key eq $compuri and $val eq "open") {
  273: 		    $diropen = 1;
  274: 		    delete $dupdirs{key},$dirs{$key};
  275: 		}
  276: 	    }
  277: 	}
  278: 	&display_line($r,$diropen,$line,$indent,$curdir,@list);
  279: 	&scanDir ($r,$compuri,$indent) if $diropen == 1;
  280:     }
  281:     $indent--;
  282: }
  283: 
  284: # ----------------- get complete matched list based on the uri ------
  285: sub get_list {
  286:     my ($r,$uri)=@_;
  287:     my @list;
  288:     my $luri = $uri;
  289:     $luri =~ s/\//_/g;
  290: 
  291:     if ($ENV{'form.attrs'} eq "Refresh") {
  292: 	map {
  293: 	    delete $hash{$_} if ($_ =~ /^dirlist_files_/);
  294: 	    } keys %hash;
  295:     }
  296: 
  297:     if ($hash{'dirlist_files'.$luri}) {
  298: 	@list = split(/\n/,$hash{'dirlist_files_'.$luri});
  299:     } else {
  300: 	@list = &Apache::lonnet::dirlist($uri);
  301: 	$hash{'dirlist_files_'.$luri} = join('\n',@list);
  302:     }
  303:     return @list=&match_ext($r,@list);
  304: }
  305: 
  306: #-------------------------- filters out files based on extensions
  307: sub match_ext {
  308:     my ($r,@packlist)=@_;
  309:     my @trimlist;
  310:     my $nextline;
  311:     my @fileext;
  312:     my $dirptr=16384;
  313: 
  314:     my $tabdir  = $r->dir_config('lonTabDir');
  315:     my $fn = $tabdir."/filetypes.tab";
  316:     if (-e $fn) {
  317: 	my $FH=Apache::File->new($fn);
  318: 	my @content=<$FH>;
  319: 	foreach my $line (@content) {
  320: 	    (my $ext,my $foo) = split /\s+/,$line;
  321: 	    push @fileext,$ext;
  322: 	}
  323:     }
  324:     foreach my $line (@packlist) {
  325: 	chomp $line;
  326: 	$line =~ s/^\/home\/httpd\/html//;
  327: 	my @unpackline = split (/\&/,$line);
  328: 	next if ($unpackline[0] eq ".");
  329: 	next if ($unpackline[0] eq "..");
  330: 	my @filecom = split (/\./,$unpackline[0]);
  331: 	my $fext = pop(@filecom);
  332: 	my $fnptr = $unpackline[3]&$dirptr;
  333:  	if ($fnptr == 0 and $unpackline[3] ne "") {
  334: 	    foreach my $nextline (@fileext) {
  335: 		push @trimlist,$line if $nextline eq $fext;
  336: 	    }
  337: 	} else {
  338: 	    push @trimlist,$line;
  339: 	}
  340:     }
  341:     @trimlist = sort (@trimlist);
  342:     return @trimlist;
  343: }
  344: 
  345: #------------------- displays one line in appropriate table format
  346: sub display_line{
  347:     my ($r,$diropen,$line,$indent,$startdir,@list)=@_;
  348:     my (@pathfn, $fndir, $fnptr);
  349:     my $dirptr=16384;
  350:     my $fileclr="#ffffe6";
  351:     my $iconpath="/res/adm/pages/indexericons/";
  352: 
  353:     my @filecom = split (/\&/,$line);
  354:     my @pathcom = split (/\//,$filecom[0]);
  355:     my $listname = $pathcom[scalar(@pathcom)-1];
  356:     my $fnptr = $filecom[3]&$dirptr;
  357:     my $msg = 'View '.$filecom[0].' resources';
  358:     $msg = 'Close '.$filecom[0].' directory' if $diropen == 1;
  359: 
  360:     my $tabtag="</td>";
  361:     my $i=0;
  362: 
  363:     while ($i<=5) {
  364: #	my $key="form.attr".$i;
  365: #	$tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,">&nbsp;</td>") if $ENV{$key} == 1;
  366: 	$tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,">&nbsp;</td>") if $hash{'display_attrs_'.$i} == 1;
  367: 	$i++;
  368:     }
  369:     if ($filecom[1] eq "domain") {
  370: 	$r->print("<tr>$extrafield");
  371: 	$r->print("<td bgcolor=$fileclr valign=bottom>");
  372: 	&begin_form ($r,$filecom[0].'/');
  373: 	my $anchor = $filecom[0].'/';
  374: 	$anchor =~ s/\///g;
  375: 	$r->print ("<a name=\"".$anchor."\">\n<input src=\"".$iconpath."comp.blue.gif\"");
  376: 	$r->print (" name=\"$msg\" height=\"22\" type=\"image\" border=\"0\">\n");
  377: 	$r->print("Domain - $listname $tabtag</tr></form>\n");
  378: 	return OK;
  379:     }
  380:     if ($filecom[1] eq "user") {
  381: 	$r->print("<tr>$extrafield");
  382: 	$r->print("<td bgcolor=$fileclr valign=bottom>\n");
  383: 	my $curdir = $startdir.$filecom[0].'/';
  384: 	&begin_form ($r,$curdir);
  385: 	my $anchor = $curdir;
  386: 	$anchor =~ s/\///g;
  387: #	$r->print ("<a name=\"$anchor\">\n<img src=",$iconpath,"white_space_20_22.gif border=0>\n");
  388: 	$r->print ("<a name=\"$anchor\">\n<img src=",$iconpath,"whitespace1.gif border=0>\n");
  389: 	$r->print ("<input src=\"$iconpath");
  390: 	$r->print ("folder_pointer_closed.gif\"") if $diropen == 0;
  391: 	$r->print ("folder_pointer_opened.gif\"") if $diropen == 1;
  392: 	$r->print (" name=\"$msg\" height=\"22\" type=\"image\" border=\"0\">\n");
  393: 	$r->print ("<img src=",$iconpath,"quill.gif border=0>\n");
  394: 	$r->print ("$listname $tabtag</tr></form>\n");
  395: 	return OK;
  396:     }
  397: # display file
  398:     if ($fnptr == 0 and $filecom[3] ne "") {
  399: 	my @file_ext = split (/\./,$listname);
  400: 	my $curfext = $file_ext[scalar(@file_ext)-1];
  401: 	my $filelink = $startdir.$filecom[0];
  402: 	$r->print("<tr><td nowrap valign='bottom' bgcolor=$fileclr>");
  403: 	my $metafile = grep /^$filecom[0]\.meta\&/, @list;
  404: 	my $title;
  405:         if ($ENV{'form.catalogmode'} eq 'interactive') {
  406: 	    $title=$listname;
  407: 	    $title = &Apache::lonnet::metadata($filelink,'title')
  408: 		if ($metafile == 1);
  409: 	    $title=$listname unless $title;
  410: 	    $r->print("<a href='javascript:select_data(\"",
  411: 	              $title,'","',$filelink,"\")'>");
  412: 	    $r->print("<img src='",$iconpath,"select.gif' border=0></a>\n");
  413: 	    $r->print("</td><td valign='bottom' nowrap bgcolor=$fileclr>");
  414: 	}
  415:         elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
  416: 	    $title=$listname;
  417: 	    $title = &Apache::lonnet::metadata($filelink,'title')
  418: 		if ($metafile == 1);
  419: 	    $title=$listname unless $title;
  420: 	    $r->print("<form name='form$fnum'>\n");
  421: 	    $r->print("<input type='checkbox' name='filelink"."' ".
  422: 		      "value='$filelink'>\n");
  423: 	    $r->print("<input type='hidden' name='title"."' ".
  424: 		      "value='$title'>\n");
  425: 	    $r->print("</form>\n");
  426: 	    $r->print("</td><td valign='bottom' nowrap bgcolor=$fileclr>");
  427:   	    $fnum++;
  428: 	}
  429: 
  430: 	if ($indent < 11) {
  431: 	    $r->print("<img src=",$iconpath,"whitespace",$indent,".gif border=0>\n");
  432: 	} else {
  433: 	    my $ten = int($indent/10.);
  434: 	    my $rem = $indent%10.0;
  435: 	    my $count = 0;
  436: 	    while ($count < $ten) {
  437: 		$r->print("<img src=",$iconpath,"whitespace10.gif border=0>\n");
  438: 	    $count++;
  439: 	    }
  440: 	    $r->print("<img src=",$iconpath,"whitespace",$rem,".gif border=0>\n") if $rem > 0;
  441: 	}
  442: 
  443: 	$r->print("<img src=$iconpath$curfext.gif border=0>\n");
  444: 	$r->print(" <a href=$filelink target='_blank'>",$listname,"</a>\n");
  445: 
  446: 	$r->print (" (<a href=\"javascript:openWindow('".$filelink.".meta', 'metadatafile', '400', '450', 'no', 'yes')\"; TARGET=_self>metadata</a>) ") if ($metafile == 1);
  447: 
  448: 	$r->print("</td>\n");
  449: #	$r->print("<td bgcolor=$fileclr align=right valign=bottom> ",$filecom[8]," </td>\n") if $ENV{'form.attr0'} == 1;
  450: 	$r->print("<td bgcolor=$fileclr align=right valign=bottom> ",$filecom[8]," </td>\n") if $hash{'display_attrs_0'} == 1;
  451: 	$r->print("<td bgcolor=$fileclr valign=bottom> ".(localtime($filecom[9]))." </td>\n") if $hash{'display_attrs_1'} == 1;
  452: 	$r->print("<td bgcolor=$fileclr valign=bottom> ".(localtime($filecom[10]))." </td>\n") if $hash{'display_attrs_2'} == 1;
  453: 
  454: 	if ($hash{'display_attrs_3'} == 1) {
  455: 	    my $author = &Apache::lonnet::metadata($filelink,'author') if ($metafile == 1);
  456: 	    $author = '&nbsp;' if (!$author);
  457: 	    $r->print("<td bgcolor=$fileclr valign=bottom> ".$author." </td>\n");
  458: 	}
  459: 	if ($hash{'display_attrs_4'} == 1) {
  460: 	    my $keywords = &Apache::lonnet::metadata($filelink,'keywords') if ($metafile == 1);
  461: 	    $keywords = '&nbsp;' if (!$keywords);
  462: 	    $r->print("<td bgcolor=$fileclr valign=bottom> ".$keywords." </td>\n");
  463: 	}
  464: 	if ($hash{'display_attrs_5'} == 1) {
  465: 	    my $lang = &Apache::lonnet::metadata($filelink,'language') if ($metafile == 1);
  466: 	    $lang = $language{$lang};
  467: 	    $lang = '&nbsp;' if (!$lang);
  468: 	    $r->print("<td bgcolor=$fileclr valign=bottom> ".$lang." </td>\n");
  469: 	}
  470: 	$r->print("</tr>\n");
  471:     }
  472: # -- display directory
  473:     if ($fnptr == $dirptr) {
  474: 	my @file_ext = split (/\./,$listname);
  475: 	my $curfext = $file_ext[scalar(@file_ext)-1];
  476: 	my $curdir = $startdir.$filecom[0].'/';
  477: 	my $anchor = $curdir;
  478: 	$anchor =~ s/\///g;
  479: 	$r->print("<tr>$extrafield<td bgcolor=$fileclr valign=bottom>");
  480: 	&begin_form ($r,$curdir);
  481: 	my $indentm1 = $indent-1;
  482: 	if ($indentm1 < 11) {
  483: 	    $r->print("<img src=",$iconpath,"whitespace",$indentm1,".gif border=0>\n");
  484: 	} else {
  485: 	    my $ten = int($indentm1/10.);
  486: 	    my $rem = $indentm1%10.0;
  487: 	    my $count = 0;
  488: 	    while ($count < $ten) {
  489: 		$r->print("<img src=",$iconpath,"whitespace10.gif border=0>\n");
  490: 	    $count++;
  491: 	    }
  492: 	    $r->print("<img src=",$iconpath,"whitespace",$rem,".gif border=0>\n") if $rem > 0;
  493: 	}
  494: 	$r->print ("<a name=\"$anchor\">\n<input src=\"$iconpath");
  495: 	$r->print ("folder_pointer_closed.gif\"") if $diropen == 0;
  496: 	$r->print ("folder_pointer_opened.gif\"") if $diropen == 1;
  497: 	$r->print (" name=\"$msg\" height=\"22\" type=\"image\" border=\"0\">\n");
  498: 	$r->print("<img src=",$iconpath,"folder_closed.gif border=0>\n") if $diropen == 0;
  499: 	$r->print("<img src=",$iconpath,"folder_opened.gif border=0>\n") if $diropen == 1;
  500: 	$r->print("$listname $tabtag</tr></form>\n");
  501:     }
  502: 
  503: }
  504: 
  505: #---------------------prints the beginning of a form for directory or file link
  506: sub begin_form {
  507:     my ($r,$uri) = @_;
  508:     my $anchor = $uri;
  509:     $anchor =~ s/\///g;
  510:     $r->print ("<form method=\"post\" name=\"dirpath\" action=\"/res/\#$anchor\" enctype=\"application/x-www-form-urlencoded\">\n");
  511:     $r->print ("$hidden<input type=hidden name=openuri value=\"$uri\">\n");
  512: 
  513: #    for (my $i=0; $i<=5; $i++) {
  514: #	$r->print ("<input type=hidden name=attr$i value=\"1\">\n") if $ENV{'form.attr'.$i} == 1;
  515: #    }
  516: }
  517: 
  518: 1;
  519: __END__

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