index | search | no replies | posting guidelines | help login | register
Index » General » Site & Forum Feedback
search this forum:
:: TreeView Contents of Web Directory Not clicakable ::    show all messagesPost a New Message | Post a Reply
Jun 28 2006, 1:21 PM
 Re: TreeView Contents of Web Directory Not clic...Post a Reply
 joshuncc

View this author's profile Send this author a private message

since: Jun 28, 2006
from: somewhere

Okay, I decided to try to tackle this one on my own, and, well, I found a solution...

You will have to edit the file: clsTreeView.asp

Near the bottom you will find this:
-----------------------------------

    Private Sub ListFolderContents(objFolder,Parent)
        Dim objSubFolder, objFile    
        If Parent<>"0" Then
            Out ("<ul class=tree id=""N" & Parent & """>")
        Else
            Out ("<ul xstyle='margin-left:20px;' id=""N" & Parent & """>")
        End If    
        
        dim i
        For Each objSubFolder In objFolder.SubFolders
            Out("<li class=folder id=""P" & Parent & i & """><a class=treeview href=""javascript:toggle"& id &"('N" & Parent & "_" & i & "','P" & Parent & i & "')"">")
            Out objSubFolder.Name & "</a>"            
            Call ListFolderContents(objSubFolder,Parent & "_" & i)
            Out "</li>"
            i=i+1
        Next
        
        For Each objFile In objFolder.Files
            Out "<li class=file>" & objFile.Name & "</li>"
        Next
        
        Out "</ul>"
        
        Set objFile = Nothing
        Set objSubFolder = Nothing
    End Sub



-------------------------------------


I made some changes...here is the updated version below:

------------------------------------


    Private Sub ListFolderContents(objFolder,Parent)
        Dim objSubFolder, objFile    
        If Parent<>"0" Then
            Out ("<ul class=tree id=""N" & Parent & """>")
        Else
            Out ("<ul xstyle='margin-left:20px;' id=""N" & Parent & """>")
        End If    
        
        dim i
        For Each objSubFolder In objFolder.SubFolders
            Out("<li class=folder id=""P" & Parent & i & """><a class=treeview href=""javascript:toggle"& id &"('N" & Parent & "_" & i & "','P" & Parent & i & "')"">")
            Out objSubFolder.Name & "</a>"            
            Call ListFolderContents(objSubFolder,Parent & "_" & i)
            Out "</li>"
            i=i+1
        Next
        
        Dim url
        For Each objFile In objFolder.Files
            url = MapURL(objFile.path)
            Out "<li class=file><A href=""" & url & """>" & objFile.Name & "</A></li>"
        Next
        
        Out "</ul>"
        
        Set objFile = Nothing
        Set objSubFolder = Nothing
    End Sub
    
    function MapURL(path)
        dim rootPath, url
        
        'Convert a physical file path to a URL for hypertext links.
        
        rootPath = Server.MapPath("/")
        url = Right(path, Len(path) - Len(rootPath))
        MapURL = Replace(url, "\", "/")
    end function




-----------------------------------

As you can see, I added a MapURL funtion to the code.
I haven't attempted tinkering with the images though.

- Josh

Pages: (1)   [1]

search this forum: