1 |
joko |
1.1 |
<?php |
2 |
|
|
/** |
3 |
|
|
Map a filesystem with HTML TreeMenu |
4 |
|
|
@author Tomas V.V.Cox <cox@idecnet.com> |
5 |
|
|
*/ |
6 |
|
|
require_once '../HTML_TreeMenu/TreeMenu.php'; |
7 |
|
|
$map_dir = '.'; |
8 |
|
|
$menu = new HTML_TreeMenu('menuLayer', 'images', '_self'); |
9 |
|
|
$menu->addItem(recurseDir($map_dir)); |
10 |
|
|
|
11 |
|
|
function &recurseDir($path) { |
12 |
|
|
if (!$dir = opendir($path)) { |
13 |
|
|
return false; |
14 |
|
|
} |
15 |
|
|
$files = array(); |
16 |
|
|
$node = &new HTML_TreeNode(basename($path), basename($path), 'folder.gif'); |
17 |
|
|
while (($file = readdir($dir)) !== false) { |
18 |
|
|
if ($file != '.' && $file != '..') { |
19 |
|
|
if (@is_dir("$path/$file")) { |
20 |
|
|
$addnode = &recurseDir("$path/$file"); |
21 |
|
|
} else { |
22 |
|
|
$addnode = &new HTML_TreeNode($file, $file, 'document2.png'); |
23 |
|
|
} |
24 |
|
|
$node->addItem($addnode); |
25 |
|
|
} |
26 |
|
|
} |
27 |
|
|
closedir($dir); |
28 |
|
|
return $node; |
29 |
|
|
} |
30 |
|
|
?> |
31 |
|
|
<html> |
32 |
|
|
<head> |
33 |
|
|
<script src="./css/sniffer.js" language="JavaScript" type="text/javascript"></script> |
34 |
|
|
<script src="./css/TreeMenu.js" language="JavaScript" type="text/javascript"></script> |
35 |
|
|
</head> |
36 |
|
|
<body> |
37 |
|
|
|
38 |
|
|
<div id="menuLayer"></div> |
39 |
|
|
<?$menu->printMenu()?> |
40 |
|
|
|
41 |
|
|
</body> |
42 |
|
|
</html> |