Annotation of loncom/interface/lonindexer.pm, revision 1.8
1.1 www 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: #
1.2 harris41 8: # 05/9-05/19/2001 H. K. Ng
1.4 harris41 9: # 05/21/2001 H. K. Ng
1.6 harris41 10: # 05/23/2001 H. K. Ng
1.7 harris41 11: # 05/31/2001 Scott Harrison
12:
1.1 www 13: package Apache::lonindexer;
14:
15: use strict;
16: use Apache::lonnet();
17: use Apache::Constants qw(:common);
1.2 harris41 18: use Apache::File;
19: use GDBM_File;
20:
1.4 harris41 21: my %hash;
1.2 harris41 22: my %dirs;
23: my %language;
1.7 harris41 24: my $hidden;
25: my $extrafield;
1.8 ! harris41 26: my $fnum=0;
1.2 harris41 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: }
1.1 www 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:
1.7 harris41 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') {
1.8 ! harris41 78: $extrafield='<td bgcolor="'.$fileclr.'" valign="bottom">'.
! 79: '<a name="$anchor"><img src="'.$iconpath.'whitespace1.gif"'.
! 80: ' border="0"></td>';
1.7 harris41 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;
1.8 ! harris41 89: <input type="button" name="groupimport" value='GROUP IMPORT' onClick="javascript:select_group()">
1.7 harris41 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);
1.8 ! harris41 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);
1.7 harris41 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:
1.1 www 133: # ---------------------------------------------------------------- Print Header
134: $r->print(<<ENDHEADER);
135: <html>
136: <head>
1.2 harris41 137: <title>The LearningOnline Network With CAPA Directory Browser</title>
1.3 harris41 138:
1.2 harris41 139: <SCRIPT language="javascript">
1.7 harris41 140: $catalogmodefunctions
1.2 harris41 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>
1.3 harris41 149:
1.1 www 150: </head>
151: <body bgcolor="#FFFFFF">
152: ENDHEADER
153:
154: my $line;
155: my (@attrchk,@openpath);
156: my $uri=$r->uri;
157:
1.2 harris41 158: $r->print("<h2><font color=\"\#888888\">The LearningOnline With CAPA Network Directory Browser</font></h2>\n");
1.1 www 159:
1.6 harris41 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: }
1.1 www 177: $r->print(<<END);
1.2 harris41 178: <b><font color="#666666">Display file attributes</font></b><br>
1.1 www 179: <form method="post" name="fileattr" action="$uri" enctype="application/x-www-form-urlencoded">
180: <table border=0><tr>
1.2 harris41 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>
1.1 www 184: </tr><tr>
1.2 harris41 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>
1.1 www 188: </tr></table>
1.6 harris41 189: <input type="submit" name="attrs" value="Review">
190: <input type="submit" name="attrs" value="Refresh">
1.7 harris41 191: $hidden
192: $closebutton
193: $groupimportbutton
1.1 www 194: </form>
195: END
196:
1.5 harris41 197: my $titleclr="#ddffff";
198: $r->print("<table border=0><tr><td bgcolor=#eeeeee>\n");
199: $r->print("<table border=0><tr>\n");
1.7 harris41 200: $r->print("<td $colspan bgcolor=$titleclr><b>Name</b></td>\n");
1.6 harris41 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);
1.5 harris41 207: $r->print("</tr>");
208:
1.4 harris41 209: map {
210: if ($_ =~ /^diropen_status_/) {
211: my $key = $_;
212: $key =~ s/^diropen_status_//;
213: $dirs{$key} = $hash{$_};
214: }
215: } keys %hash;
216:
1.2 harris41 217: if ($ENV{'form.openuri'}) { # take care of review and refresh options
218: my $uri=$ENV{'form.openuri'};
1.4 harris41 219: if (exists($hash{'diropen_status_'.$uri})) {
220: my $cursta = $hash{'diropen_status_'.$uri};
1.2 harris41 221: $dirs{$uri} = 'open';
1.4 harris41 222: $hash{'diropen_status_'.$uri} = 'open';
223: if ($cursta eq 'open') {
224: $dirs{$uri} = 'closed';
225: $hash{'diropen_status_'.$uri} = 'closed';
226: }
1.2 harris41 227: } else {
1.4 harris41 228: $hash{'diropen_status_'.$uri} = 'open';
1.2 harris41 229: $dirs{$uri} = 'open';
230: }
231: }
1.1 www 232:
1.2 harris41 233: my $toplevel = "/res/";
1.4 harris41 234: my $indent = 0;
1.2 harris41 235: &scanDir ($r,$toplevel,$indent);
236:
1.8 ! harris41 237: $r->print("<form name='fnum'>");
! 238: $r->print("<input type='hidden' name='fnum' value='$fnum'></form>");
1.2 harris41 239: $r->print("</table>");
240: $r->print("</td></tr></table>");
241: $r->print("</body></html>\n");
1.4 harris41 242: untie(%hash);
1.2 harris41 243: } else {
244: $r->print("Unable to tie hash to db file");
245: }
1.1 www 246: return OK;
247: }
1.2 harris41 248:
1.6 harris41 249:
1.2 harris41 250: # --------------------recursive scan of a directory
251: sub scanDir {
252: my ($r,$startdir,$indent)=@_;
1.3 harris41 253: my ($compuri,$curdir);
254: my $dirptr=16384;
1.1 www 255: $indent++;
256:
1.2 harris41 257: my %dupdirs = %dirs;
258: my @list=&get_list($r,$startdir);
259: foreach my $line (@list) {
1.5 harris41 260: my ($strip,$dom,$foo,$testdir,$foo)=split(/\&/,$line,5);
1.4 harris41 261: next if $strip =~ /.*\.meta$/;
1.5 harris41 262: if ($dom eq "domain") {
1.3 harris41 263: $compuri = join('',$strip,"/"); # domain list has /res/<domain name>
264: $curdir = $compuri;
1.2 harris41 265: } else {
266: $compuri = join('',$startdir,$strip,"/"); # user, dir & file having name only, i.e., w/o path
1.3 harris41 267: $curdir = $startdir;
1.2 harris41 268: }
269: my $diropen = 0;
1.5 harris41 270: if (($dirptr&$testdir) or ($dom =~ /^(domain|user)$/)) {
1.3 harris41 271: while (my ($key,$val)= each %dupdirs) {
1.5 harris41 272: if ($key eq $compuri and $val eq "open") {
273: $diropen = 1;
274: delete $dupdirs{key},$dirs{$key};
275: }
1.3 harris41 276: }
1.1 www 277: }
1.4 harris41 278: &display_line($r,$diropen,$line,$indent,$curdir,@list);
1.2 harris41 279: &scanDir ($r,$compuri,$indent) if $diropen == 1;
1.1 www 280: }
281: $indent--;
282: }
283:
1.2 harris41 284: # ----------------- get complete matched list based on the uri ------
1.1 www 285: sub get_list {
286: my ($r,$uri)=@_;
287: my @list;
1.2 harris41 288: my $luri = $uri;
289: $luri =~ s/\//_/g;
290:
1.6 harris41 291: if ($ENV{'form.attrs'} eq "Refresh") {
1.4 harris41 292: map {
293: delete $hash{$_} if ($_ =~ /^dirlist_files_/);
294: } keys %hash;
1.2 harris41 295: }
296:
1.4 harris41 297: if ($hash{'dirlist_files'.$luri}) {
298: @list = split(/\n/,$hash{'dirlist_files_'.$luri});
1.1 www 299: } else {
1.4 harris41 300: @list = &Apache::lonnet::dirlist($uri);
301: $hash{'dirlist_files_'.$luri} = join('\n',@list);
1.1 www 302: }
303: return @list=&match_ext($r,@list);
304: }
305:
1.2 harris41 306: #-------------------------- filters out files based on extensions
1.1 www 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>;
1.2 harris41 319: foreach my $line (@content) {
1.1 www 320: (my $ext,my $foo) = split /\s+/,$line;
321: push @fileext,$ext;
322: }
323: }
1.2 harris41 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;
1.1 www 336: }
337: } else {
1.2 harris41 338: push @trimlist,$line;
1.1 www 339: }
340: }
1.4 harris41 341: @trimlist = sort (@trimlist);
1.1 www 342: return @trimlist;
343: }
344:
1.2 harris41 345: #------------------- displays one line in appropriate table format
1.1 www 346: sub display_line{
1.4 harris41 347: my ($r,$diropen,$line,$indent,$startdir,@list)=@_;
1.1 www 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;
1.4 harris41 357: my $msg = 'View '.$filecom[0].' resources';
358: $msg = 'Close '.$filecom[0].' directory' if $diropen == 1;
1.1 www 359:
360: my $tabtag="</td>";
361: my $i=0;
362:
363: while ($i<=5) {
1.6 harris41 364: # my $key="form.attr".$i;
365: # $tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,"> </td>") if $ENV{$key} == 1;
366: $tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,"> </td>") if $hash{'display_attrs_'.$i} == 1;
1.1 www 367: $i++;
368: }
369: if ($filecom[1] eq "domain") {
1.7 harris41 370: $r->print("<tr>$extrafield");
1.1 www 371: $r->print("<td bgcolor=$fileclr valign=bottom>");
1.2 harris41 372: &begin_form ($r,$filecom[0].'/');
1.3 harris41 373: my $anchor = $filecom[0].'/';
374: $anchor =~ s/\///g;
375: $r->print ("<a name=\"".$anchor."\">\n<input src=\"".$iconpath."comp.blue.gif\"");
1.4 harris41 376: $r->print (" name=\"$msg\" height=\"22\" type=\"image\" border=\"0\">\n");
1.1 www 377: $r->print("Domain - $listname $tabtag</tr></form>\n");
378: return OK;
379: }
380: if ($filecom[1] eq "user") {
1.7 harris41 381: $r->print("<tr>$extrafield");
1.1 www 382: $r->print("<td bgcolor=$fileclr valign=bottom>\n");
1.2 harris41 383: my $curdir = $startdir.$filecom[0].'/';
384: &begin_form ($r,$curdir);
1.3 harris41 385: my $anchor = $curdir;
386: $anchor =~ s/\///g;
1.4 harris41 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");
1.1 www 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;
1.4 harris41 392: $r->print (" name=\"$msg\" height=\"22\" type=\"image\" border=\"0\">\n");
1.3 harris41 393: $r->print ("<img src=",$iconpath,"quill.gif border=0>\n");
394: $r->print ("$listname $tabtag</tr></form>\n");
1.1 www 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];
1.2 harris41 401: my $filelink = $startdir.$filecom[0];
1.8 ! harris41 402: $r->print("<tr><td nowrap valign='bottom' bgcolor=$fileclr>");
1.7 harris41 403: my $metafile = grep /^$filecom[0]\.meta\&/, @list;
404: my $title;
405: if ($ENV{'form.catalogmode'} eq 'interactive') {
406: $title=$listname;
1.8 ! harris41 407: $title = &Apache::lonnet::metadata($filelink,'title')
! 408: if ($metafile == 1);
1.7 harris41 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");
1.8 ! harris41 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++;
1.7 harris41 428: }
1.4 harris41 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");
1.1 www 438: $count++;
1.4 harris41 439: }
440: $r->print("<img src=",$iconpath,"whitespace",$rem,".gif border=0>\n") if $rem > 0;
1.1 www 441: }
1.4 harris41 442:
1.1 www 443: $r->print("<img src=$iconpath$curfext.gif border=0>\n");
1.7 harris41 444: $r->print(" <a href=$filelink target='_blank'>",$listname,"</a>\n");
1.2 harris41 445:
1.4 harris41 446: $r->print (" (<a href=\"javascript:openWindow('".$filelink.".meta', 'metadatafile', '400', '450', 'no', 'yes')\"; TARGET=_self>metadata</a>) ") if ($metafile == 1);
1.2 harris41 447:
1.7 harris41 448: $r->print("</td>\n");
1.6 harris41 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;
1.2 harris41 453:
1.6 harris41 454: if ($hash{'display_attrs_3'} == 1) {
1.4 harris41 455: my $author = &Apache::lonnet::metadata($filelink,'author') if ($metafile == 1);
1.2 harris41 456: $author = ' ' if (!$author);
457: $r->print("<td bgcolor=$fileclr valign=bottom> ".$author." </td>\n");
458: }
1.6 harris41 459: if ($hash{'display_attrs_4'} == 1) {
1.4 harris41 460: my $keywords = &Apache::lonnet::metadata($filelink,'keywords') if ($metafile == 1);
1.2 harris41 461: $keywords = ' ' if (!$keywords);
462: $r->print("<td bgcolor=$fileclr valign=bottom> ".$keywords." </td>\n");
463: }
1.6 harris41 464: if ($hash{'display_attrs_5'} == 1) {
1.4 harris41 465: my $lang = &Apache::lonnet::metadata($filelink,'language') if ($metafile == 1);
1.2 harris41 466: $lang = $language{$lang};
467: $lang = ' ' if (!$lang);
468: $r->print("<td bgcolor=$fileclr valign=bottom> ".$lang." </td>\n");
469: }
1.1 www 470: $r->print("</tr>\n");
471: }
1.2 harris41 472: # -- display directory
1.1 www 473: if ($fnptr == $dirptr) {
474: my @file_ext = split (/\./,$listname);
475: my $curfext = $file_ext[scalar(@file_ext)-1];
1.2 harris41 476: my $curdir = $startdir.$filecom[0].'/';
1.3 harris41 477: my $anchor = $curdir;
478: $anchor =~ s/\///g;
1.7 harris41 479: $r->print("<tr>$extrafield<td bgcolor=$fileclr valign=bottom>");
1.2 harris41 480: &begin_form ($r,$curdir);
1.4 harris41 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");
1.1 www 490: $count++;
1.4 harris41 491: }
492: $r->print("<img src=",$iconpath,"whitespace",$rem,".gif border=0>\n") if $rem > 0;
1.1 www 493: }
1.3 harris41 494: $r->print ("<a name=\"$anchor\">\n<input src=\"$iconpath");
1.1 www 495: $r->print ("folder_pointer_closed.gif\"") if $diropen == 0;
496: $r->print ("folder_pointer_opened.gif\"") if $diropen == 1;
1.4 harris41 497: $r->print (" name=\"$msg\" height=\"22\" type=\"image\" border=\"0\">\n");
1.1 www 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: }
1.2 harris41 502:
1.1 www 503: }
504:
1.2 harris41 505: #---------------------prints the beginning of a form for directory or file link
1.1 www 506: sub begin_form {
507: my ($r,$uri) = @_;
1.3 harris41 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");
1.7 harris41 511: $r->print ("$hidden<input type=hidden name=openuri value=\"$uri\">\n");
1.1 www 512:
1.6 harris41 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: # }
1.1 www 516: }
517:
518: 1;
519: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>