[rt-users] Simple directory listing within a Callback

Todd Chapman todd at chaka.net
Sun Apr 9 12:56:07 EDT 2006


On Sun, Apr 09, 2006 at 06:40:55PM +0200, David Elze wrote:
> Hi, 
> 
> within a callback, I'm calling a file that contains an iframe that
> should display a directory listing. The directory has its +Indexes in
> httpd.conf but doesn't get displayed, instead I get a 404 and the
> following error message in my apache error.log:
> 
> [error] [Mason] File does not
> exist: /var/www/htdocs/rt/html/foo/bar/index.html/
> 
> So it seems that the mason handler wants to call a file index.html
> instead of just display the content of the directory 'bar'. I tried to
> set a default handler for that location in my httpd.conf but the mason
> error remains.
> 
> Is there any possibility to tell mason not to search for a index.html
> for that specific directory or can I disable mason for the directory or
> is there any other way to display files (contained in a directory)
> inside of RT? 
> 
> Thanks for any hint or something :-)
> 

Directory indexes are for when a directory is requested
from the server. They also return an entire HTML page.

What you want (and probably exists somewhere in the
Mason community) is a component that takes a directory
as an argument and produces the listing for you.

It would look something like this:

% for my $entry ( @ls ) {
<% $entry %>
% }
<%INIT>
open(DIR, $dir);
my @ls = readdir DIR:
close DIR;
</%INIT>
<%ARGS>
$dir
</%ARGS>

And you would call it like this:

<& MyComponent, dir => 'foo/bar' &>


-Todd



More information about the rt-users mailing list