You are here

README.txt in Filebrowser 5

Same filename and directory in other branches
  1. 8 README.txt
  2. 6 README.txt
  3. 7.4 README.txt
  4. 7.2 README.txt
  5. 7.3 README.txt
Drupal filebrowser.module README.txt
==============================================================================

The Drupal filebrowser.module allows site administrators to expose a
particular file system folder and all of its subfolders with a fancy
FTP-like interface to site visitors. File metainformation (via descript.ion
and files.bss) is supported. The module also allows these metafiles
to store special content, which can be parsed with a callback. If no
callback is specified in the file, only the description will be
fetched.

This module tries to protect your files outside of the public folder
from being listed, as well as trying to protect version control
and webserver metafiles (CVS and .svn folders, .htaccess files) from 
being listed, but there is no guarantee as usual, that this will 
never happen. If you find a bug, feel free to submit a bug report.

Installation
------------------------------------------------------------------------------
 
  - Copy filebrowser.info and filebrowser.module to your Drupal 
    sites/all/modules/filebrowser folder
  - Enable the module as usual on Drupal's admin page
  - Provide the module settings on the administer >> site configuration >> 
    filebrowser page
 
Configuration
------------------------------------------------------------------------------

  - You need to provide a root folder for filebrowser, from where the
    folder lists will be generated.
  - The icon folder should have icons for file types used. The icons
    should be named file-txt.png, file-gif.png, etc. The default
    icon used is file-default.png if an icon is not present for 
    a particular file extension. The icon used for all folders is 
    file-folder.png.
  - You should decide whether you are about to list the description files
    to visitors or not. This is up to you, depending on your usage scenario.
  - The module suggests a menu item, so you can set the menu item to show up. 
    The filebrowser interface is available anyway at '/filebrowser' 
    (or ?q=filebrowser if you don't use clean URLs)
    
Features
------------------------------------------------------------------------------

After enabling and configuring, the module has some basic features to browse
a folder of files, going deeper or back in the folder tree. There are some
nice additions though, which you can master to make the filebrowser output
a lot more useful.

  - icons displayed for files and folders (based on their extensions)
  - basic description shown for files and folders, possible to specify
    description for current folder shown as page help
  - possibility to use custom formatted description files (see below)
    with a parser callback function
  - possibility to style the file browser page different then other
    pages (the #filebrowser-page css ID is provided)
  - possibility to completely reformat the table through the 
    theme specific definition of theme_filebrowser_page
  - defined the hook_filebrowser_pre, so that your modules can provide
    information for filebrowser pages printed before the table (eg.
    file size or uptodate status stats, or global notices you intend
    to display on all filebrowser pages)

Description file format, and custom format parsing
------------------------------------------------------------------------------

The basic description file format is to have "filename description" pairs
on every line:

README.txt         Detailed information about the project
filebrowser.info   Module metafile
filebrowser.module Module source code

Multiple descriptions for a file are concatenated into one. You can also
have help for a folder, (which is displayed as Drupal help text) with
the special dot mark (which means the description for the current folder):

. This folder contains the sourcode and some simple documentation
. for the filebrowser module, which was developed for the
. <a href="http://drupal.hu">Hungarian Drupal Homepage</a> to help
. users browse among our translations.

HTML is also free to use in descriptions. This can be a problem if you
allow those to edit the descriptions, who don't know HTML well.

You can have custom formatted descriptions in a file, in case you provide
a callback to process the descriptions in the metafile itself. This allows
you to use any number of differently formatted files in your filebrowser
repository. Use the special *callback* name (asterisks included) to
specify the function name:

*callback* docstate_description_parser
README.txt Detailed information about the project | DRAFT

Notice the extended description. If the function provided is not found,
then the complete text will end up in the description. If the function
is found however, then it is used to get the table headers printed after
the filename and size (including the description), and the data printed
for each file. This function can be defined anywhere, but it needs to 
be available to Drupal, when the file descriptions are parsed. An
example:

function docstate_description_parser($description = NULL, $subfolder = '', $filename = '') {
  // Handle query to return the headers for the table
  if (!isset($description)) {
    return array(
      t('Description'), // field 4, not sortable
      array('data' => t('State'), 'field' => 5) // sortable
    );
  }
  
  // Not a custom description (eg. description for a file which can have no state)
  if (strpos($description, '|') === FALSE) {
    return array(
      $description,
      array('data' => '', 'sv' => -1) // -1 as sort value
    );
  }
  
  // Parse the custom description format
  list ($desc, $state) = array_map("trim", explode("|", $description));
  return array(
    $desc,
    array('data' => $state, 'sv' => $state) // these can be sorted by state
  );
}

Note that what you return are basic Drupal table row segments, which are
added up to the default columns provided by the module. The headers specify
the binding between the table headers and the fields used for ordering - if
ordering is desired. Here we need no ordering for description, but do provide
ordering for the state field. Then the 'sv' is the sort value, by which the
sort is performed. -1 makes the item go to the top in ascending sort and
to the bottom in descending short. This callback is invoked for every
description, so it is important to handle the regular descriptions, which
are used for some files even if descriptions for other files are custom
formatted. The first three fields provided by the module are the name,
size and last modified values, so custom field numbering starts from 4.

Credits / Contact
------------------------------------------------------------------------------

This module was created for the Hungarian Drupal Homepage as a browser
for our local Subversion repository, where we work on the interface
translations. The author of the module is Gabor Hojtsy (gabor[at]hojtsy.hu).

File

README.txt
View source
  1. Drupal filebrowser.module README.txt
  2. ==============================================================================
  3. The Drupal filebrowser.module allows site administrators to expose a
  4. particular file system folder and all of its subfolders with a fancy
  5. FTP-like interface to site visitors. File metainformation (via descript.ion
  6. and files.bss) is supported. The module also allows these metafiles
  7. to store special content, which can be parsed with a callback. If no
  8. callback is specified in the file, only the description will be
  9. fetched.
  10. This module tries to protect your files outside of the public folder
  11. from being listed, as well as trying to protect version control
  12. and webserver metafiles (CVS and .svn folders, .htaccess files) from
  13. being listed, but there is no guarantee as usual, that this will
  14. never happen. If you find a bug, feel free to submit a bug report.
  15. Installation
  16. ------------------------------------------------------------------------------
  17. - Copy filebrowser.info and filebrowser.module to your Drupal
  18. sites/all/modules/filebrowser folder
  19. - Enable the module as usual on Drupal's admin page
  20. - Provide the module settings on the administer >> site configuration >>
  21. filebrowser page
  22. Configuration
  23. ------------------------------------------------------------------------------
  24. - You need to provide a root folder for filebrowser, from where the
  25. folder lists will be generated.
  26. - The icon folder should have icons for file types used. The icons
  27. should be named file-txt.png, file-gif.png, etc. The default
  28. icon used is file-default.png if an icon is not present for
  29. a particular file extension. The icon used for all folders is
  30. file-folder.png.
  31. - You should decide whether you are about to list the description files
  32. to visitors or not. This is up to you, depending on your usage scenario.
  33. - The module suggests a menu item, so you can set the menu item to show up.
  34. The filebrowser interface is available anyway at '/filebrowser'
  35. (or ?q=filebrowser if you don't use clean URLs)
  36. Features
  37. ------------------------------------------------------------------------------
  38. After enabling and configuring, the module has some basic features to browse
  39. a folder of files, going deeper or back in the folder tree. There are some
  40. nice additions though, which you can master to make the filebrowser output
  41. a lot more useful.
  42. - icons displayed for files and folders (based on their extensions)
  43. - basic description shown for files and folders, possible to specify
  44. description for current folder shown as page help
  45. - possibility to use custom formatted description files (see below)
  46. with a parser callback function
  47. - possibility to style the file browser page different then other
  48. pages (the #filebrowser-page css ID is provided)
  49. - possibility to completely reformat the table through the
  50. theme specific definition of theme_filebrowser_page
  51. - defined the hook_filebrowser_pre, so that your modules can provide
  52. information for filebrowser pages printed before the table (eg.
  53. file size or uptodate status stats, or global notices you intend
  54. to display on all filebrowser pages)
  55. Description file format, and custom format parsing
  56. ------------------------------------------------------------------------------
  57. The basic description file format is to have "filename description" pairs
  58. on every line:
  59. README.txt Detailed information about the project
  60. filebrowser.info Module metafile
  61. filebrowser.module Module source code
  62. Multiple descriptions for a file are concatenated into one. You can also
  63. have help for a folder, (which is displayed as Drupal help text) with
  64. the special dot mark (which means the description for the current folder):
  65. . This folder contains the sourcode and some simple documentation
  66. . for the filebrowser module, which was developed for the
  67. . Hungarian Drupal Homepage to help
  68. . users browse among our translations.
  69. HTML is also free to use in descriptions. This can be a problem if you
  70. allow those to edit the descriptions, who don't know HTML well.
  71. You can have custom formatted descriptions in a file, in case you provide
  72. a callback to process the descriptions in the metafile itself. This allows
  73. you to use any number of differently formatted files in your filebrowser
  74. repository. Use the special *callback* name (asterisks included) to
  75. specify the function name:
  76. *callback* docstate_description_parser
  77. README.txt Detailed information about the project | DRAFT
  78. Notice the extended description. If the function provided is not found,
  79. then the complete text will end up in the description. If the function
  80. is found however, then it is used to get the table headers printed after
  81. the filename and size (including the description), and the data printed
  82. for each file. This function can be defined anywhere, but it needs to
  83. be available to Drupal, when the file descriptions are parsed. An
  84. example:
  85. function docstate_description_parser($description = NULL, $subfolder = '', $filename = '') {
  86. // Handle query to return the headers for the table
  87. if (!isset($description)) {
  88. return array(
  89. t('Description'), // field 4, not sortable
  90. array('data' => t('State'), 'field' => 5) // sortable
  91. );
  92. }
  93. // Not a custom description (eg. description for a file which can have no state)
  94. if (strpos($description, '|') === FALSE) {
  95. return array(
  96. $description,
  97. array('data' => '', 'sv' => -1) // -1 as sort value
  98. );
  99. }
  100. // Parse the custom description format
  101. list ($desc, $state) = array_map("trim", explode("|", $description));
  102. return array(
  103. $desc,
  104. array('data' => $state, 'sv' => $state) // these can be sorted by state
  105. );
  106. }
  107. Note that what you return are basic Drupal table row segments, which are
  108. added up to the default columns provided by the module. The headers specify
  109. the binding between the table headers and the fields used for ordering - if
  110. ordering is desired. Here we need no ordering for description, but do provide
  111. ordering for the state field. Then the 'sv' is the sort value, by which the
  112. sort is performed. -1 makes the item go to the top in ascending sort and
  113. to the bottom in descending short. This callback is invoked for every
  114. description, so it is important to handle the regular descriptions, which
  115. are used for some files even if descriptions for other files are custom
  116. formatted. The first three fields provided by the module are the name,
  117. size and last modified values, so custom field numbering starts from 4.
  118. Credits / Contact
  119. ------------------------------------------------------------------------------
  120. This module was created for the Hungarian Drupal Homepage as a browser
  121. for our local Subversion repository, where we work on the interface
  122. translations. The author of the module is Gabor Hojtsy (gabor[at]hojtsy.hu).