Author Topic: Flash Folder Tree  (Read 20348 times)

0 Members and 1 Guest are viewing this topic.

Offline Foggy

  • Tireless poster
  • ****
  • Posts: 806
    • View Profile
Flash Folder Tree
« on: November 20, 2007, 08:59:47 AM »
I've had some free time and decided I'd try and create a browseable folder tree. Here is what I have so far, again it uses the same files.lst file as the search I created but a newer version of it. So it will only show the folders that the current user has access to.
If you click on one of the folders it will take you to that folder so you must use the arrows to browse it.

You can see a preview of it HERE Note: The preview is not the most current version.

To use, just simply use the files.lst file and place the swf/html file somewhere in your vfs/template.

Comments/suggestions please. :)



The latest version I've made should work and have the following features.

  • Flash Cookies - Retain the directory structure between pages, so no need to redownload files.lst. It will check if the information is more than 1 hour old and redownload if necessary.
  • Auto Expand - Automatically expand to the current folder.
  • Default Files.lst - No longer needing the custom files.tpl file, Work off of the hfs default.
  • Manual Update - Right Click and select "Update" to redownload the files.lst and retrieve any changes in the vfs.
  • Clickable Folders - Double Click on the folder to open it in the current window. One click will Expand/Minimize the folder.
  • Restricted Access - Automatically updates when logged in user changes and protected folders become avaliable.

Auto Expand: To use the auto expand you have to pass the current url to the tree either by a querystring or flashvars in a variable called "current_location". I recommend the use of flashvars as that way the .swf is cached and not redownloaded every time the user changes the page.

Restricted Access: You need to pass the name of the current user to the tree same way as you do with the url, but this time inside the "user" variable.

you can use this code as an example to automatically send the variable if you are calling it from the template and not the html file.
Quote from: Example TPL Code
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="550" height="400">
<param name="movie" value="relative path to folder tree.swf">
<param name="quality" value="high">
<param name="FlashVars" value="current_location=http://%host%%folder%&user=%user%">
<embed src="relative path to folder tree.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400" flashvars="current_location=http://%host%%folder%&user=%user%"></embed>
</object>
« Last Edit: December 06, 2007, 12:42:02 PM by Foggy »

Offline ELEVENNNN

  • Tireless poster
  • ****
  • Posts: 257
  • havent been here lately, still wont be here?
    • View Profile
Re: Flash Folder Tree
« Reply #1 on: November 20, 2007, 10:44:32 AM »
woo hoo! I like it. Great work foggy, thanks for the time.  It works perfectly and has endless potential, and though its simplistic it does the job and looks much better than the search imo.

Thanks
Posted on: November 20, 2007, 06:30:23 PM
Hmm..

Quote
%files%

[files]
<?xml version="1.0" encoding="iso-8859-1"?>
<list>
%list%</list>

[file]
   <item url="%encoded-folder%%item-url%" name="%item-name%" type="file"/>
[folder]
   <item url="%encoded-folder%%item-url%" name="%item-name%" type="folder"/>

Right now im just using exactly what you gave me and I havent had any luck.  I moved over the html and flash file to the root and replaced the tpl file with the one in my hfs root. ( I want to embed it to work along the side first ).  Is this the same issue, do I need to enable compressed browsing or anything?

As of now it loads the flash file and its empty.
Posted on: November 20, 2007, 06:40:33 PM
This works great now.  I'm not sure if the result will be the same for others, but my problem was the filelist.tpl... I had to physically move or delete the originally filelist.tpl (in my case from Terayon) and then move over the other filelist.tpl from the zip/rar.. a simple overwrite left a cached file (of sorts) and it would not work.

Good work Josh, and thanks for your time again.. going to bed.
This is going to take a long time
.................+...........................................
...................+.............+.................+.........
......................................

Offline TSG

  • Operator
  • Tireless poster
  • *****
  • Posts: 1934
    • View Profile
    • RAWR-Designs
Re: Flash Folder Tree
« Reply #2 on: November 20, 2007, 11:29:11 AM »
 ::) 3 posts in a row elevennnn? I will merge them for you  :-\.

Ye this is a nice idea with room to build upon :)

Offline Unknown8063

  • Occasional poster
  • *
  • Posts: 96
    • View Profile
Re: Flash Folder Tree
« Reply #3 on: November 20, 2007, 04:06:07 PM »
Oh very nice.  Great work Foggy!

Offline Foggy

  • Tireless poster
  • ****
  • Posts: 806
    • View Profile
Re: Flash Folder Tree
« Reply #4 on: November 22, 2007, 06:13:18 AM »
I have made a couple changes that will reduce the amount of processing needed on the client side and the size of the xml file used to generate the tree. Just download the folder tree.zip from the first post and its the same as the first version.

Edit: With the changes I made hfs is now only transferring 6000bytes instead of 43000 bytes for my vfs, so that is quite an improvement especially if you have lots of files and not many folders.
« Last Edit: November 22, 2007, 06:30:34 AM by Foggy »

Offline ELEVENNNN

  • Tireless poster
  • ****
  • Posts: 257
  • havent been here lately, still wont be here?
    • View Profile
Re: Flash Folder Tree
« Reply #5 on: November 22, 2007, 07:39:51 AM »
I'm not sure if this is after or before we talked but I'm still looking for it calling that folder only when you click an arrow instead of running a recursive search (45 seconds within lan:X) each time.

Its really nice that your working on this for everyone, I tested it with an insane amount of files and indeed it does work.  Downloading new one now.

