1 |
joko |
1.1 |
<?php |
2 |
joko |
1.2 |
/** |
3 |
|
|
* This file contains the TreeNav_PearHtmlTreeMenuBridge class. |
4 |
|
|
* |
5 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
|
|
* @package org.netfrag.patches |
7 |
|
|
* @name DHTMLTreeNav |
8 |
|
|
* |
9 |
|
|
*/ |
10 |
|
|
|
11 |
|
|
/** |
12 |
|
|
* Cvs-Log: |
13 |
|
|
* |
14 |
joko |
1.3 |
* $Id: DHTMLTreeNav.inc,v 1.2 2003/05/13 16:29:11 joko Exp $ |
15 |
|
|
* |
16 |
|
|
* $Log: DHTMLTreeNav.inc,v $ |
17 |
|
|
* Revision 1.2 2003/05/13 16:29:11 joko |
18 |
|
|
* using built-in structure reader |
19 |
joko |
1.2 |
* |
20 |
|
|
* |
21 |
|
|
* Revision 1.1 2003/04/18 13:53:05 joko |
22 |
|
|
* from com.newsblob.phphtmllib/widgets |
23 |
|
|
* |
24 |
|
|
* Revision 1.2 2003/02/28 04:24:17 joko |
25 |
|
|
* disabled benchmarking |
26 |
|
|
* - purged old code |
27 |
|
|
* |
28 |
|
|
* Revision 1.1 2003/02/27 16:57:17 joko |
29 |
|
|
* + initial commit, inherits from BaseWidget, uses pear-bridge |
30 |
|
|
* |
31 |
|
|
* |
32 |
|
|
*/ |
33 |
|
|
|
34 |
|
|
/** |
35 |
|
|
* DHTMLTreeNav |
36 |
|
|
* |
37 |
|
|
* This is a phpHtmlLib extension class implementing nested trees. |
38 |
|
|
* |
39 |
|
|
* It inherits from phpHtmlLib's BaseWidget to be transparently spooled |
40 |
|
|
* down when rendering (->render!). |
41 |
|
|
* |
42 |
|
|
* It uses phpHtmlLib::TreeNav::PearHtmlTreeMenuBridge to access |
43 |
|
|
* some fine component libraries from PEAR to get things done. |
44 |
|
|
* |
45 |
|
|
* Please also visit its sister class phpHtmlLib::TreeNav::SelectNav, |
46 |
|
|
* which displays a nested tree flattened into a html-form "select" element. |
47 |
|
|
* |
48 |
|
|
* |
49 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
50 |
|
|
* @copyright (c) 2003 - All Rights reserved. |
51 |
|
|
* @license GNU LGPL (GNU Lesser General Public License) |
52 |
|
|
* |
53 |
|
|
* @link http://www.netfrag.org/~joko/ |
54 |
|
|
* @link http://www.gnu.org/licenses/lgpl.txt |
55 |
|
|
* |
56 |
|
|
* @package org.netfrag.patches |
57 |
|
|
* @subpackage phphtmllib::widgets |
58 |
|
|
* @name DHTMLTreeNav |
59 |
|
|
* |
60 |
|
|
* @link http://cvs.netfrag.org/php/libs/org.netfrag.patches |
61 |
|
|
* |
62 |
|
|
*/ |
63 |
joko |
1.1 |
class DHTMLTreeNav extends BaseWidget { |
64 |
|
|
|
65 |
|
|
var $pearbridge; |
66 |
|
|
var $menuobject; |
67 |
|
|
|
68 |
|
|
function DHTMLTreeNav(&$payload) { |
69 |
|
|
|
70 |
|
|
// pre-flight check |
71 |
|
|
if (!$payload) { |
72 |
|
|
user_error("DHTMLTreeNav: \$payload was empty."); |
73 |
|
|
return; |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
$args[payload] = &$payload; |
77 |
|
|
$args[type] = 'DHTML'; |
78 |
joko |
1.2 |
|
79 |
|
|
// NEW [2003-04-20]: use HTML_TreeMenu's builtin PEAR::Tree structure handler |
80 |
|
|
$args[converter] = 'builtin.kriesing'; |
81 |
|
|
|
82 |
joko |
1.1 |
$this->pearbridge = new TreeNav_PearHtmlTreeMenuBridge(&$args); |
83 |
|
|
$this->menuobject = $this->pearbridge->getMenuObject(); |
84 |
|
|
|
85 |
|
|
// initialize output the phpHtmlLib way |
86 |
joko |
1.2 |
$this->_init_output(); |
87 |
joko |
1.1 |
|
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
|
91 |
|
|
function _init_output() { |
92 |
|
|
|
93 |
|
|
/* |
94 |
|
|
// styling |
95 |
|
|
$this->add(' |
96 |
|
|
<style type="text/css"> |
97 |
|
|
body { |
98 |
|
|
font-family: Georgia; |
99 |
|
|
font-size: 11pt; |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
.treeMenuDefault { |
103 |
|
|
font-style: italic; |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
.treeMenuBold { |
107 |
|
|
font-style: italic; |
108 |
|
|
font-weight: bold; |
109 |
|
|
} |
110 |
|
|
</style> |
111 |
|
|
'); |
112 |
|
|
*/ |
113 |
|
|
|
114 |
|
|
$this->add('<script src="inc/js/TreeMenu.js" language="JavaScript" type="text/javascript"></script>'); |
115 |
|
|
|
116 |
|
|
/* |
117 |
|
|
// benchmarking - before |
118 |
|
|
$this->add(' |
119 |
|
|
<script language="JavaScript" type="text/javascript"> |
120 |
|
|
<!-- |
121 |
|
|
a = new Date(); |
122 |
|
|
a = a.getTime(); |
123 |
|
|
//--> |
124 |
|
|
</script> |
125 |
|
|
'); |
126 |
|
|
*/ |
127 |
|
|
|
128 |
|
|
$this->add($this->menuobject->toHTML()); |
129 |
|
|
|
130 |
|
|
/* |
131 |
|
|
// benchmarking - afterwards |
132 |
|
|
$this->add(' |
133 |
|
|
<script language="JavaScript" type="text/javascript"> |
134 |
|
|
<!-- |
135 |
|
|
b = new Date(); |
136 |
|
|
b = b.getTime(); |
137 |
|
|
|
138 |
|
|
document.write("Time to render tree: " + ((b - a) / 1000) + "s"); |
139 |
|
|
//--> |
140 |
|
|
</script> |
141 |
|
|
'); |
142 |
|
|
*/ |
143 |
|
|
|
144 |
|
|
} |
145 |
|
|
|
146 |
|
|
} |
147 |
|
|
|
148 |
|
|
?> |