Expandable and Collapsible Directory Structure Tree

Discussion in 'C#' started by red_fiesta, Oct 31, 2006.

  1. #1
    I want to create a Expandable and Collapsible Directory Structure Tree.

    So that it looks at a folder from a path i give it and shows all directories and files underneath it.

    This sub directories needs to be expandable and collapsable and when i click on on of the options it will bring a select box up by the side of this giving options. ie edit page.

    is this clear?

    please help

    Thanks
     
    red_fiesta, Oct 31, 2006 IP
  2. red_fiesta

    red_fiesta Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    So if i use the following code...

    <%@ LANGUAGE="VBScript" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>ASP Directory Listing Demo</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="/common/default.css" />
    <link rel="stylesheet" type="text/css" href="jstree/mktree.css">
    <script type="text/javascript" src="jstree/mktree.js"></script>
    
    </head>
    <body>
     
    
    
    </div>
    
    <!-- List these three folders. -->
    <ul  class="mktree" id="tree1">
    <% ListFolderContents(Server.MapPath("/site/craig/CSS")) %>
    
    
    </ul>
    
    </body>
    </html>
    
    <% sub ListFolderContents(path)
    
         dim fs, folder, file, item, url
    
         set fs = CreateObject("Scripting.FileSystemObject")
         set folder = fs.GetFolder(path)
    
        'Display the target folder and info.
    
         Response.Write("<li><b>" & folder.Name & "</b> - " _
           & folder.Files.Count & " files ")
         if folder.SubFolders.Count > 0 then
           Response.Write(folder.SubFolders.Count & " directories ")
         end if
        
    
         Response.Write("<ul>" & vbCrLf)
    
         'Display a list of sub folders.
    
         for each item in folder.SubFolders
           ListFolderContents(item.Path)
         next
    
         'Display a list of files.
    
         for each item in folder.Files
           url = MapURL(item.path)
           Response.Write("<li><a href=""" & url & """>" & item.Name & "</a> " _
             
             & "</li>" & vbCrLf)
         next
    
         Response.Write("</ul>" & vbCrLf)
    
         Response.Write("</li>" & vbCrLf)
    
       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 %>
    
    
    Code (markup):
    I can see the folder i want and it expands and closes

    Now instead of opening the file when i click on it i want it to give a select box next to it to allow me to choose what i want to do

    ie
    add page below
    edit page
    delete page ..

    and so on

    any ideas?

    Thanks
     
    red_fiesta, Oct 31, 2006 IP
  3. red_fiesta

    red_fiesta Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Maybe i havent described what i am trying to do properly

    if one looks at this page...

    http://www.brainjar.com/asp/dirlist/demo.asp

    one can see a menu structure.

    I want to be able to change what happens when one clicks on a page

    at the moment it opens the page

    i want it to put a select dropdown box by it that has options

    so an javascript call is made on the click of the link and gives options..

    i am just not sure how to do it...

    any clearer?
     
    red_fiesta, Oct 31, 2006 IP