1 |
<?php |
2 |
|
3 |
/* |
4 |
this is a demo include file which displays all documents with links to |
5 |
their detail pages |
6 |
|
7 |
Usage: |
8 |
|
9 |
1) copy tree.php into .tree.php in root directory of |
10 |
your docman's repository |
11 |
|
12 |
2) write in .info.inc file: |
13 |
|
14 |
<a href="?A=I&F=tree">tree</a> |
15 |
|
16 |
and you will get tree view of your whole repository with links |
17 |
to file details |
18 |
|
19 |
Written by Dobrica Pavlinusic <dpavlin@rot13.org> 2001-12-15 |
20 |
*/ |
21 |
|
22 |
global $title,$text; |
23 |
|
24 |
$title = "Overview of all documents"; |
25 |
$text = "Here is general overview of all documents stored here"; |
26 |
|
27 |
class tree { |
28 |
var $h; |
29 |
var $out; |
30 |
|
31 |
function recurse($path) { |
32 |
$this->out.="<ul>\n"; |
33 |
$this->h=opendir($path); |
34 |
while ($file = readdir($this->h)) { |
35 |
if (substr($file,0,1) != ".") { |
36 |
if (is_dir("$path/$file")) { |
37 |
$this->out.="<li> <B>$file</b>"; |
38 |
$new_t=new tree(); |
39 |
$new_t->recurse("$path/$file"); |
40 |
$this->out.=$new_t->out; |
41 |
} else { |
42 |
//$this->out.="<li> $file\n"; |
43 |
$dir=substr($path,strlen($GLOBALS[gblFsRoot]),strlen($path)-strlen($GLOBALS[gblFsRoot])); |
44 |
$this->out.="<li> <a href=\"?A=E&F=".urlencode($file)."&D=".urlencode($dir)."\">$file</a>\n"; |
45 |
} |
46 |
} |
47 |
} |
48 |
closedir($this->h); |
49 |
$this->out.="</ul>\n"; |
50 |
} |
51 |
} |
52 |
|
53 |
$t=new tree(); |
54 |
$t->recurse($gblFsRoot); |
55 |
$text .= "<hr>\n".$t->out; |
56 |
|
57 |
?> |