Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2006, 11:54 AM
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default Tree Menu Based on Directories

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

 
Old October 31st, 2006, 12:26 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

www.obout.com

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old October 31st, 2006, 01:11 PM
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That would include registering dlls which isnt an option..

 So if i use the following code...

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>


<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("[list]" & 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 %>

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?

ps the page that is selected the options need to be for that page, so that page name will be needed.

Thanks

 
Old October 31st, 2006, 06:26 PM
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default


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?



 
Old November 1st, 2006, 08:42 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

All that is doing is iterating through the directory structure and writing out the values of the current file. I assume you have gotten that far. If this were .NET it would be alot eaiser because what you are going to have to is figure out a way to dynamically create a drop down box at a certain location in that tree.

Really I don't see an easy way to do this, if i sat down and worked with it I might be able to come up with an idea but im not sure.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature




Similar Threads
Thread Thread Starter Forum Replies Last Post
tree menu anjalisharma Hibernate 4 September 24th, 2007 05:04 AM
How to make the Tree View Menu in Javascript sandeep_akhare Other Programming Languages 2 January 30th, 2007 12:03 PM
traversing a tree based on an array of strings muki XSLT 1 February 16th, 2006 09:54 AM
PHP Tree menu muralik PHP Databases 1 March 23rd, 2004 09:54 PM
looping tree based on identical value of a child Kabe Classic ASP XML 0 March 17th, 2004 05:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.