Page 1 of 1

HTML based file browser

Posted: Wed 06 Jan 2010, 18:54
by ITAmember
I've been thinking about making a file browser and the idea of basing it on HTML hit me. What if I used the gtk-embed-mozilla widget, generated HTML based on the files in a folder, and then displayed this page. It would allow huge amounts of flexibility, frames, and scripting with javascript.

There could also be files in a folder defining how that folder is displayed, with custom HTML and javascript. You could make a media player folder for example, since music library navigation resembles file navigation this would work well. Using this method good looking multi-page control panels could also be made.

What do you guys think?

Posted: Wed 06 Jan 2010, 19:47
by bugman
i like it

i've always liked the way the kde browser does files and web together

Posted: Wed 06 Jan 2010, 22:50
by ITAmember
I've been messing with it a bit and it looks promising, but I'm afraid the large amount of javascript is going to be slow.

Posted: Wed 06 Jan 2010, 23:36
by Flash
Your idea sounds like a good one to me, especially if you can make the "back" arrow work as it does in SeaMonkey. Neither Windows Explorer nor ROX return to the exact same window as before when you click their back arrows. It's very annoying to me to have to resize the window, move it to where I had it, then scroll back to where I was in the window, every time I go back a level in ROX. Windows does return to the same size and (IIRC) location, but I still have to scroll the window back to where it was.

I know nothing about it, but still it seems to me that you might be reinventing the wheel, at least to some extent. Menu -> Internet -> PuppyBrowser web browser seems to be pretty fast. Maybe you could modify or extend it to do what you want. At least, by looking into it you might learn some tricks you hadn't thought of.

Posted: Thu 07 Jan 2010, 00:42
by ITAmember
I won't need to work on the GTK part until most of the DHTML is done, right now I'm just prototyping with a web browser.

I'll look into puppybrowser to. :)

Maybe I should use webkit instead of gecko for the HTML engine?

Posted: Thu 07 Jan 2010, 01:05
by mikeb
you want to reinvent the virus spreading joke that microsoft came up with in the nineties...I assume you are not being serious

mike

Posted: Thu 07 Jan 2010, 01:12
by ITAmember
I'll bite, what are you talking about? This program won't be any less secure then a web browser.

Posted: Thu 07 Jan 2010, 13:18
by mikeb
It makes me uncomfortable mixing html/web/file system after the disaster which was the integration of internet explorer into the operating system ...as long as you don't start with active x speak I will continue to sleep soundly :D .

Perhaps without the paranoia, reproducing the most annoying aspect of windows XP on linux does seem a little perverse.

I shall leave your thread in peace

mike

ps I was hoping someone could enable the thumbnail feature of gtk2 file browser for firefox/mozilla but no one bit that one :(

Posted: Thu 07 Jan 2010, 20:47
by disciple
That's the file selector dialogue you're talking about, right mike?

There are Firefox extensions to turn it into a file browser, but last time I checked they were very slow (unlike Konqueror).
But what ITAmember's talking about involves adding html content and stuff to folders, turning them into web pages. AFAIK that hasn't been done on Linux before, although it has been a feature of Windows since at least Win98. The thing is, I've never seen anyone actually use the feature... it's rare enough to find someone even putting special things on the Windows desktop.

Posted: Thu 07 Jan 2010, 21:23
by mikeb
That's the file selector dialogue you're talking about, right mike?
yes..more here...
http://www.murga-linux.com/puppy/viewtopic.php?t=50179
And I tried an addon too but as you say it was too slow.
although it has been a feature of Windows since at least Win98
when windows became a virus gateway.

Ok first I flame the subject now I'm hyjacking the thread...off topic in the off topic area...where's my spade?

mike

Posted: Fri 08 Jan 2010, 01:15
by technosaurus
You could write a bash wrapper for a lot of it, but then you would have to pick a wrapper extension that the browser can associate as a mimetype (.BROWSE for example) - here are some probably uninteligible streams of consciousness (probably not functional - just the idea of where to start to make it work)

associate .BROWSE with your script (lets say /usr/bin/browserbrowser)

for a directory link such as file:///usr/share/doc you would need the .BROWSER extension so it could build a new webpage when it is clicked
{to get only the directory name basename $1 .BROWSER}

ls -1 $DIRNAME > tmpfile
echo $HEADER > $DIRNAME/.$ONELINE.htm
for $ONELINE in tmpfile
if [ -d $DIRNAME/$ONELINE ]; then
echo "<a href="$DIRNAME/$ONELINE">$ONELINE</a>" >> $DIRNAME/.$ONELINE.htm
else
SUFFIX={I forget how to do this}
case $SUFFIX in ...
jpg,png,gif,...)
echo <img border="0" src="DIRNAME/$ONELINE" /></a> >> $DIRNAME/.$ONELINE.htm
mp4,avi,...)
echo "<EMBED type='application/x-mplayer2' src="$DIRNAME/$ONELINE" autostart="false" designtimesp='5311' loop="true"></EMBED>" >> $DIRNAME/.$ONELINE.htm

