View Full Version : Need to Take a List of Strings add to array, then tree-it

08-19-2004, 02:15 AM
I have a list of folders generated by a server side loop, it outputs in the following format:.

<script>kcAddToArray('Sent Items');</script>
<script>kcAddToArray('Test Folder');</script>
<script>kcAddToArray('Test Folder/SubLevel -1');</script>
<script>kcAddToArray('Test Folder/SubLevel -1/SubSubLevel -1');</script>
<script>kcAddToArray('Test Folder/SubLevel -2');</script>

What I need to do is:
A) Figure out how to take each folder and add them to a common array.
B) Put them in some kind of NON-COLLAPSING tree (example follows).

USERNAME <--Added Elsewhere
|_Sent Items
|_Test Folder
| |_SubLevel -1
| | |_SubSubLevel -1
| |_SubLevel -2

C) Now for the biggie, it needs to support an infinite number of sub folders.

I would be gratefully appreciative for any assistance provided.

What I have been doing, is very different from how I would like it to be, This only work partway and not very well:

function kcTreeIt(kcDisplay)
kcLevel = kcDisplay.split("/");
var kcString = "";
var i;
for(i = 0; i <= kcLevel.length - 1; i ++)
if (i <= kcLevel.length - 2)
if (kcLevel.length > 0)
if (i >= 1)
kcString = kcString + "<img src='/nwimg/mail/KellCOMnet/gui/folderlist/fld_blank.png'>";
kcString = kcString + "<img src='/nwimg/mail/KellCOMnet/gui/folderlist/fld_left.png'>";
kcString = kcString + "<img src='/nwimg/mail/KellCOMnet/gui/folderlist/fld_sub.png'>";
kcString = kcString + " <a href=\"||action||\">" + kcLevel[kcLevel.length - 1] + "</a>";


08-19-2004, 02:48 AM
Have server side generate nested lists (www.vladdy.net/Demos/Tree.html) and go from there...

08-19-2004, 02:54 AM
Thank You for Your Reply,

But unfortunately that will not work, because the server side engine will only output the folder name with complete path as in "Root/Folder/SubFolder/SubSubfolder"

Any display has to be clientside the "kcAddToArray" is hardcoded