Supporting .htaccess configuration

macko - September 27, 2008 - 16:28
Project:Filebrowser
Version:HEAD
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:macko
Status:needs review
Description

Hi,

Looking at the other feature requests (displaying created/modified date, default sorting, icons), plus a few issues that I consider very important (being able to add header and footer message) -- these all need some kind of a config file.

Why not adopt a subset of apache's well-known, popular and documented .htaccess -- it has that all. I know that Filebrowser is primarily an FTP directory substitute, but I believe the features mentioned above are important, and it would be really nice if Filebrowser were not more limited than a http listing.

Filebrowser could look for .htaccess, or htaccess, and when found, read and support some part of it (for start, it could just handle AddDescription). AddDescription in .htaccess is actually more flexible as it allows for wildcards, but we could ignore this feature.

As an off-topic thing, I noticed that "human-readable" file sizes that are displayed in *nix programs (like ls -h) are much better (smarter algorithm to round numbers) than "human-readable" file sizes displayed in Filebrowser.

Cheers,

macko

#1

BENNYSOFT - October 1, 2008 - 08:02

being able to add header and footer message

You can add a header message by the descript.ion file.

I've used htaccess since many years and I like it. I would prefer htaccess syntax instead of descript.ion syntax ("Description text" file.ext).

#2

Susurrus - October 2, 2008 - 19:35

I think this is definitely something to look into, especially since .htaccess files might already exist for the relevant directories. Regarding the human-readable file sizes, however, you should bring that up with Drupal core, as I use a built-in Drupal function to convert bytes to human-readable strings.

Although this may be useful, I don't want to remove descript.ion functionality as that's been with this module for a long time. Also, the theming functionality exposed by this module should allow you to alter the display of the file listing page almost as much as you would like. Unless .htaccess exposes additional functionality outside of descript.ion and theme overriding, I can't see implementing support for it. AddDescription isn't enough to warrant the code and time spent.

#3

macko - October 8, 2008 - 20:54

Hmm, I think I am missing something... as far as I see it, supporting .htaccess is entirely independent from themes, just as descript.ion is.

.htaccess is only able to store more settings than descript.ion, including a few key items like what columns to display, what column order, what is the default sort, what are header and footer message files.

How is this related to theming?

#4

macko - December 4, 2008 - 16:53

OK, we have got this implemented (limited support for .htaccess, while the descript.ion file, if present, is considered more important - to ensure compatibility with older versions of Filebrowser).

How do we proceed? Commit to drupal svn or email new version to the maintainer?

#5

Susurrus - December 5, 2008 - 00:33

To get this reviewed, attach a patch. This is documentation describing the standard method to contributing here: http://drupal.org/patch

#6

macko - December 15, 2008 - 00:29
Assigned to:Anonymous» macko
Status:active» needs review

Here it is.

Supported features:

  • AddDescription <filename> "<description>" (no wildcards in filename supported)
  • HeaderName <filename>
  • ReadmeName <filename>
  • IndexOrderDefault (Ascending|Descending) (Name|Date|Size|Description)
  • IndexIgnore <filename_1> <filename_2> ... <filename_N>
  • IndexOptions [-+]?Suppress(Name|Date|Size|Description)

and, .htaccess files are not inherited from parent directories (as they are for apache).

Column names are case-insensitive, lines starting with # are ignored.

AttachmentSize
filebrowser.module.patch 12.86 KB

#7

macko - December 21, 2008 - 15:13

A few more improvements in this patch: date and size are no longer broken into lines, short time format is used.

A working sample available at

http://www.framsticks.com/dev/files

The original .htaccess file from apache (that is used on that site) starts with:

IndexIgnore .. .htaccess readme.html foot.html
IndexOptions FancyIndexing DescriptionWidth=* NameWidth=* SuppressHTMLPreamble
IndexOrderDefault Descending Date
HeaderName  readme.html
#ReadmeName  foot.html
AddDescription ...

AttachmentSize
filebrowser.module.patch 13.1 KB

#8

jbarns - April 9, 2009 - 19:34

is there a patch available for the newest version? I would like to show modified date.

Thanks!

#9

Yoran - April 13, 2009 - 07:08

Not yep, I'll try to integrate this as soon as I can

 
 

Drupal is a registered trademark of Dries Buytaert.