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