Solved

Sortable table of directory details

Posted on 2002-05-27
5
179 Views
Last Modified: 2013-12-25
I want to be able to display details of a directory as a  HTML table. Columns would include file name, size, date modified etc. I would then like to allow the user to sort by a column, say size or date in ascending or descending order. I guess this means a CGI form. As this seems like a common task, I REALLY want to use some sort of tool or module., not program from scratch. I have looked at HTML::Table and CGI::FormBuilder. Any recommendations?
0
Comment
Question by:Kim Ryan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:samri
ID: 7038390
I doesn't seem to see any module to do that yet.  

But it can be achieved with a combination of
Modules - HTML::Table, File::List
Function - opendir, readdir, stat, sort

and of course, you might need Perl.

What is you OS, and webserver platform btw?




0
 
LVL 19

Author Comment

by:Kim Ryan
ID: 7038394
Am using Linux and perl. I already have the code to build the file stats, problem is just with presentation. I noticed that some directory listings like CPAN have a column heading you can click and the table resorts itself by that field. For example:

http://www.cpan.org/modules/by-module/Apache/BARRACODE/
has a HREF in the size column
http://www.cpan.org/modules/by-module/Apache/BARRACODE/?S=A
click it and you get results sorted by size ascending. Click it again (the HREF is now ?S=D) and it descends. Is this handled by the server, ie some httpd.conf setting for directory browsing?
0
 
LVL 15

Accepted Solution

by:
samri earned 200 total points
ID: 7038410
Yes, it was apache that does that.  Take a look at mod_autoindex http://httpd.apache.org/docs/mod/mod_autoindex.html

and make sure that the Directory directive is configured to allow directory browsing.  By default Apache is restrictive as not to allow dir browsing.

You can give it a try.

Alias /test "/somewhere/path"
<Directory "/somewhere/path">
     Options Indexes Multiviews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

good luck.
0
 
LVL 19

Author Comment

by:Kim Ryan
ID: 7038595
Thanks, I think I will just have to use perl to do some custom sorting
0
 
LVL 15

Expert Comment

by:samri
ID: 7038612
no. prob.,
0

Featured Post

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to dynamically set the form action using jQuery.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question