| 1 | package Data::TreeDumper::Renderer::DHTML; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 1 | require Exporter; | |||||||||||
| 8 | 1 | ▶ | use AutoLoader qw(AUTOLOAD); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 1 | our @ISA = qw(Exporter); | |||||||||||
| 11 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw() ] ); | |||||||||||
| 12 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||||
| 13 | 1 | our @EXPORT = qw(); | |||||||||||
| 14 | |||||||||||||
| 15 | 1 | our $VERSION = '0.09'; | |||||||||||
| 16 | |||||||||||||
| 17 | 1 | ▶ | use constant DHTML_CLASS => 'data_treedumper_dhtml' ; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | |||||||||||||
| 19 | 1 | my $uuuid = int(rand(100_000)) ; | |||||||||||
| 20 | |||||||||||||
| 21 | 1 | my %ascii_to_html = | |||||||||||
| 22 | ( | ||||||||||||
| 23 | '<' => '<', | ||||||||||||
| 24 | '>' => '>', | ||||||||||||
| 25 | '&' => '&', | ||||||||||||
| 26 | "'" => ''', | ||||||||||||
| 27 | '"' => '"', | ||||||||||||
| 28 | ' ' => ' ', | ||||||||||||
| 29 | ) ; | ||||||||||||
| 30 | |||||||||||||
| 31 | #------------------------------------------------------------------------------------------- | ||||||||||||
| 32 | |||||||||||||
| 33 | sub GetRenderer | ||||||||||||
| 34 | 0 | ▶ | { | ||||||||||
|
Subroutine
GetRenderer: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 35 | 0 | my $expand_collapse_button_id = "expand_collapse_button_${uuuid}" ; | |||||||||||
| 36 | 0 | $uuuid++ ; | |||||||||||
| 37 | |||||||||||||
| 38 | 0 | my $search_button_id = "search_button_${uuuid}" ; | |||||||||||
| 39 | 0 | $uuuid++ ; | |||||||||||
| 40 | |||||||||||||
| 41 | return | ||||||||||||
| 42 | ( | ||||||||||||
| 43 | { | ||||||||||||
| 44 | 0 | BEGIN => \&RenderDhtmlBegin, | |||||||||||
| 45 | NODE => \&RenderDhtmlNode, | ||||||||||||
| 46 | END => \&RenderDhtmlEnd, | ||||||||||||
| 47 | |||||||||||||
| 48 | # data needed by the renderer | ||||||||||||
| 49 | EXPAND_COLLAPSE_BUTTON_ID => $expand_collapse_button_id, | ||||||||||||
| 50 | SEARCH_BUTTON_ID => $search_button_id, | ||||||||||||
| 51 | |||||||||||||
| 52 | PREVIOUS_LEVEL => -1, | ||||||||||||
| 53 | PREVIOUS_ADDRESS => "c_${uuuid}_ROOT", | ||||||||||||
| 54 | TABULATION => 0, | ||||||||||||
| 55 | @_, | ||||||||||||
| 56 | } | ||||||||||||
| 57 | ) ; | ||||||||||||
| 58 | } | ||||||||||||
| 59 | |||||||||||||
| 60 | |||||||||||||
| 61 | #------------------------------------------------------------------------------------------- | ||||||||||||
| 62 | |||||||||||||
| 63 | sub RenderDhtmlBegin | ||||||||||||
| 64 | 0 | ▶ | { | ||||||||||
|
Subroutine
RenderDhtmlBegin: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||
| 65 | 0 | my ($title, $td_address, $element, $perl_size, $perl_address, $setup) = @_ ; | |||||||||||
| 66 | |||||||||||||
| 67 | 0 | ▶ | my $class = $setup->{RENDERER}{CLASS} || DHTML_CLASS ; | ||||||||||
|
Condition0%0/2
$setup->{'RENDERER'}{'CLASS'} || 'data_treedumper_dhtml'
MC/DC0%0/1
$setup->{'RENDERER'}{'CLASS'} || 'data_treedumper_dhtml'
$setup->{'RENDERER'}{'CLASS'}
Truth table0%0/2
A
A= $setup->{'RENDERER'}{'CLASS'}
| |||||||||||||
| 68 | |||||||||||||
| 69 | 0 | my $button_container = '' ; | |||||||||||
| 70 | 0 | ▶ | if(exists $setup->{RENDERER}{BUTTON}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 71 | { | ||||||||||||
| 72 | 0 | $button_container .= "<div class='tdump_button_container'>\n" ; | |||||||||||
| 73 | |||||||||||||
| 74 | 0 | ▶ | if($setup->{RENDERER}{BUTTON}{COLLAPSE_EXPAND}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 75 | { | ||||||||||||
| 76 | 0 | ▶ | if($setup->{RENDERER}{COLLAPSED}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 77 | { | ||||||||||||
| 78 | 0 | $button_container .= " <input type='button' id='$setup->{RENDERER}{EXPAND_COLLAPSE_BUTTON_ID}' onclick='expand_collapse_${class}(true)' value='Expand'/>\n" ; | |||||||||||
| 79 | } | ||||||||||||
| 80 | else | ||||||||||||
| 81 | { | ||||||||||||
| 82 | 0 | $button_container .= " <input type='button' id='$setup->{RENDERER}{EXPAND_COLLAPSE_BUTTON_ID}' onclick='expand_collapse_${class}(true)' value='Collapse'/>\n" ; | |||||||||||
| 83 | } | ||||||||||||
| 84 | } | ||||||||||||
| 85 | |||||||||||||
| 86 | 0 | ▶ | if($setup->{RENDERER}{BUTTON}{SEARCH}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 87 | { | ||||||||||||
| 88 | 0 | $button_container .= " <input type='button' id='$setup->{RENDERER}{SEARCH_BUTTON_ID}' onclick='search_${class}()' value='Search'/>\n" ; | |||||||||||
| 89 | } | ||||||||||||
| 90 | |||||||||||||
| 91 | 0 | $button_container .= "</div>\n\n" ; | |||||||||||
| 92 | } | ||||||||||||
| 93 | |||||||||||||
| 94 | 0 | my $collapsed = '' ; | |||||||||||
| 95 | 0 | ▶ | if($setup->{RENDERER}{COLLAPSED}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 96 | { | ||||||||||||
| 97 | 0 | $collapsed = "ul.$class ul {display: none}" ; | |||||||||||
| 98 | } | ||||||||||||
| 99 | |||||||||||||
| 100 | 0 | my $style = <<EOS; | |||||||||||
| 101 | <style type='text/css' > | ||||||||||||
| 102 | .$class li {list-style-type:none ; margin:0 ; padding:0 ; line-height: 1em ;} | ||||||||||||
| 103 | |||||||||||||
| 104 | .$class ul {margin:0 ; padding:0 ;} | ||||||||||||
| 105 | ul.$class {font-family:monospace ; white-space: nowrap ;} | ||||||||||||
| 106 | |||||||||||||
| 107 | $collapsed | ||||||||||||
| 108 | |||||||||||||
| 109 | </style> | ||||||||||||
| 110 | EOS | ||||||||||||
| 111 | |||||||||||||
| 112 | 0 | ▶ | if(defined $setup->{RENDERER}{STYLE}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 113 | { | ||||||||||||
| 114 | 0 | ▶ | if('SCALAR' eq ref $setup->{RENDERER}{STYLE}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 115 | { | ||||||||||||
| 116 | 0 | ${$setup->{RENDERER}{STYLE}} = $style ; | |||||||||||
| 117 | 0 | $style = '' ; | |||||||||||
| 118 | } | ||||||||||||
| 119 | else | ||||||||||||
| 120 | { | ||||||||||||
| 121 | 0 | $style = $setup->{RENDERER}{STYLE} ; | |||||||||||
| 122 | } | ||||||||||||
| 123 | } | ||||||||||||
| 124 | |||||||||||||
| 125 | 0 | ▶ | $style = '' if(exists $setup->{RENDERER}{NO_STYLE}) ; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 126 | |||||||||||||
| 127 | 0 | ▶ | $perl_size = "<$perl_size>" if $perl_size ne '' ; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 128 | |||||||||||||
| 129 | 0 | ▶ | my $address = $setup->{DISPLAY_ADDRESS} ? "<a>[$td_address] </a>" : ''; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 130 | |||||||||||||
| 131 | 0 | my $header = <<EOH ; | |||||||||||
| 132 | <ul class = '$class'> | ||||||||||||
| 133 | <li class='$class'> | ||||||||||||
| 134 | <a id='a_${uuuid}_ROOT' href='javascript:void(0);' onclick='toggleList_${class}(\"$setup->{RENDERER}{PREVIOUS_ADDRESS}\")'>$title</a><a> $address $perl_size $perl_address</a> | ||||||||||||
| 135 | EOH | ||||||||||||
| 136 | |||||||||||||
| 137 | 0 | $setup->{RENDERER}{TABULATION} = 2 ; | |||||||||||
| 138 | 0 | push @{$setup->{RENDERER}{NODES}{A_IDS}}, "\"a_${uuuid}_ROOT\""; | |||||||||||
| 139 | 0 | push @{$setup->{RENDERER}{NODES}{COLLAPSABLE_IDS}}, "\"c_${uuuid}_ROOT\"" ; | |||||||||||
| 140 | |||||||||||||
| 141 | 0 | $setup->{RENDERER}{PREVIOUS_ADDRESS} = "c_${uuuid}_ROOT" ; | |||||||||||
| 142 | 0 | $uuuid++ ; | |||||||||||
| 143 | |||||||||||||
| 144 | 0 | return($style . $button_container . $header) ; | |||||||||||
| 145 | } | ||||||||||||
| 146 | |||||||||||||
| 147 | #------------------------------------------------------------------------------------------- | ||||||||||||
| 148 | |||||||||||||
| 149 | sub RenderDhtmlNode | ||||||||||||
| 150 | 0 | ▶ | { | ||||||||||
|
Subroutine
RenderDhtmlNode: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||
| 151 | my | ||||||||||||
| 152 | ( | ||||||||||||
| 153 | 0 | $element, | |||||||||||
| 154 | $level, | ||||||||||||
| 155 | $is_terminal, | ||||||||||||
| 156 | $previous_level_separator, | ||||||||||||
| 157 | $separator, | ||||||||||||
| 158 | $element_name, | ||||||||||||
| 159 | $element_value, | ||||||||||||
| 160 | $td_address, | ||||||||||||
| 161 | $address_link, | ||||||||||||
| 162 | $perl_size, | ||||||||||||
| 163 | $perl_address, | ||||||||||||
| 164 | $setup, | ||||||||||||
| 165 | ) = @_ ; | ||||||||||||
| 166 | |||||||||||||
| 167 | # HTMLify args | ||||||||||||
| 168 | 0 | my $glyph = '' ; | |||||||||||
| 169 | 0 | ▶ | unless ($setup->{RENDERER}{NO_GLYPH}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 170 | { | ||||||||||||
| 171 | 0 | $glyph = $previous_level_separator. $separator ; | |||||||||||
| 172 | 0 | $glyph =~ s/ / /g ; | |||||||||||
| 173 | } | ||||||||||||
| 174 | |||||||||||||
| 175 | 0 | ▶ | $perl_size = "<$perl_size>" if $perl_size ne '' ; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 176 | |||||||||||||
| 177 | 0 | ▶ | if($element_value ne '') | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 178 | { | ||||||||||||
| 179 | 0 | $element_value =~ s/(<|>|&|\'|\"|\ )/$ascii_to_html{$1}/eg ; | |||||||||||
| 180 | 0 | $element_value = " = $element_value" ; | |||||||||||
| 181 | } | ||||||||||||
| 182 | |||||||||||||
| 183 | #setup | ||||||||||||
| 184 | 0 | my $tabulation = $setup->{RENDERER}{TABULATION} ; | |||||||||||
| 185 | 0 | ▶ | my $class = $setup->{RENDERER}{CLASS} || DHTML_CLASS ; | ||||||||||
|
Condition0%0/2
$setup->{'RENDERER'}{'CLASS'} || 'data_treedumper_dhtml'
MC/DC0%0/1
$setup->{'RENDERER'}{'CLASS'} || 'data_treedumper_dhtml'
$setup->{'RENDERER'}{'CLASS'}
Truth table0%0/2
A
A= $setup->{'RENDERER'}{'CLASS'}
| |||||||||||||
| 186 | |||||||||||||
| 187 | 0 | my $node = '' ; | |||||||||||
| 188 | |||||||||||||
| 189 | # HTML list formating | ||||||||||||
| 190 | 0 | ▶ | if($level > $setup->{RENDERER}{PREVIOUS_LEVEL}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 191 | { | ||||||||||||
| 192 | 0 | ▶ | if($setup->{RENDERER}{COLLAPSED}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 193 | { | ||||||||||||
| 194 | 0 | $node = ' ' x $tabulation . "<ul id='$setup->{RENDERER}{PREVIOUS_ADDRESS}' style = 'display:none'>\n" ; | |||||||||||
| 195 | } | ||||||||||||
| 196 | else | ||||||||||||
| 197 | { | ||||||||||||
| 198 | 0 | $node = ' ' x $tabulation . "<ul id='$setup->{RENDERER}{PREVIOUS_ADDRESS}' style = 'display:block'>\n" ; | |||||||||||
| 199 | } | ||||||||||||
| 200 | |||||||||||||
| 201 | 0 | $tabulation++ ; | |||||||||||
| 202 | } | ||||||||||||
| 203 | else | ||||||||||||
| 204 | { | ||||||||||||
| 205 | 0 | ▶ | if($level < $setup->{RENDERER}{PREVIOUS_LEVEL}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 206 | { | ||||||||||||
| 207 | 0 | ▶ | for (my $i = 0 ; $i < $setup->{RENDERER}{PREVIOUS_LEVEL} - $level ; $i++) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 208 | { | ||||||||||||
| 209 | 0 | $tabulation-- ; | |||||||||||
| 210 | 0 | $node .= ' ' x $tabulation . "</ul>\n" ; | |||||||||||
| 211 | |||||||||||||
| 212 | 0 | $tabulation-- ; | |||||||||||
| 213 | 0 | $node .= ' ' x $tabulation . "</li>\n" ; | |||||||||||
| 214 | } | ||||||||||||
| 215 | } | ||||||||||||
| 216 | } | ||||||||||||
| 217 | |||||||||||||
| 218 | # keep nodes id for search | ||||||||||||
| 219 | 0 | push @{$setup->{RENDERER}{NODES}{A_IDS}}, "\"a_${uuuid}_$td_address\"" ; | |||||||||||
| 220 | |||||||||||||
| 221 | 0 | ▶ | if($is_terminal) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 222 | { | ||||||||||||
| 223 | 0 | my $list_format_head = ' ' x $tabulation . "<li>" ; | |||||||||||
| 224 | 0 | my $id = "<a id='a_${uuuid}_$td_address' name=\"$td_address\"></a>" ; | |||||||||||
| 225 | 0 | my $name_value = "<a> $glyph$element_name$element_value</a>" ; | |||||||||||
| 226 | |||||||||||||
| 227 | 0 | my $address = '' ; | |||||||||||
| 228 | 0 | ▶ | if($setup->{DISPLAY_ADDRESS}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 229 | { | ||||||||||||
| 230 | 0 | $address .= "<a> [$td_address</a>" ; | |||||||||||
| 231 | |||||||||||||
| 232 | 0 | ▶ | $address .= "<a> -> </a><a href=\"#$address_link\">$address_link</a>" if(defined $address_link) ; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 233 | |||||||||||||
| 234 | 0 | $address .= "<a> ]</a>" ; | |||||||||||
| 235 | } | ||||||||||||
| 236 | |||||||||||||
| 237 | 0 | my $perl_data = "<a> $perl_size $perl_address</a>" ; | |||||||||||
| 238 | 0 | my $list_format_foot = "</li>" ; | |||||||||||
| 239 | |||||||||||||
| 240 | 0 | $node .= $list_format_head . $id . $name_value . $address . $perl_data . $list_format_foot . "\n" ; | |||||||||||
| 241 | } | ||||||||||||
| 242 | else | ||||||||||||
| 243 | { | ||||||||||||
| 244 | 0 | ▶ | if($setup->{RENDERER}{BUTTON}{COLLAPSE_EXPAND}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 245 | { | ||||||||||||
| 246 | 0 | push @{$setup->{RENDERER}{NODES}{COLLAPSABLE_IDS}}, "\"c_${uuuid}_$td_address\"" ; | |||||||||||
| 247 | } | ||||||||||||
| 248 | |||||||||||||
| 249 | 0 | my $list_format_head = (' ' x $tabulation) . "<li>\n" ; | |||||||||||
| 250 | 0 | $tabulation++ ; | |||||||||||
| 251 | |||||||||||||
| 252 | 0 | my $alignment = ' ' x $tabulation ; | |||||||||||
| 253 | |||||||||||||
| 254 | 0 | my $id_and_click_head = "<a id='a_${uuuid}_$td_address' name='$td_address' href='javascript:void(0);' onclick='toggleList_${class}(\"c_${uuuid}_$td_address\")'>" ; | |||||||||||
| 255 | 0 | my $name_value = "$glyph$element_name$element_value" ; | |||||||||||
| 256 | 0 | my $id_and_click_foot = "</a>" ; | |||||||||||
| 257 | |||||||||||||
| 258 | 0 | ▶ | my $address = $setup->{DISPLAY_ADDRESS} ? "<a>[$td_address] </a>" : ''; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 259 | 0 | my $perl_data = "<a> $perl_size $perl_address</a>" ; | |||||||||||
| 260 | |||||||||||||
| 261 | 0 | $node .= $list_format_head . $alignment . $id_and_click_head . $name_value . $id_and_click_foot . $address . $perl_data . "\n"; | |||||||||||
| 262 | } | ||||||||||||
| 263 | |||||||||||||
| 264 | # setup | ||||||||||||
| 265 | 0 | $setup->{RENDERER}{TABULATION} = $tabulation ; | |||||||||||
| 266 | 0 | $setup->{RENDERER}{PREVIOUS_LEVEL} = $level ; | |||||||||||
| 267 | 0 | $setup->{RENDERER}{PREVIOUS_ADDRESS} = "c_${uuuid}_$td_address" ; | |||||||||||
| 268 | 0 | $uuuid++ ; | |||||||||||
| 269 | |||||||||||||
| 270 | 0 | return($node) ; | |||||||||||
| 271 | } | ||||||||||||
| 272 | |||||||||||||
| 273 | #------------------------------------------------------------------------------------------- | ||||||||||||
| 274 | |||||||||||||
| 275 | sub RenderDhtmlEnd | ||||||||||||
| 276 | 0 | ▶ | { | ||||||||||
|
Subroutine
RenderDhtmlEnd: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||
| 277 | 0 | my $setup = shift ; | |||||||||||
| 278 | |||||||||||||
| 279 | 0 | my $closing_ul_li = '' ; | |||||||||||
| 280 | 0 | my $tabulation = $setup->{RENDERER}{TABULATION} ; | |||||||||||
| 281 | |||||||||||||
| 282 | 0 | ▶ | for (my $i = 0 ; $i < $setup->{RENDERER}{PREVIOUS_LEVEL} ; $i++) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 283 | { | ||||||||||||
| 284 | 0 | $tabulation-- ; | |||||||||||
| 285 | 0 | $closing_ul_li .= ' ' x $tabulation . "</ul>\n" ; | |||||||||||
| 286 | |||||||||||||
| 287 | 0 | $tabulation-- ; | |||||||||||
| 288 | 0 | $closing_ul_li .= ' ' x $tabulation . "</li>\n" ; | |||||||||||
| 289 | } | ||||||||||||
| 290 | |||||||||||||
| 291 | 0 | ▶ | unless(exists $setup->{RENDERER}{BUTTON}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 292 | { | ||||||||||||
| 293 | 0 | "$closing_ul_li </ul> </li>\n</ul>\n" ; | |||||||||||
| 294 | } | ||||||||||||
| 295 | else | ||||||||||||
| 296 | { | ||||||||||||
| 297 | 0 | my $a_ids = join "\n\t\t, ", @{$setup->{RENDERER}{NODES}{A_IDS}} ; | |||||||||||
| 298 | 0 | my $collapsable_ids = join "\n\t\t\t\t, ", @{$setup->{RENDERER}{NODES}{COLLAPSABLE_IDS}} ; | |||||||||||
| 299 | |||||||||||||
| 300 | 0 | my $collapsed = 0 ; | |||||||||||
| 301 | 0 | ▶ | $collapsed++ if($setup->{RENDERER}{COLLAPSED}) ; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 302 | |||||||||||||
| 303 | 0 | ▶ | my $class = $setup->{RENDERER}{CLASS} || DHTML_CLASS ; | ||||||||||
|
Condition0%0/2
$setup->{'RENDERER'}{'CLASS'} || 'data_treedumper_dhtml'
MC/DC0%0/1
$setup->{'RENDERER'}{'CLASS'} || 'data_treedumper_dhtml'
$setup->{'RENDERER'}{'CLASS'}
Truth table0%0/2
A
A= $setup->{'RENDERER'}{'CLASS'}
| |||||||||||||
| 304 | |||||||||||||
| 305 | <<EOS | ||||||||||||
| 306 | $closing_ul_li | ||||||||||||
| 307 | </ul> | ||||||||||||
| 308 | </li> | ||||||||||||
| 309 | </ul> | ||||||||||||
| 310 | |||||||||||||
| 311 | <script type='text/javascript'> | ||||||||||||
| 312 | <!-- | ||||||||||||
| 313 | |||||||||||||
| 314 | var a_id_array_${class}= new Array | ||||||||||||
| 315 | ( | ||||||||||||
| 316 | $a_ids | ||||||||||||
| 317 | ) ; | ||||||||||||
| 318 | |||||||||||||
| 319 | function search_${class}() | ||||||||||||
| 320 | { | ||||||||||||
| 321 | var string_to_search = prompt('DTD::DHTML Search',''); | ||||||||||||
| 322 | var regexp = new RegExp(string_to_search, 'i') ; | ||||||||||||
| 323 | |||||||||||||
| 324 | var i ; | ||||||||||||
| 325 | for (i = 0; i < a_id_array_${class}.length; i++) | ||||||||||||
| 326 | { | ||||||||||||
| 327 | if (document.getElementById) | ||||||||||||
| 328 | { | ||||||||||||
| 329 | document.getElementById(a_id_array_${class}[i]).style.color = '' ; | ||||||||||||
| 330 | } | ||||||||||||
| 331 | else if (document.all) | ||||||||||||
| 332 | { | ||||||||||||
| 333 | document.all[a_id_array_${class}[0]].style.color = '' ; | ||||||||||||
| 334 | } | ||||||||||||
| 335 | else if (document.layers) | ||||||||||||
| 336 | { | ||||||||||||
| 337 | document.layers[a_id_array_${class}[0]].style.color = '' ; | ||||||||||||
| 338 | } | ||||||||||||
| 339 | } | ||||||||||||
| 340 | |||||||||||||
| 341 | for (i = 0 ; i < a_id_array_${class}.length; i++) | ||||||||||||
| 342 | { | ||||||||||||
| 343 | if (document.getElementById) | ||||||||||||
| 344 | { | ||||||||||||
| 345 | if(regexp.test(document.getElementById(a_id_array_${class}[i]).text)) | ||||||||||||
| 346 | { | ||||||||||||
| 347 | show_specific_node_${class}(document.getElementById(a_id_array_${class}[i])) ; | ||||||||||||
| 348 | document.getElementById(a_id_array_${class}[i]).style.color = '#FF0000' ; | ||||||||||||
| 349 | break ; | ||||||||||||
| 350 | } | ||||||||||||
| 351 | } | ||||||||||||
| 352 | else if (document.all) | ||||||||||||
| 353 | { | ||||||||||||
| 354 | if(regexp.test(document.all[a_id_array_${class}[0]].text)) | ||||||||||||
| 355 | { | ||||||||||||
| 356 | show_specific_node_${class}(document.all[a_id_array_${class}[0]]) ; | ||||||||||||
| 357 | break ; | ||||||||||||
| 358 | } | ||||||||||||
| 359 | } | ||||||||||||
| 360 | else if (document.layers) | ||||||||||||
| 361 | { | ||||||||||||
| 362 | if(regexp.test(document.layers[a_id_array_${class}[0]].text)) | ||||||||||||
| 363 | { | ||||||||||||
| 364 | show_specific_node_${class}(document.layers[a_id_array_${class}[0]]) ; | ||||||||||||
| 365 | break ; | ||||||||||||
| 366 | } | ||||||||||||
| 367 | } | ||||||||||||
| 368 | } | ||||||||||||
| 369 | } | ||||||||||||
| 370 | |||||||||||||
| 371 | function show_specific_node_${class} (node) | ||||||||||||
| 372 | { | ||||||||||||
| 373 | /* Hide all first.*/ | ||||||||||||
| 374 | collapsed_${class} = 0; | ||||||||||||
| 375 | expand_collapse_${class}(); | ||||||||||||
| 376 | |||||||||||||
| 377 | do | ||||||||||||
| 378 | { | ||||||||||||
| 379 | node = node.parentNode; | ||||||||||||
| 380 | |||||||||||||
| 381 | if (node && node.tagName == 'UL') | ||||||||||||
| 382 | node.style.display = 'block'; | ||||||||||||
| 383 | |||||||||||||
| 384 | } while (node && node.parentNode); | ||||||||||||
| 385 | } | ||||||||||||
| 386 | |||||||||||||
| 387 | var collapsable_id_array_${class} = new Array | ||||||||||||
| 388 | ( | ||||||||||||
| 389 | $collapsable_ids | ||||||||||||
| 390 | ) ; | ||||||||||||
| 391 | |||||||||||||
| 392 | var collapsed_${class} = $collapsed ; | ||||||||||||
| 393 | |||||||||||||
| 394 | function expand_collapse_${class}() | ||||||||||||
| 395 | { | ||||||||||||
| 396 | var style ; | ||||||||||||
| 397 | if(collapsed_${class}== 1) | ||||||||||||
| 398 | { | ||||||||||||
| 399 | collapsed_${class} = 0 ; | ||||||||||||
| 400 | style = "block" ; | ||||||||||||
| 401 | replace_button_text("$setup->{RENDERER}{EXPAND_COLLAPSE_BUTTON_ID}", "Collapse") ; | ||||||||||||
| 402 | } | ||||||||||||
| 403 | else | ||||||||||||
| 404 | { | ||||||||||||
| 405 | collapsed_${class} = 1 ; | ||||||||||||
| 406 | style = "none" ; | ||||||||||||
| 407 | replace_button_text("$setup->{RENDERER}{EXPAND_COLLAPSE_BUTTON_ID}", " Expand ") ; | ||||||||||||
| 408 | } | ||||||||||||
| 409 | |||||||||||||
| 410 | var i; | ||||||||||||
| 411 | for (i = 0; i < collapsable_id_array_${class}.length; i++) | ||||||||||||
| 412 | { | ||||||||||||
| 413 | if (document.getElementById) | ||||||||||||
| 414 | { | ||||||||||||
| 415 | document.getElementById(collapsable_id_array_${class}[i]).style.display = style ; | ||||||||||||
| 416 | } | ||||||||||||
| 417 | else if (document.all) | ||||||||||||
| 418 | { | ||||||||||||
| 419 | document.all[collapsable_id_array_${class}[i]].style.display = style ; | ||||||||||||
| 420 | } | ||||||||||||
| 421 | else if (document.layers) | ||||||||||||
| 422 | { | ||||||||||||
| 423 | document.layers[collapsable_id_array_${class}[i]].display = style ; | ||||||||||||
| 424 | } | ||||||||||||
| 425 | } | ||||||||||||
| 426 | } | ||||||||||||
| 427 | |||||||||||||
| 428 | function replace_button_text(buttonId, text) | ||||||||||||
| 429 | { | ||||||||||||
| 430 | if (document.getElementById) | ||||||||||||
| 431 | { | ||||||||||||
| 432 | var button=document.getElementById(buttonId); | ||||||||||||
| 433 | if (button) | ||||||||||||
| 434 | { | ||||||||||||
| 435 | if (button.childNodes[0]) | ||||||||||||
| 436 | { | ||||||||||||
| 437 | button.childNodes[0].nodeValue=text; | ||||||||||||
| 438 | } | ||||||||||||
| 439 | else if (button.value) | ||||||||||||
| 440 | { | ||||||||||||
| 441 | button.value=text; | ||||||||||||
| 442 | } | ||||||||||||
| 443 | else //if (button.innerHTML) | ||||||||||||
| 444 | { | ||||||||||||
| 445 | button.innerHTML=text; | ||||||||||||
| 446 | } | ||||||||||||
| 447 | } | ||||||||||||
| 448 | } | ||||||||||||
| 449 | } | ||||||||||||
| 450 | |||||||||||||
| 451 | function toggleList_${class}(tree_id) | ||||||||||||
| 452 | { | ||||||||||||
| 453 | if (document.getElementById) | ||||||||||||
| 454 | { | ||||||||||||
| 455 | var element = document.getElementById(tree_id); | ||||||||||||
| 456 | if (element) | ||||||||||||
| 457 | { | ||||||||||||
| 458 | if (element.style.display == 'none') | ||||||||||||
| 459 | { | ||||||||||||
| 460 | element.style.display = 'block'; | ||||||||||||
| 461 | } | ||||||||||||
| 462 | else | ||||||||||||
| 463 | { | ||||||||||||
| 464 | element.style.display = 'none'; | ||||||||||||
| 465 | } | ||||||||||||
| 466 | } | ||||||||||||
| 467 | } | ||||||||||||
| 468 | else if (document.all) | ||||||||||||
| 469 | { | ||||||||||||
| 470 | var element = document.all[tree_id]; | ||||||||||||
| 471 | |||||||||||||
| 472 | if (element) | ||||||||||||
| 473 | { | ||||||||||||
| 474 | if (element.style.display == 'none') | ||||||||||||
| 475 | { | ||||||||||||
| 476 | element.style.display = 'block'; | ||||||||||||
| 477 | } | ||||||||||||
| 478 | else | ||||||||||||
| 479 | { | ||||||||||||
| 480 | element.style.display = 'none'; | ||||||||||||
| 481 | } | ||||||||||||
| 482 | } | ||||||||||||
| 483 | } | ||||||||||||
| 484 | else if (document.layers) | ||||||||||||
| 485 | { | ||||||||||||
| 486 | var element = document.layers[tree_id]; | ||||||||||||
| 487 | |||||||||||||
| 488 | if (element) | ||||||||||||
| 489 | { | ||||||||||||
| 490 | if (element.display == 'none') | ||||||||||||
| 491 | { | ||||||||||||
| 492 | element.display = 'block'; | ||||||||||||
| 493 | } | ||||||||||||
| 494 | else | ||||||||||||
| 495 | { | ||||||||||||
| 496 | element.display = 'none'; | ||||||||||||
| 497 | } | ||||||||||||
| 498 | } | ||||||||||||
| 499 | } | ||||||||||||
| 500 | } | ||||||||||||
| 501 | |||||||||||||
| 502 | --> | ||||||||||||
| 503 | </script> | ||||||||||||
| 504 | EOS | ||||||||||||
| 505 | 0 | } | |||||||||||
| 506 | } | ||||||||||||
| 507 | |||||||||||||
| 508 | #------------------------------------------------------------------------------------------- | ||||||||||||
| 509 | 1 | 1 ; | |||||||||||
| 510 | |||||||||||||
| 511 | __END__ | ||||||||||||