Greetings,
I've been fiddling for a while getting the appearance of the directory listing to look exactly like I want it. My main issue was that the directory listing has a fixed size and width, and looks terrible on mobile devices like smart phones and tablets. Also, I discovered that the functionality to add icons for special file types is already coded in... but it appears that a bad link prevents the icons from showing up! Here is what I've found about customizing the file and directory listing on LibraryBox 2.0, on a TL-MR3040.
This is possible in a very basic way using custom CSS and the functionality already programmed in to the LibraryBox 2.0. Extra installations of PHP aren't necessary.
Here are some screenshots of the modified directory listing output:
(Desktop file listing)
(iPhone file listing)
How is this done?
·
Log into the LibraryBox using ssh, and modify the file /opt/piratebox/www/dir-generator.php.
o Change line 232:
<link
rel="stylesheet" href="css/bootstrap.css">
o To the CORRECT file
“/content/css/bootstrap.css”, or a custom CSS
file on your LibraryBox flash drive (example):
<link
rel="stylesheet" href=" /content/css/filelist.css">
o Create a CSS file
with the desired style at usb/LibraryBox/content/css/filelist.css
o Alternatively, you
can customize the other aspects and even the styles on the directory listing
page straight into the lower section of the “dir-generator.php” file
How to customize it using the styles I used in the above screenshots:
- Attached to this post is a zip file with a personalized "dir-generator.php" file and three custom CSS files. If you follow the below directions, your directory listing will appear like the one above
- First, put your LibraryBox USB drive into a computer and copy the "dir-generator.php" file from the attached file to the root folder of your drive. Copy the three CSS files into the folder LibraryBox/Content/css
- SSH into your LibraryBox. Copy the file "dir-generator.php" from the USB drive to the folder /opt/piratebox/www (ie, run the command: cp /mnt/usb/dir-generator.php /opt/piratebox/www)
- That replaced the default dir-generator.php file with the one I customized, which modifies the output of the directory listing and points to the three CSS files to style the output. It also activates the filetype icons and cleans up the file listing a little.
(The three CSS files use modified styles from the Bootstrap project and the Apaxy project).
Regards,
brendan