@TSG, Thanks for sorting.  Usually after posting I go look at other post and don't realize that I've posted a few times in a row.
This is going to take a long time
.................+...........................................
...................+.............+.................+.........
......................................

Offline Foggy

  • Tireless poster
  • ****
  • Posts: 806
    • View Profile
Re: Flash Folder Tree
« Reply #6 on: November 22, 2007, 10:18:30 AM »
I'm looking into making it use a non recursive file list but if I can figure it out it will take some time, In the mean time though I think I might be able to make flash store the xml on the local machine by using a kind of flash cookie. Which if works would mean that the user would only have to download the filelist once per session instead of each time the folder tree is called.
Posted on: 22 November 2007, 09:31:43
I can now cache the xml used to create the tree structure, so each time the folder tree is called it will not download a recursive filelist from the server. It will only download a file list when the old one is 1 hour or older. I will update the first post again with the new version.

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12949
    • View Profile
Re: Flash Folder Tree
« Reply #7 on: November 22, 2007, 03:05:59 PM »
this is a very cool thing.

since build #145 the standard filelist.tpl HAS folders. they are excluded by the listing through the url filter. so you won't need to ask people to install the customized one. ;)

Offline Foggy

  • Tireless poster
  • ****
  • Posts: 806
    • View Profile
Re: Flash Folder Tree
« Reply #8 on: November 22, 2007, 09:22:28 PM »
Thanks rejetto, but unfortunately the default one will not work because I do not know of a way to make flash read it. The customized filelist I use with this generates an xml page.

Offline TSG

  • Operator
  • Tireless poster
  • *****
  • Posts: 1934
    • View Profile
    • RAWR-Designs
Re: Flash Folder Tree
« Reply #9 on: November 23, 2007, 04:17:13 AM »
hmm, true... i wonder if we can get flash to convert the default strings to xml for us, you can create hidden xml sheets within flash itself... by splitting the url up to give us the url var and then unescaping the last item in the URL to give the name var... is that all that is needed? cause then all you have to do is build your own xml strings, i have some code that might help.

[file]
<item url="%encoded-folder%%item-url%" name="%item-name%"/>
[folder]
<item url="%encoded-folder%%item-url%" name="%item-name%"/>

Offline Foggy

  • Tireless poster
  • ****
  • Posts: 806
    • View Profile
Re: Flash Folder Tree
« Reply #10 on: November 23, 2007, 09:15:38 AM »
Currently it already builds its own xml in the structure of the vfs to output it correctly on the tree, the problem I have with using the default filelist is I dont know how to import it into something flash can read with out using a var= at the very start of it.

Edit: I was just thinking and thought I should explain a little more how it it works currently. Currently because the fielist I use is only 2 nodes deep I get the url attribute and split it into sections at every "/" to get the different folders. I then use  or so loops to loop through the split urls to either create a new node or go one node deeper in a new xml that is then used to populate the tree. The folder names are just that section of url decoded. So I'm thinking it sounds very easy to adapt it for use on the default tpl, I just need to know how to import the data so I can get all the urls in one array.
Posted on: November 23, 2007, 02:09:57 PM
I just got it to use the default filelist and finished perfecting how it remebers the file structure after finding some bugs. :P

I have to goto work now, so ill post it up later for all to see.

Offline ELEVENNNN

  • Tireless poster
  • ****
  • Posts: 257
  • havent been here lately, still wont be here?
    • View Profile
Re: Flash Folder Tree
« Reply #11 on: November 24, 2007, 07:24:48 AM »
Great work with the flash cookie, that was what was holding me back from downloading it before.  This has potential to be widely used; sorry the search didnt work out but it was made at a bad time (because rejetto's was just days away)

Keep up the good work.
Be on more tomorrow, staying at someones place with dial up, yuck :X
This is going to take a long time
.................+...........................................
...................+.............+.................+.........
......................................

Offline bacter

  • Operator
  • Tireless poster
  • *****
  • Posts: 682
    • View Profile
Re: Flash Folder Tree
« Reply #12 on: November 24, 2007, 10:29:20 AM »
I'm working on an implementation to create the tree with java script, and the biggest problem is to get the list into the template also in my case.

I now create a list on localhost with the filelst.tpl as an array, then I have to save the displayed list as a .js file and edit it a bit to correct the tree levels to get it to work properly.

I think we could ask rejetto to add a option filename &out= with the execution of filelst.tpl

href="~files.lst?recursive&out=/sys/%user%.js"

that instead of responding with the .lst file would write the output to /sys/%user%.js in our vfs, and would respond with the page where invoked from, once the .js is created.

This feature could also be usefull for other purposes when we need to construct an array of files in our templates.

┬┐what do you think about such a feature?
your computer has no brain - use your own !

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1879
    • View Profile
Re: Flash Folder Tree
« Reply #13 on: November 24, 2007, 11:27:01 AM »
Thought you of using a frame to show the list of directories with  ?recursive&folder-filter=*&file-filter=\*  and when we click on a directory the contents appears in another frame, simply but effective with a minimum of javascript, and so no external file are needed, all of work is make on the client browser. in tour template you can make a special section to this use.

Offline Foggy

  • Tireless poster
  • ****
  • Posts: 806
    • View Profile
Re: Flash Folder Tree
« Reply #14 on: November 24, 2007, 01:06:42 PM »
bacter try using /files.lst.js?recursive&folder-filter I discovered that I could add .xml to the end and it would work so maybe .js will work too. If you would like to know how I got the files.lst into the tree I can send you the source file because flash and javascript are very similar.