/[docman]/include_php/tree.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /include_php/tree.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Sun Dec 16 10:49:31 2001 UTC (22 years, 3 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +6 -1 lines
sort items, support for gblHide in config file

1 dpavlin 1.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 dpavlin 1.3 $hide_items=",$GLOBALS[gblHide],";
35     $dir_list=array();
36 dpavlin 1.1 while ($file = readdir($this->h)) {
37 dpavlin 1.3 if (substr($file,0,1) != "." && !strstr($hide_items,",$file,")) $dir_list[] = $file;
38     }
39     if (sizeof($dir_list) > 0) sort($dir_list);
40     while ($file = array_shift($dir_list)) {
41 dpavlin 1.1 if (substr($file,0,1) != ".") {
42     if (is_dir("$path/$file")) {
43 dpavlin 1.2 $link="<b>".$file."</b> <small>".ReadNote("$path/$file")."</small>";
44     $this->out.="<li> $link";
45 dpavlin 1.1 $new_t=new tree();
46     $new_t->recurse("$path/$file");
47     $this->out.=$new_t->out;
48     } else {
49     //$this->out.="<li> $file\n";
50     $dir=substr($path,strlen($GLOBALS[gblFsRoot]),strlen($path)-strlen($GLOBALS[gblFsRoot]));
51 dpavlin 1.2 $link=$file." <small>".ReadNote("$path/$file")."</small>";
52     $this->out.="<li> <a href=\"?A=E&F=".urlencode($file)."&D=".urlencode($dir)."\">$link</a>\n";
53 dpavlin 1.1 }
54     }
55     }
56     closedir($this->h);
57     $this->out.="</ul>\n";
58     }
59     }
60    
61     $t=new tree();
62     $t->recurse($gblFsRoot);
63     $text .= "<hr>\n".$t->out;
64     ?>

  ViewVC Help
Powered by ViewVC 1.1.26