echo $FOOTER >> $DIRNAME/.$ONELINE.htm
#seamonkey -remote "OPENFILE($DIRNAME)"
#note that you may need to do it different for different browsers... you can use "`which firefox`" opera, dillo etc

EDIT Nevermind, Can't do it in the same window this way... unless you can refresh by sending CTRL+R to the open browser using the pidof the browser and a program that I can never remember the name of
Either way that would mean your script is actually browsing and keeping track of the the location and the webpage would be dynamically updated (not moving around in directories)

Posted: Fri 08 Jan 2010, 01:39
by technosaurus
If you wanted to get really quirky you could use a modified puppy web desktop as the header and even parse the /usr/share/applications/*.desktop to make a local browser menu
<a href="abiword.EXEC">abiword</a> where abiword.EXEC etc... is just a dummy file

STARTCOMMAND="`basename $1 .EXEC`"
$STARTCOMMAND

Posted: Fri 08 Jan 2010, 03:29
by ITAmember
I attached my progress thus far, but be warned it's just a patchwork of scripts I found. :P

Unzip + open "test.html"

Posted: Fri 08 Jan 2010, 03:57
by Flash
Hey, I note that in "test.html" the top-level directories are all open so they show their subdirectories.

I assume you opened each directory individually, one at a time. I've been wanting a way to toggle open all the directories at once, so they show their subdirectories but not the files those subdirectories contain. There is an application called "tree" which can do this. It's available for both Linux and Windows, in fact I think there's a .pet of it, but it's hard to use and the results don't look good without doing more work on them in a word processor. It would be great to have some aspects of tree incorporated into your file browser.

Posted: Fri 08 Jan 2010, 04:25
by ITAmember
Due to the general name of it my searches don't seem to turn up "tree". :) I'll keep looking but if you could find it that would help me out quite a bit.

If you open "drag-drop-folder-tree.html" and scroll to the bottom you will find a line that says

Code: Select all

treeObj.expandAll();
You can comment that out with the // comment and the tree will start collapsed. I'll eventually find a nice place to put a button/link that will toggle the expand/collapse state. I also don't plan on showing files in the treeview, that would make it rather crowded. Instead the user will click on the folder and view the contents in the main window. (which needs a lot of work :) )

Posted: Fri 08 Jan 2010, 04:38
by Flash
I don't remember who made these. I'm sure I got them from the Additional Software section of the forum.

Posted: Fri 08 Jan 2010, 20:37
by Pizzasgood
ITAmember wrote:Due to the general name of it my searches don't seem to turn up "tree". :) I'll keep looking but if you could find it that would help me out quite a bit.
http://www.murga-linux.com/puppy/viewtopic.php?t=47657

EDIT: Oh, I didn't realize there was a second page to this thread, so I didn't realize Flash already posted it.

Posted: Sat 09 Jan 2010, 03:32
by Flash
Thanks for finding the thread, Pizza. I didn't bother looking for it since I had the .pets at hand.

Here's an even earlier thread on tree, that I had bookmarked then forgot about. :oops: