line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Menu::TreeView; |
2
|
8
|
|
|
8
|
|
4399
|
use strict; |
|
8
|
|
|
|
|
58
|
|
|
8
|
|
|
|
|
234
|
|
3
|
8
|
|
|
8
|
|
38
|
use warnings; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
220
|
|
4
|
|
|
|
|
|
|
require Exporter; |
5
|
8
|
|
|
8
|
|
184
|
use 5.00600; |
|
8
|
|
|
|
|
27
|
|
6
|
8
|
|
|
8
|
|
4818
|
use utf8; |
|
8
|
|
|
|
|
115
|
|
|
8
|
|
|
|
|
39
|
|
7
|
|
|
|
|
|
|
use vars |
8
|
8
|
|
|
8
|
|
464
|
qw($DefaultClass %EXPORT_TAGS @EXPORT_OK @ISA %anker @TreeView %openArrays @caption $columns $clasic $ffirst $sort $border $orderby $size $style $orderbyColumn $prefix $bTrOver $desc %anker %ankerG $lang); |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
5844
|
|
9
|
|
|
|
|
|
|
$HTML::Menu::TreeView::VERSION = '1.22'; |
10
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
11
|
|
|
|
|
|
|
@HTML::Menu::TreeView::EXPORT_OK = |
12
|
|
|
|
|
|
|
qw(border Tree css columns jscript setStyle setDocumentRoot getDocumentRoot setSize setClasic clasic preload help folderFirst size style Style documentRoot loadTree saveTree %anker %ankerG sortTree orderBy orderByColumn prefix setModern border TrOver desc language); |
13
|
|
|
|
|
|
|
%HTML::Menu::TreeView::EXPORT_TAGS = ( |
14
|
|
|
|
|
|
|
'all' => [ |
15
|
|
|
|
|
|
|
qw(Tree css jscript clasic columns preload help folderFirst size documentRoot loadTree saveTree sortTree orderBy prefix Style orderByColumn border TrOver desc language) |
16
|
|
|
|
|
|
|
], |
17
|
|
|
|
|
|
|
'recommend' => [qw(Tree css jscript clasic preload folderFirst help size Style documentRoot loadTree saveTree sortTree prefix desc)], |
18
|
|
|
|
|
|
|
'standart' => [qw(Tree css jscript preload size Style documentRoot clasic)], |
19
|
|
|
|
|
|
|
'backward' => [qw(setDocumentRoot getDocumentRoot setSize setClasic setStyle style setModern)], |
20
|
|
|
|
|
|
|
'columns' => [qw(border columns orderByColumn orderBy)], |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
$DefaultClass = 'HTML::Menu::TreeView' unless defined $HTML::Menu::TreeView::DefaultClass; |
23
|
|
|
|
|
|
|
our $id = 'a'; |
24
|
|
|
|
|
|
|
our $path = '/var/www/htdocs'; |
25
|
|
|
|
|
|
|
our $saveFile = './TreeViewDump.pl'; |
26
|
|
|
|
|
|
|
$lang = 'en'; |
27
|
|
|
|
|
|
|
$style = 'Crystal'; |
28
|
|
|
|
|
|
|
$size = 16; |
29
|
|
|
|
|
|
|
( $clasic, $ffirst, $sort, $border, $columns, $desc, $bTrOver ) = (0) x 7; |
30
|
|
|
|
|
|
|
$orderby = 'text'; |
31
|
|
|
|
|
|
|
$prefix = ''; |
32
|
|
|
|
|
|
|
%anker = ( |
33
|
|
|
|
|
|
|
name => 'The name of the Element', |
34
|
|
|
|
|
|
|
href => 'URI for linked resource', |
35
|
|
|
|
|
|
|
accesskey => 'accessibility key character', |
36
|
|
|
|
|
|
|
charset => 'char encoding of linked resource', |
37
|
|
|
|
|
|
|
class => 'class name or set of class names to an element.', |
38
|
|
|
|
|
|
|
coords => 'for use with client-side image maps', |
39
|
|
|
|
|
|
|
dir => 'the base direction of directionally neutral text', |
40
|
|
|
|
|
|
|
hreflang => 'language code', |
41
|
|
|
|
|
|
|
lang => 'the base language of an elements attribute values and text content.', |
42
|
|
|
|
|
|
|
onblur => 'the element lost the focus', |
43
|
|
|
|
|
|
|
ondblclick => 'event occurs when the pointing device button is double clicked ', |
44
|
|
|
|
|
|
|
onclick => 'event occurs when the pointing device button is clicked over an element', |
45
|
|
|
|
|
|
|
onfocus => 'the element got the focus', |
46
|
|
|
|
|
|
|
onkeydown => 'event occurs when a key is pressed down over an element.', |
47
|
|
|
|
|
|
|
onkeypress => 'event occurs when a key is pressed and released over an element.', |
48
|
|
|
|
|
|
|
onkeyup => 'event occurs when a key is released over an element.', |
49
|
|
|
|
|
|
|
onmousedown => 'event occurs when the pointing device button is pressed over an element.', |
50
|
|
|
|
|
|
|
onmousemove => 'event occurs when the pointing device is moved while it is over an element.', |
51
|
|
|
|
|
|
|
onmouseout => 'event occurs when the pointing device is moved away from an element.', |
52
|
|
|
|
|
|
|
onmouseover => 'event occurs when the pointing device is moved onto an element.', |
53
|
|
|
|
|
|
|
onmouseup => 'event occurs when the pointing device button is released over an element.', |
54
|
|
|
|
|
|
|
rel => 'forward link types', |
55
|
|
|
|
|
|
|
rev => 'reverse link types', |
56
|
|
|
|
|
|
|
shape => 'for use with client-side image maps', |
57
|
|
|
|
|
|
|
style => 'specifies style information for the current element.', |
58
|
|
|
|
|
|
|
tabindex => 'position in tabbing order', |
59
|
|
|
|
|
|
|
target => 'target frame information', |
60
|
|
|
|
|
|
|
type => 'advisory content type ', |
61
|
|
|
|
|
|
|
title => 'element title', |
62
|
|
|
|
|
|
|
id => 'This attribute assigns a name to an element. This name must be unique in a document.', |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
%ankerG = ( |
65
|
|
|
|
|
|
|
name => 'Name des Links', |
66
|
|
|
|
|
|
|
href => 'Adresse die aufgerufen wird', |
67
|
|
|
|
|
|
|
accesskey => 'Zugriffstaste', |
68
|
|
|
|
|
|
|
charset => 'Zeichenkodierung der Zieladresse', |
69
|
|
|
|
|
|
|
class => 'Klassen Name', |
70
|
|
|
|
|
|
|
coords => 'Für Imagemaps', |
71
|
|
|
|
|
|
|
dir => 'Leserichtung', |
72
|
|
|
|
|
|
|
hreflang => 'Sprache des Ziels', |
73
|
|
|
|
|
|
|
lang => 'Sprache des Inhaltes', |
74
|
|
|
|
|
|
|
onblur => 'Anker verliert den Fokus', |
75
|
|
|
|
|
|
|
ondblclick => 'Maus wird doppelgeklickt', |
76
|
|
|
|
|
|
|
onclick => 'Maus wird geklickt', |
77
|
|
|
|
|
|
|
onfocus => 'Link erhält den Fokus', |
78
|
|
|
|
|
|
|
onkeydown => 'Eine Taste wird gedrückt.', |
79
|
|
|
|
|
|
|
onkeypress => 'Eine Taste wird gedrückt', |
80
|
|
|
|
|
|
|
onkeyup => 'Eine Taste wird los gelassen', |
81
|
|
|
|
|
|
|
onmousedown => 'Maus wird gedrückt', |
82
|
|
|
|
|
|
|
onmousemove => 'Maus wird bewegt', |
83
|
|
|
|
|
|
|
onmouseout => 'Maus verlässt den Anker', |
84
|
|
|
|
|
|
|
onmouseover => 'Maus betritt den Anker', |
85
|
|
|
|
|
|
|
onmouseup => 'Maus wird losgelassen', |
86
|
|
|
|
|
|
|
rel => 'Logische Vorwärtsbeziehung siehe selfhtml', |
87
|
|
|
|
|
|
|
rev => 'Logische Rückwärtsbeziehung', |
88
|
|
|
|
|
|
|
shape => 'Imagemaps', |
89
|
|
|
|
|
|
|
style => 'Formatierungs Informationen', |
90
|
|
|
|
|
|
|
tabindex => 'Tabstopp position', |
91
|
|
|
|
|
|
|
target => 'Ziel Frame Angabe', |
92
|
|
|
|
|
|
|
type => 'Content-type', |
93
|
|
|
|
|
|
|
title => 'Titel', |
94
|
|
|
|
|
|
|
id => 'Identifikator. Muss einmalig im Dokument sein', |
95
|
|
|
|
|
|
|
); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 NAME |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
HTML::Menu::TreeView - Create a HTML TreeView from scratch |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SYNOPSIS |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
use HTML::Menu::TreeView qw(Tree); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
my @tree =( { |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
text => 'Folder', |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
subtree => [ |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
{ |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
text => 'treeview Homepage', |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
href => 'http://lindnerei.sourceforge.net' |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
], |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
},); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Tree(\@tree); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 OO Syntax |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
use HTML::Menu::TreeView; |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
use strict; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
my @tree =( |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
{ |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
image => 'tar.png', |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
text => 'Node' |
138
|
|
|
|
|
|
|
}, |
139
|
|
|
|
|
|
|
); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
my $Treeview = new HTML::Menu::TreeView(); |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
print $Treeview->css("/srv/www/httpdocs"); |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
print $Treeview->jscript(); |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
print $Treeview->preload(); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
print $Treeview->Tree(\@tree); |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 FO Syntax |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
use HTML::Menu::TreeView qw(css jscript preload Tree); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
print css(); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
print jscript(); |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
print preload(); |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
print Tree(\@tree,"Crystal"); |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 function sets |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Here is a list of the function sets you can import: |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
:all |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Tree css jscript clasic preload help folderFirst size documentRoot loadTree saveTree sortTree orderBy prefix Style orderByColumn border desc language |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
:recommend |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Tree css jscript clasic preload folderFirst size Style documentRoot loadTree saveTree sortTree prefix desc |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
:standart |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Tree css jscript preload size Style documentRoot clasic, |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
:backward |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
setDocumentRoot getDocumentRoot setSize setClasic setStyle style setModern |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
:columns |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
border columns orderByColumn orderBy |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 DESCRIPTION |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
HTML::Menu::TreeView is a Modul to build an Html TreeView. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 Changes |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
1.19 |
195
|
|
|
|
|
|
|
required perl Version Build.pm and css img class |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
1.18 |
198
|
|
|
|
|
|
|
like 1.17 but at some other places |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
1.17 |
201
|
|
|
|
|
|
|
#defined @{@$tree[$i]->{subtree}} don't works with perl > 5.20 |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
so try test it with ref @$tree[$i]->{subtree}[0]. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
1.14 |
206
|
|
|
|
|
|
|
after a few years there a only a few bugfixes. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
1.13 |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Sorting of closed folders will work now. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
1.12 |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
some fixes (German umlaute help()) |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
1.10 |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Overwrought |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
1.08 |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
delete one unnessesary file. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
1.07 |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Drag & drop example edit.pl |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
new css class dropzone |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Overwrought Documentation |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Overwrought Images |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
1.06 |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
svn moved to http://lindnerei.svn.sourceforge.net/viewvc/lindnerei/treeview/ |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
new Images, german Help |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
language function set it to "de" for german help |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
german documentation droped |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Build install_examples |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head1 Public |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head2 new |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
if you use the oo interface you can say: |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
my $TreeView = new HTML::Menu::TreeView(\@tree, optional style); |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
and then call Tree without arguments. |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
print $TreeView->Tree(); |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=cut |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
sub new { |
261
|
49
|
|
|
49
|
1
|
1267
|
my ( $class, @initializer ) = @_; |
262
|
49
|
|
|
|
|
123
|
my $self = { tree => undef, }; |
263
|
49
|
|
33
|
|
|
222
|
bless $self, ref $class || $class || $DefaultClass; |
264
|
49
|
50
|
|
|
|
112
|
$style = $initializer[1] if ( defined $initializer[1] ); |
265
|
49
|
100
|
|
|
|
111
|
@TreeView = $initializer[0] if (@initializer); |
266
|
49
|
|
|
|
|
157
|
return $self; |
267
|
|
|
|
|
|
|
} ## end sub new |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head2 css |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
return the necessary css part without tag. |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
you can set the DocumentRoot if you pass a parameter |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
css('/document/root/'); |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
you can also include it with: |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
for example. |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=cut |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
sub css { |
286
|
1
|
|
|
1
|
1
|
4
|
my ( $self, @p ) = getSelf(@_); |
287
|
8
|
|
|
8
|
|
62
|
use Fcntl qw(:flock); |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
878
|
|
288
|
8
|
|
|
8
|
|
3832
|
use Symbol; |
|
8
|
|
|
|
|
6335
|
|
|
8
|
|
|
|
|
3047
|
|
289
|
1
|
50
|
|
|
|
3
|
$self->documentRoot( $p[0] ) if ( defined $p[0] ); |
290
|
1
|
|
|
|
|
5
|
my $fh = gensym; |
291
|
1
|
|
|
|
|
18
|
my $file = "$path/style/$style/$size/html-menu-treeview/$style.css"; |
292
|
1
|
50
|
|
|
|
45
|
open $fh, $file |
293
|
|
|
|
|
|
|
or warn "HTML::Menu::TreeView::css $/ no style '$style.css' $style.css found $/ in $path/style/html-menu-treeview/$style/ $/ $! $/"; |
294
|
1
|
|
|
|
|
9
|
seek $fh, 0, 0; |
295
|
1
|
|
|
|
|
263
|
my @lines = <$fh>; |
296
|
1
|
|
|
|
|
14
|
close $fh; |
297
|
1
|
|
|
|
|
5
|
my $css; |
298
|
|
|
|
|
|
|
|
299
|
1
|
|
|
|
|
3
|
foreach my $l (@lines) { |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
# $l =~ s?/style/?style/?g; |
302
|
491
|
|
|
|
|
726
|
$css .= $l; |
303
|
|
|
|
|
|
|
} ## end foreach my $l (@lines) |
304
|
1
|
|
|
|
|
53
|
return $css; |
305
|
|
|
|
|
|
|
} ## end sub css |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=head2 documentRoot |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
set or get the Document Root. |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
default: this variable is set during make. |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=cut |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
sub documentRoot { |
316
|
5
|
|
|
5
|
1
|
32
|
my ( $self, @p ) = getSelf(@_); |
317
|
5
|
100
|
|
|
|
19
|
if ( defined $p[0] ) { |
318
|
4
|
50
|
|
|
|
74
|
if ( -e $p[0] ) { $path = $p[0]; } |
|
4
|
|
|
|
|
31
|
|
319
|
|
|
|
|
|
|
else { |
320
|
0
|
|
|
|
|
0
|
warn "HTML::Menu::TreeView::documentRoot $/ Document Root don't exits: $/ $! $/"; |
321
|
|
|
|
|
|
|
} ## end else [ if ( -e $p[0] ) ] |
322
|
|
|
|
|
|
|
} else { |
323
|
1
|
|
|
|
|
7
|
return $path; |
324
|
|
|
|
|
|
|
} ## end else [ if ( defined $p[0] ) ] |
325
|
|
|
|
|
|
|
} ## end sub documentRoot |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=head2 jscript |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
return the necessary javascript without |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
you can set the Document Root if you pass a parameter |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=cut |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
sub jscript { |
340
|
4
|
|
|
4
|
1
|
26
|
my ( $self, @p ) = getSelf(@_); |
341
|
8
|
|
|
8
|
|
67
|
use Fcntl qw(:flock); |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
1122
|
|
342
|
8
|
|
|
8
|
|
80
|
use Symbol; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
1694
|
|
343
|
4
|
50
|
|
|
|
13
|
$self->documentRoot( $p[0] ) if ( defined $p[0] ); |
344
|
4
|
|
|
|
|
15
|
my $fh = gensym; |
345
|
4
|
|
|
|
|
65
|
my $file = "$path/style/treeview.js"; |
346
|
4
|
50
|
|
|
|
141
|
open $fh, $file or warn "HTML::Menu::TreeView::jscript $/ $! $/"; |
347
|
4
|
|
|
|
|
38
|
seek $fh, 0, 0; |
348
|
4
|
|
|
|
|
252
|
my @js = <$fh>; |
349
|
4
|
|
|
|
|
38
|
close $fh; |
350
|
4
|
|
|
|
|
101
|
return "@js"; |
351
|
|
|
|
|
|
|
} ## end sub jscript |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=head2 preload |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
return the necessary javascript for preloading images without |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
or |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
if you use different images sizes. |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
you can set the DocumentRoot if you pass a parameter |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=cut |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
sub preload { |
372
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @p ) = getSelf(@_); |
373
|
8
|
|
|
8
|
|
67
|
use Fcntl qw(:flock); |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
897
|
|
374
|
8
|
|
|
8
|
|
67
|
use Symbol; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
13962
|
|
375
|
0
|
0
|
|
|
|
0
|
$self->documentRoot( $p[0] ) if ( defined $p[0] ); |
376
|
0
|
|
|
|
|
0
|
my $fh = gensym; |
377
|
0
|
|
|
|
|
0
|
my $file = "$path/style/$style/$size/html-menu-treeview/preload.js"; |
378
|
0
|
0
|
|
|
|
0
|
open $fh, $file or warn "HTML::Menu::TreeView::preload $/ $! $/"; |
379
|
0
|
|
|
|
|
0
|
seek $fh, 0, 0; |
380
|
0
|
|
|
|
|
0
|
my @lines = <$fh>; |
381
|
0
|
|
|
|
|
0
|
close $fh; |
382
|
0
|
|
|
|
|
0
|
my $preload; |
383
|
|
|
|
|
|
|
|
384
|
0
|
|
|
|
|
0
|
foreach my $l (@lines) { |
385
|
0
|
|
|
|
|
0
|
$l =~ s?/style/?style/?g; |
386
|
0
|
|
|
|
|
0
|
$preload .= $l; |
387
|
|
|
|
|
|
|
} ## end foreach my $l (@lines) |
388
|
0
|
|
|
|
|
0
|
return $preload; |
389
|
|
|
|
|
|
|
} ## end sub preload |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=head2 size |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
only for Crystal styles |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
set or get the size. |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
16,32,48,64 and 128 are possible values. |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=cut |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
sub size { |
402
|
13
|
|
|
13
|
1
|
35
|
my ( $self, @p ) = getSelf(@_); |
403
|
13
|
100
|
100
|
|
|
71
|
if ( defined $p[0] && $p[0] =~ /(16|22|32|48|64|128)/ ) { $size = $1; } |
|
5
|
|
|
|
|
26
|
|
404
|
8
|
|
|
|
|
48
|
else { return $size; } |
405
|
|
|
|
|
|
|
} ## end sub size |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=head2 Style |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
set the style in scalar context or get in void context. |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
Style('simple'); |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
simple = redmond like style. |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
Crystal = Crystal style (default). |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=cut |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
sub Style { |
420
|
9
|
|
|
9
|
1
|
501
|
my ( $self, @p ) = getSelf(@_); |
421
|
9
|
100
|
|
|
|
24
|
if ( defined $p[0] ) { |
422
|
4
|
50
|
|
|
|
85
|
if ( -e $path . '/style/' . $p[0] ) { $style = $p[0]; } |
|
4
|
|
|
|
|
23
|
|
423
|
|
|
|
|
|
|
else { |
424
|
0
|
|
|
|
|
0
|
warn "HTML::Menu::TreeView::Style $/ $path/style/$p[0] not found $/ $! $/"; |
425
|
|
|
|
|
|
|
} ## end else [ if ( -e $path . '/style/'...)] |
426
|
|
|
|
|
|
|
} else { |
427
|
5
|
|
|
|
|
39
|
return $style; |
428
|
|
|
|
|
|
|
} ## end else [ if ( defined $p[0] ) ] |
429
|
|
|
|
|
|
|
} ## end sub Style |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=head2 Tree |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
Tree(\@tree,optional $style); |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
Returns the html part of the Treeview without javasript and css. |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=cut |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
sub Tree { |
440
|
10
|
|
|
10
|
1
|
456
|
my ( $self, @p ) = getSelf(@_); |
441
|
10
|
50
|
|
|
|
28
|
$style = $p[1] if ( defined $p[1] ); |
442
|
10
|
100
|
|
|
|
38
|
@TreeView = @p ? @p : @TreeView; |
443
|
10
|
50
|
|
|
|
54
|
$self->initTree(@TreeView) if (@TreeView); |
444
|
10
|
|
|
|
|
20
|
my $r; |
445
|
10
|
50
|
|
|
|
31
|
if ( defined $self->{subtree} ) { |
446
|
0
|
|
|
|
|
0
|
$r .= qq("; |
456
|
|
|
|
|
|
|
} ## end if ( defined $self->{subtree...}) |
457
|
|
|
|
|
|
|
$r .= |
458
|
10
|
|
|
|
|
35
|
qq();
459
|
10
|
50
|
|
|
|
28
|
if (@caption) { #defined |
460
|
0
|
0
|
|
|
|
0
|
my $class = $border ? "captionBorder$size" : "caption$size"; |
461
|
0
|
|
|
|
|
0
|
$r .= qq( | | $caption[0] | );
462
|
|
|
|
|
|
|
} ## end if (@caption) |
463
|
10
|
|
|
|
|
66
|
$r .= $self->{tree} . ' | | ';
464
|
10
|
50
|
|
|
|
35
|
if ( defined $self->{subtree} ) { |
465
|
0
|
|
|
|
|
0
|
$r .= ' | ';
466
|
0
|
0
|
|
|
|
0
|
if (@caption) { #defined |
467
|
0
|
0
|
|
|
|
0
|
my $class = $border ? "captionBorder$size" : "caption$size"; |
468
|
0
|
|
|
|
|
0
|
$r .= ' | ';
469
|
0
|
|
|
|
|
0
|
for ( my $i = 1 ; $i <= $#caption ; $i++ ) { |
470
|
0
|
|
|
|
|
0
|
$r .= qq( | $caption[$i] | );
471
|
|
|
|
|
|
|
} ## end for ( my $i = 1 ; $i <=...) |
472
|
0
|
|
|
|
|
0
|
$r .= ' | ';
473
|
|
|
|
|
|
|
} ## end if (@caption) |
474
|
0
|
|
|
|
|
0
|
undef @caption; |
475
|
0
|
|
|
|
|
0
|
$r .= $self->{subtree} . ' | | ';
476
|
|
|
|
|
|
|
} ## end if ( defined $self->{subtree...}) |
477
|
10
|
|
|
|
|
34
|
$r .= ' | '; |
478
|
10
|
|
|
|
|
79
|
return $r; |
479
|
|
|
|
|
|
|
} ## end sub Tree |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
=head2 clasic |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
enable clasic node decoration: |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
clasic(1); |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
disable clasic node decoration: |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
clasic(0); |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
return the status in void context. |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
$status = clasic(); |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
=cut |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
sub clasic { |
498
|
2
|
|
|
2
|
1
|
6
|
my ( $self, @p ) = getSelf(@_); |
499
|
2
|
50
|
33
|
|
|
7
|
if ( defined $p[0] && $p[0] =~ /(0|1)/ ) { $clasic = $1; } |
|
0
|
|
|
|
|
0
|
|
500
|
2
|
|
|
|
|
10
|
else { return $clasic; } |
501
|
|
|
|
|
|
|
} ## end sub clasic |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
=head2 columns |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
set number of columns |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
columns(3); |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
return the count in void context. |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
$count = columns(); |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
or set the captions for the columns |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
columns("Name","Column 1","Column 2","Column 3"); |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=cut |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
sub columns { |
520
|
2
|
|
|
2
|
1
|
12
|
my ( $self, @p ) = getSelf(@_); |
521
|
2
|
50
|
66
|
|
|
19
|
if ( defined $p[0] && $p[0] =~ /(\d+)/ && $#p == 0 ) { $columns = $1; } |
|
0
|
100
|
66
|
|
|
0
|
|
522
|
|
|
|
|
|
|
elsif ( $#p > 0 ) { |
523
|
1
|
|
|
|
|
3
|
$columns = $#p + 1; |
524
|
1
|
|
|
|
|
5
|
@caption = @p; |
525
|
|
|
|
|
|
|
} else { |
526
|
1
|
|
|
|
|
7
|
return $columns; |
527
|
|
|
|
|
|
|
} ## end else [ if ( defined $p[0] && ...)] |
528
|
|
|
|
|
|
|
} ## end sub columns |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=head2 border |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
enable border for columns : |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
border(1); |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
disable border for columns : |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
border(0); |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
return the status in void context. |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
$status = border(); |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
=cut |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
sub border { |
547
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @p ) = getSelf(@_); |
548
|
0
|
0
|
0
|
|
|
0
|
if ( defined $p[0] && $p[0] =~ /(0|1)/ ) { $border = $1; } |
|
0
|
|
|
|
|
0
|
|
549
|
0
|
|
|
|
|
0
|
else { return $border; } |
550
|
|
|
|
|
|
|
} ## end sub border |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
=head2 desc |
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
reverse sorting |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
enable desc : |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
desc(1); |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
disable border: |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
desc(0); |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
return the status in void context. |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
$status = desc(); |
567
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
=cut |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
sub desc { |
571
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @p ) = getSelf(@_); |
572
|
0
|
0
|
0
|
|
|
0
|
if ( defined $p[0] && $p[0] =~ /(0|1)/ ) { $desc = $1; } |
|
0
|
|
|
|
|
0
|
|
573
|
0
|
|
|
|
|
0
|
else { return $desc; } |
574
|
|
|
|
|
|
|
} ## end sub desc |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=head2 sortTree |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
set or unset sorting treeview Items. |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
default is false. |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
enable sorting: |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
sortTree(1); |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
disable sorting: |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
sortTree(0); |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
return the status in void context. |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
$status = sortTree(); |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
=cut |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
sub sortTree { |
597
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @p ) = getSelf(@_); |
598
|
0
|
0
|
0
|
|
|
0
|
if ( defined $p[0] && $p[0] =~ /(0|1)/ ) { $sort = $1; } |
|
0
|
|
|
|
|
0
|
|
599
|
0
|
|
|
|
|
0
|
else { return $sort; } |
600
|
|
|
|
|
|
|
} ## end sub sortTree |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
=head2 orderBy |
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
set the attribute which is used by sortTree and folderFirst. |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
=cut |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
sub orderBy { |
609
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @p ) = getSelf(@_); |
610
|
0
|
|
|
|
|
0
|
$orderby = $p[0]; |
611
|
|
|
|
|
|
|
} ## end sub orderBy |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
=head2 orderByColumn |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
sort the TreeView by Column |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
orderByColumn(i); |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
-1 to disable; |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
=cut |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
sub orderByColumn { |
624
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @p ) = getSelf(@_); |
625
|
0
|
0
|
0
|
|
|
0
|
if ( defined $p[0] && $p[0] =~ /(\d+)/ ) { $orderbyColumn = $1; } |
|
0
|
0
|
|
|
|
0
|
|
626
|
0
|
|
|
|
|
0
|
elsif ( $p[0] == -1 ) { undef $orderbyColumn } |
627
|
0
|
|
|
|
|
0
|
else { return $orderbyColumn; } |
628
|
|
|
|
|
|
|
} ## end sub orderByColumn |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=head2 folderFirst |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
set or unset show folders first ? |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
default is false. |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
enable show folders first: |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
folderFirst(1); |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
disable show folders first: |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
folderFirst(0); |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
return the status of this property in void context. |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
$status = folderFirst(); |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
=cut |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
sub folderFirst { |
651
|
4
|
|
|
4
|
1
|
18
|
my ( $self, @p ) = getSelf(@_); |
652
|
4
|
100
|
66
|
|
|
34
|
if ( defined $p[0] && $p[0] =~ /(0|1)/ ) { $ffirst = $1; } |
|
2
|
|
|
|
|
10
|
|
653
|
2
|
|
|
|
|
12
|
else { return $ffirst; } |
654
|
|
|
|
|
|
|
} ## end sub folderFirst |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
=head2 prefix |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
prefix used by css. |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
use this if you want build a offline website |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
for example: |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
prefix('.'); |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
return the prefix in void context. |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
=cut |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
sub prefix { |
671
|
0
|
|
|
0
|
1
|
0
|
my ( $self, @p ) = getSelf(@_); |
672
|
0
|
0
|
|
|
|
0
|
if ( defined $p[0] ) { $prefix = $p[0]; } |
|
0
|
|
|
|
|
0
|
|
673
|
0
|
|
|
|
|
0
|
else { return $prefix; } |
674
|
|
|
|
|
|
|
} ## end sub prefix |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
=head2 TrOver |
677
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
enable mouseover |
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
tr.trOver{} |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
=cut |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
sub TrOver { |
685
|
2
|
|
|
2
|
1
|
6
|
my ( $self, @p ) = getSelf(@_); |
686
|
2
|
100
|
|
|
|
6
|
if ( defined $p[0] ) { $bTrOver = $p[0]; } |
|
1
|
|
|
|
|
4
|
|
687
|
1
|
|
|
|
|
6
|
else { return $bTrOver; } |
688
|
|
|
|
|
|
|
} ## end sub TrOver |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
=head2 saveTree |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
saveTree('filename',\@ref); # or saveTree() |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
default: ./TreeViewDump.pl |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
=cut |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
sub saveTree { |
699
|
1
|
|
|
1
|
1
|
9
|
my ( $self, @p ) = getSelf(@_); |
700
|
1
|
50
|
|
|
|
5
|
my $saveAs = defined $p[0] ? $p[0] : $saveFile; |
701
|
1
|
50
|
|
|
|
5
|
@TreeView = defined $p[1] ? $p[1] : @TreeView; |
702
|
8
|
|
|
8
|
|
5057
|
use Data::Dumper; |
|
8
|
|
|
|
|
55297
|
|
|
8
|
|
|
|
|
747
|
|
703
|
1
|
|
|
|
|
4
|
my $content = Dumper(@TreeView); |
704
|
1
|
|
|
|
|
198
|
$content .= '@TreeView = $VAR1;'; |
705
|
8
|
|
|
8
|
|
64
|
use Fcntl qw(:flock); |
|
8
|
|
|
|
|
26
|
|
|
8
|
|
|
|
|
888
|
|
706
|
8
|
|
|
8
|
|
55
|
use Symbol; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
9972
|
|
707
|
1
|
|
|
|
|
4
|
my $fh = gensym(); |
708
|
1
|
50
|
|
|
|
26
|
my $rsas = $saveAs =~ /^(\S+)$/ ? $1 : 0; |
709
|
|
|
|
|
|
|
|
710
|
1
|
50
|
|
|
|
4
|
if ($rsas) { |
711
|
1
|
50
|
|
|
|
117
|
open $fh, ">$rsas.bak" or warn "HTML::Menu::TreeView::saveTree $/ $! $/ $rsas $/"; |
712
|
1
|
|
|
|
|
14
|
flock $fh, 2; |
713
|
1
|
|
|
|
|
12
|
seek $fh, 0, 0; |
714
|
1
|
|
|
|
|
70
|
truncate $fh, 0; |
715
|
1
|
|
|
|
|
20
|
print $fh $content; |
716
|
1
|
|
|
|
|
127
|
close $fh; |
717
|
|
|
|
|
|
|
} ## end if ($rsas) |
718
|
1
|
50
|
|
|
|
22
|
if ( -e "$rsas.bak" ) { |
719
|
1
|
50
|
|
|
|
50
|
rename "$rsas.bak", $rsas or warn "HTML::Menu::TreeView::saveTree $/ $! $/"; |
720
|
1
|
|
|
|
|
338
|
do $rsas; |
721
|
|
|
|
|
|
|
} ## end if ( -e "$rsas.bak" ) |
722
|
|
|
|
|
|
|
} ## end sub saveTree |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=head2 loadTree |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
loadTree('filename') or loadTree() |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
default: ./TreeViewDump.pl |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
=cut |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
sub loadTree { |
733
|
1
|
|
|
1
|
1
|
11
|
my ( $self, @p ) = getSelf(@_); |
734
|
1
|
50
|
|
|
|
4
|
my $do = ( defined $p[0] ) ? $p[0] : $saveFile; |
735
|
1
|
50
|
|
|
|
137
|
do $do if ( -e $do ); |
736
|
|
|
|
|
|
|
} ## end sub loadTree |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
=head2 help |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
help for link attributes. |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
return a hashref in void context, |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
my $hashref = help(); |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
foreach my $key (sort(keys %{$hashref})){ |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
print "$key : ", $hashref->{$key} ,$/; |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
} |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
or a help Message. |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
print help('href'),$/; |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
if you want german help try |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
language('de') |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
=cut |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
sub help { |
763
|
62
|
|
|
62
|
1
|
16307
|
my ( $self, @p ) = getSelf(@_); |
764
|
62
|
100
|
|
|
|
133
|
if ( defined $p[0] ) { |
765
|
60
|
100
|
|
|
|
121
|
if ( $lang eq 'de' ) { |
766
|
|
|
|
|
|
|
return ( defined $ankerG{ $p[0] } ) |
767
|
30
|
50
|
|
|
|
123
|
? $ankerG{ $p[0] } |
768
|
|
|
|
|
|
|
: "Unbekanntes Attribute !$/"; |
769
|
|
|
|
|
|
|
} else { |
770
|
|
|
|
|
|
|
return ( defined $ankerG{ $p[0] } ) |
771
|
30
|
50
|
|
|
|
137
|
? $anker{ $p[0] } |
772
|
|
|
|
|
|
|
: "Unknown attribute !$/"; |
773
|
|
|
|
|
|
|
} ## end else [ if ( $lang eq 'de' ) ] |
774
|
|
|
|
|
|
|
} else { |
775
|
2
|
100
|
|
|
|
5
|
if ( $lang eq 'de' ) { return \%ankerG; } |
|
1
|
|
|
|
|
4
|
|
776
|
1
|
|
|
|
|
4
|
else { return \%anker; } |
777
|
|
|
|
|
|
|
} ## end else [ if ( defined $p[0] ) ] |
778
|
|
|
|
|
|
|
} ## end sub help |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=head2 reserved attributes: |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
=over |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
=item href |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
URI for linked resource. |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
=item accesskey |
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
accessibility key character. |
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
=item charset |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
char encoding of linked resource. |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
=item class |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
class name or set of class names to an element. |
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
=item coords |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
for use with client-side image maps. |
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
=item dir |
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
the base direction of directionally neutral text. |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
=item hreflang |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
language code. |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
=item lang |
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
the base language of an elements attribute values and text content. |
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
=item onblur |
817
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
the element lost the focus. |
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
=item ondblclick |
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
event occurs when the pointing device button is double clicked |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
=item onclick |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
event occurs when the pointing device button is clicked over an element. |
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
=item onfocus |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
the element got the focus. |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
=item onkeydown |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
event occurs when a key is pressed down over an element. |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
=item onkeypress |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
event occurs when a key is pressed and released over an element. |
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
=item onkeyup |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
event occurs when a key is released over an element. |
843
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
=item onmousedown |
845
|
|
|
|
|
|
|
|
846
|
|
|
|
|
|
|
event occurs when the pointing device button is pressed over an element. |
847
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
=item onmousemove |
849
|
|
|
|
|
|
|
|
850
|
|
|
|
|
|
|
event occurs when the pointing device is moved while it is over an element. |
851
|
|
|
|
|
|
|
|
852
|
|
|
|
|
|
|
=item onmouseout |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
event occurs when the pointing device is moved away from an element. |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
=item onmouseover |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
event occurs when the pointing device is moved onto an element. |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
=item onmouseup |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
event occurs when the pointing device button is released over an element. |
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
=item rel |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
forward link types. |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
=item rev |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
reverse link types. |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
=item shape |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
for use with client-side image maps. |
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
=item style |
877
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
specifies style information for the current element. |
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
=item tabindex |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
position in tabbing order. |
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
=item target |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
target frame information. |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
=item type |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
advisory content type. |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
=item title |
893
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
element title. |
895
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
=item id |
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
This attribute assigns a name to an element. This name must be unique in a document. |
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
=item addition |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
additional text behind the link |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
=item subtree |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
an array of TreeView Items |
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
subtree => [{ |
909
|
|
|
|
|
|
|
text => 'Fo'}, |
910
|
|
|
|
|
|
|
{text => 'Bar'} |
911
|
|
|
|
|
|
|
] |
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
=item image. |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
a image name, must be placed into /style/mimetypes directory. |
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
=item folderclass : |
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
only for Crystal styles |
920
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
possible values: |
922
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
folderMan, folderVideo,folderCrystal, |
924
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
folderLocked , folderText, folderFavorite, |
926
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
folderPrint,folderHtml, |
928
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
folderImage,folderSound,folderImportant, |
930
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
folderTar,folderYellow ,folderGray, |
932
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
folderGreen and folderRed |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
see http://lindnerei.sourceforge.net/cgi-bin/crystal.pl for a complete list of possible values for folderclass. |
936
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
=item columns |
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
an array of columns |
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
columns => [ 1,2,3,4,5] |
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
=item empty. |
944
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
set it true if you ant a closed Folder, |
946
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
which load a location onclick, you must additional set the href attribute. |
948
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
=back |
950
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
=head1 backward compatibility |
952
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
=head2 getDocumentRoot |
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
for backward compatibility. |
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
use documentRoot instead. |
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
=cut |
961
|
1
|
|
|
1
|
1
|
6
|
sub getDocumentRoot { return $path; } |
962
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
=head2 setClasic |
964
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
use clasic() instead. |
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
for backward compatibility. |
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
use a classic node decoration |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
=cut |
972
|
1
|
|
|
1
|
1
|
3
|
sub setClasic { $clasic = 1; } |
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
=head2 setDocumentRoot |
975
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
for backward compatibility. |
977
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
use documentRoot instead. |
979
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
set the local path to the style folder. |
981
|
|
|
|
|
|
|
|
982
|
|
|
|
|
|
|
should be the Document Root of your webserver. |
983
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
example: |
985
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
setDocumentRoot('/sv/www/htdocs/'); |
987
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
default: this property is set during make |
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
=cut |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
sub setDocumentRoot { |
993
|
1
|
|
|
1
|
1
|
4
|
my ( $self, @p ) = getSelf(@_); |
994
|
1
|
|
|
|
|
4
|
$self->documentRoot( $p[0] ); |
995
|
|
|
|
|
|
|
} ## end sub setDocumentRoot |
996
|
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
=head2 setModern |
998
|
|
|
|
|
|
|
|
999
|
|
|
|
|
|
|
use clasic() instead. |
1000
|
|
|
|
|
|
|
|
1001
|
|
|
|
|
|
|
for backward compatibility. |
1002
|
|
|
|
|
|
|
|
1003
|
|
|
|
|
|
|
use a modern node decoration |
1004
|
|
|
|
|
|
|
|
1005
|
|
|
|
|
|
|
=cut |
1006
|
1
|
|
|
1
|
1
|
3
|
sub setModern { $clasic = 0; } |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
=head2 setSize |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
for backward compatibility. |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
use size instead. |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
only for Crystal styles |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
16,32,48,64 and 128 are possible values. |
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
=cut |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
sub setSize { |
1021
|
1
|
|
|
1
|
1
|
90
|
my ( $self, @p ) = getSelf(@_); |
1022
|
1
|
|
|
|
|
5
|
$self->size( $p[0] ); |
1023
|
|
|
|
|
|
|
} ## end sub setSize |
1024
|
|
|
|
|
|
|
|
1025
|
|
|
|
|
|
|
=head2 setStyle |
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
for backward compatibility. |
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
use style instead. |
1030
|
|
|
|
|
|
|
|
1031
|
|
|
|
|
|
|
setStyle('style'); |
1032
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
simple = redmond like style |
1034
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
Crystal = Crystal style |
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
=cut |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
sub setStyle { |
1040
|
1
|
|
|
1
|
1
|
4
|
my ( $self, @p ) = getSelf(@_); |
1041
|
1
|
|
|
|
|
4
|
$self->Style( $p[0] ); |
1042
|
|
|
|
|
|
|
} ## end sub setStyle |
1043
|
|
|
|
|
|
|
|
1044
|
|
|
|
|
|
|
=head2 style |
1045
|
|
|
|
|
|
|
|
1046
|
|
|
|
|
|
|
set the style. |
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
style('simple'); |
1049
|
|
|
|
|
|
|
|
1050
|
|
|
|
|
|
|
simple = redmond like style. |
1051
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
Crystal = Crystal style (default). |
1053
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
=cut |
1055
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
sub style { |
1057
|
3
|
|
|
3
|
1
|
8
|
my ( $self, @p ) = getSelf(@_); |
1058
|
3
|
|
|
|
|
9
|
return $self->Style( $p[0] ); |
1059
|
|
|
|
|
|
|
} ## end sub style |
1060
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
=head2 language |
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
set the language in scalar context, or get in void context. |
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
language('de'); |
1066
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
simple = redmond like style. |
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
Crystal = Crystal style (default). |
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
=cut |
1072
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
sub language { |
1074
|
1
|
|
|
1
|
1
|
274
|
my ( $self, @p ) = getSelf(@_); |
1075
|
1
|
|
|
|
|
5
|
$lang = $p[0]; |
1076
|
|
|
|
|
|
|
} ## end sub language |
1077
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
=head1 Private |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
=head2 initTree |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
construct the TreeView called by Tree, new or recursive by appendFolder. |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
=cut |
1085
|
|
|
|
|
|
|
|
1086
|
0
|
|
|
|
|
0
|
sub initTree { |
1087
|
20
|
|
|
20
|
1
|
52
|
my ( $self, @p ) = getSelf(@_); |
1088
|
20
|
|
|
|
|
41
|
my $tree = $p[0]; |
1089
|
20
|
50
|
|
|
|
60
|
return if ref $tree ne "ARRAY"; |
1090
|
|
|
|
|
|
|
SWITCH: { |
1091
|
20
|
50
|
|
|
|
35
|
if ($ffirst) { |
|
20
|
|
|
|
|
43
|
|
1092
|
0
|
|
|
|
|
0
|
my @tr = sort { &_ffolderFirst } @$tree; |
|
0
|
|
|
|
|
0
|
|
1093
|
0
|
0
|
|
|
|
0
|
@tr = reverse @tr if $desc; |
1094
|
0
|
|
|
|
|
0
|
$tree = \@tr; |
1095
|
0
|
|
|
|
|
0
|
last SWITCH; |
1096
|
|
|
|
|
|
|
} ## end if ($ffirst) |
1097
|
20
|
50
|
|
|
|
50
|
if ($sort) { |
1098
|
|
|
|
|
|
|
my @tr = sort { |
1099
|
0
|
0
|
0
|
|
|
0
|
return -1 unless $a || $b; |
|
0
|
|
|
|
|
0
|
|
1100
|
0
|
0
|
|
|
|
0
|
return -1 if ref $a ne "HASH"; |
1101
|
0
|
0
|
|
|
|
0
|
return +1 if ref $b ne "HASH"; |
1102
|
0
|
|
|
|
|
0
|
return lc( $a->{$orderby} ) cmp lc( $b->{$orderby} ) |
1103
|
|
|
|
|
|
|
} @$tree; |
1104
|
0
|
0
|
|
|
|
0
|
@tr = reverse @tr if $desc; |
1105
|
0
|
|
|
|
|
0
|
$tree = \@tr; |
1106
|
0
|
|
|
|
|
0
|
last SWITCH; |
1107
|
|
|
|
|
|
|
} ## end if ($sort) |
1108
|
20
|
50
|
33
|
|
|
54
|
if ( defined $orderbyColumn && $orderbyColumn >= 0 ) { |
1109
|
|
|
|
|
|
|
my @tr = sort { |
1110
|
0
|
0
|
0
|
|
|
0
|
return -1 unless $a || $b; |
|
0
|
|
|
|
|
0
|
|
1111
|
0
|
0
|
|
|
|
0
|
return -1 if ref $a ne "HASH"; |
1112
|
0
|
0
|
|
|
|
0
|
return +1 if ref $b ne "HASH"; |
1113
|
0
|
|
|
|
|
0
|
return lc( $a->{columns}[$orderbyColumn] ) cmp lc( $b->{columns}[$orderbyColumn] ) |
1114
|
|
|
|
|
|
|
} @$tree; |
1115
|
0
|
0
|
|
|
|
0
|
@tr = reverse @tr if $desc; |
1116
|
0
|
|
|
|
|
0
|
$tree = \@tr; |
1117
|
0
|
|
|
|
|
0
|
last SWITCH; |
1118
|
|
|
|
|
|
|
} ## end if ( defined $orderbyColumn...) |
1119
|
|
|
|
|
|
|
} ## end SWITCH: |
1120
|
20
|
|
|
|
|
36
|
my $length = @$tree; |
1121
|
20
|
|
|
|
|
57
|
for ( my $i = 0 ; $i < @$tree ; $i++ ) { |
1122
|
26
|
50
|
|
|
|
70
|
next if ref @$tree[$i] ne "HASH"; |
1123
|
26
|
|
|
|
|
41
|
$length--; |
1124
|
26
|
50
|
|
|
|
58
|
if ( @$tree[$i] ) { #defined @{@$tree[$i]->{subtree}} |
1125
|
26
|
100
|
66
|
|
|
154
|
if ( ref @$tree[$i]->{subtree}[0] eq "HASH" and not defined @$tree[$i]->{empty} ) |
|
|
50
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
{ #a smalll fix, sorting closed folders will work with this change. |
1127
|
10
|
100
|
|
|
|
54
|
if ( $length > 0 ) { |
|
|
50
|
|
|
|
|
|
1128
|
5
|
|
|
|
|
11
|
$self->appendFolder( @$tree[$i], \@{ @$tree[$i]->{subtree} } ); |
|
5
|
|
|
|
|
19
|
|
1129
|
|
|
|
|
|
|
} elsif ( $length eq 0 ) { |
1130
|
5
|
|
|
|
|
15
|
$self->appendLastFolder( @$tree[$i], \@{ @$tree[$i]->{subtree} } ); |
|
5
|
|
|
|
|
26
|
|
1131
|
|
|
|
|
|
|
} ## end elsif ( $length eq 0 ) |
1132
|
|
|
|
|
|
|
} elsif ( defined @$tree[$i]->{empty} ) { |
1133
|
0
|
0
|
|
|
|
0
|
if ( $length > 0 ) { $self->appendEmptyFolder( @$tree[$i] ); } |
|
0
|
0
|
|
|
|
0
|
|
1134
|
|
|
|
|
|
|
elsif ( $length eq 0 ) { |
1135
|
0
|
|
|
|
|
0
|
$self->appendLastEmptyFolder( @$tree[$i] ); |
1136
|
|
|
|
|
|
|
} ## end elsif ( $length eq 0 ) |
1137
|
|
|
|
|
|
|
} else { |
1138
|
16
|
100
|
|
|
|
57
|
if ( $length > 0 ) { $self->appendNode( @$tree[$i] ); } |
|
1
|
50
|
|
|
|
5
|
|
1139
|
|
|
|
|
|
|
elsif ( $length eq 0 ) { |
1140
|
15
|
|
|
|
|
46
|
$self->appendLastNode( @$tree[$i] ); |
1141
|
|
|
|
|
|
|
} ## end elsif ( $length eq 0 ) |
1142
|
|
|
|
|
|
|
} ## end else [ if ( ref @$tree[$i]->{...})] |
1143
|
|
|
|
|
|
|
} ## end if ( @$tree[$i] ) |
1144
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
=head2 _ffolderFirst |
1147
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
this function is used within initTree for sorting the TreeView if folderFirst(1) is set. |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
=cut |
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
sub _ffolderFirst { |
1153
|
8
|
|
|
8
|
|
66
|
no warnings; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
33901
|
|
1154
|
|
|
|
|
|
|
SWITCH: { |
1155
|
0
|
0
|
|
0
|
|
0
|
return -1 if ref $a ne "HASH"; |
|
0
|
|
|
|
|
0
|
|
1156
|
0
|
0
|
|
|
|
0
|
return +1 if ref $b ne "HASH"; |
1157
|
0
|
0
|
0
|
|
|
0
|
if ( ref $a->{subtree}[0] eq "HASH" and ref $b->{subtree}[0] eq "HASH" ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1158
|
0
|
|
|
|
|
0
|
return lc( $a->{$orderby} ) cmp lc( $b->{$orderby} ); |
1159
|
0
|
|
|
|
|
0
|
last SWITCH; |
1160
|
|
|
|
|
|
|
} elsif ( ref $a->{subtree}[0] eq "HASH" ) { |
1161
|
0
|
|
|
|
|
0
|
return -1; |
1162
|
0
|
|
|
|
|
0
|
last SWITCH; |
1163
|
|
|
|
|
|
|
} elsif ( ref $b->{subtree}[0] eq "HASH" ) { |
1164
|
0
|
|
|
|
|
0
|
return +1; |
1165
|
0
|
|
|
|
|
0
|
last SWITCH; |
1166
|
|
|
|
|
|
|
} else { |
1167
|
|
|
|
|
|
|
return $sort |
1168
|
0
|
0
|
|
|
|
0
|
? ( lc( $a->{$orderby} ) cmp lc( $b->{$orderby} ) ) |
1169
|
|
|
|
|
|
|
: -1; |
1170
|
|
|
|
|
|
|
} ## end else [ if ( ref $a->{subtree}...)] |
1171
|
|
|
|
|
|
|
} ## end SWITCH: |
1172
|
|
|
|
|
|
|
} ## end sub _ffolderFirst |
1173
|
|
|
|
|
|
|
} ## end sub initTree |
1174
|
|
|
|
|
|
|
|
1175
|
|
|
|
|
|
|
=head2 getSelf |
1176
|
|
|
|
|
|
|
|
1177
|
|
|
|
|
|
|
this module use of a Lincoln loader like class system. |
1178
|
|
|
|
|
|
|
|
1179
|
|
|
|
|
|
|
if the first parameter is a HTML::Menu::TreeView object (oo syntax ) this function returns the given parameters. |
1180
|
|
|
|
|
|
|
|
1181
|
|
|
|
|
|
|
or the first parameter it is not a object referenz (fo syntax) it create a new HTML::Menu::TreeView object, |
1182
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
return it as first value and @_ as the second value . |
1184
|
|
|
|
|
|
|
|
1185
|
|
|
|
|
|
|
my ($self, @p) = getSelf(@_); |
1186
|
|
|
|
|
|
|
|
1187
|
|
|
|
|
|
|
=cut |
1188
|
|
|
|
|
|
|
|
1189
|
|
|
|
|
|
|
sub getSelf { |
1190
|
143
|
50
|
100
|
143
|
1
|
669
|
return @_ if defined( $_[0] ) && ( !ref( $_[0] ) ) && ( $_[0] eq 'HTML::Menu::TreeView' ); |
|
|
|
66
|
|
|
|
|
1191
|
143
|
100
|
100
|
|
|
810
|
return ( defined( $_[0] ) && ( ref( $_[0] ) eq 'HTML::Menu::TreeView' || UNIVERSAL::isa( $_[0], 'HTML::Menu::TreeView' ) ) ) |
1192
|
|
|
|
|
|
|
? @_ |
1193
|
|
|
|
|
|
|
: ( $HTML::Menu::TreeView::DefaultClass->new, @_ ); |
1194
|
|
|
|
|
|
|
} ## end sub getSelf |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
=head2 appendFolder |
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
called by initTree(), append a Folder to the treeView() |
1199
|
|
|
|
|
|
|
|
1200
|
|
|
|
|
|
|
=cut |
1201
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
sub appendFolder { |
1203
|
5
|
|
|
5
|
1
|
11
|
my $self = shift; |
1204
|
5
|
|
|
|
|
9
|
my $node = shift; |
1205
|
5
|
|
|
|
|
7
|
my $subtree = shift; |
1206
|
5
|
|
|
|
|
13
|
++$id; |
1207
|
5
|
|
|
|
|
9
|
my ( $tmpref, $ty ); |
1208
|
5
|
50
|
|
|
|
16
|
if ( $columns > 0 ) { |
1209
|
0
|
|
|
|
|
0
|
$ty = $id; |
1210
|
0
|
|
|
|
|
0
|
foreach my $key ( keys %openArrays ) { |
1211
|
0
|
|
|
|
|
0
|
push @{ $openArrays{$key} }, $id; |
|
0
|
|
|
|
|
0
|
|
1212
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %openArrays) |
1213
|
0
|
|
|
|
|
0
|
$tmpref = \@{ $openArrays{$id} }; |
|
0
|
|
|
|
|
0
|
|
1214
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1215
|
|
|
|
|
|
|
$node->{onclick} = |
1216
|
|
|
|
|
|
|
defined $node->{onclick} ? $node->{onclick} |
1217
|
5
|
50
|
|
|
|
24
|
: defined $node->{href} ? '' |
|
|
100
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
: qq(ocFolder('$id');displayTree('$id');hideArray('$id');ocNode('$id.node','$size');); |
1219
|
5
|
|
|
|
|
33
|
my $onclick = qq( ocFolder('$id');displayTree('$id');hideArray('$id');ocNode('$id.node','$size');); |
1220
|
5
|
100
|
|
|
|
22
|
$node->{class} = defined $node->{class} ? $node->{class} : "treeviewLink$size"; |
1221
|
5
|
50
|
|
|
|
18
|
my $FolderClass = defined $node->{folderclass} ? $node->{folderclass} . $size : "folder$size"; |
1222
|
5
|
100
|
|
|
|
15
|
$node->{title} = defined $node->{title} ? $node->{title} : $node->{text}; |
1223
|
5
|
|
|
|
|
9
|
my $tt; |
1224
|
5
|
|
|
|
|
8
|
foreach my $key ( keys %{$node} ) { |
|
5
|
|
|
|
|
32
|
|
1225
|
32
|
100
|
100
|
|
|
126
|
$tt .= $key . '="' . $node->{$key} . '" ' if ( $anker{$key} && $node->{$key} ); |
1226
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %{$node...}) |
1227
|
|
|
|
|
|
|
my $st = $node->{style} = |
1228
|
5
|
50
|
33
|
|
|
42
|
( ( $columns > 0 or defined $node->{addition} ) and not defined $node->{style} ) ? 'style="white-space:nowrap;"' : ''; |
1229
|
|
|
|
|
|
|
my $addon = |
1230
|
|
|
|
|
|
|
defined $node->{addition} |
1231
|
5
|
50
|
|
|
|
24
|
? qq() |
1232
|
|
|
|
|
|
|
: " $node->{text} "; |
1233
|
5
|
50
|
|
|
|
17
|
my $minusnode = $clasic ? "clasicMinusNode$size" : "minusNode$size"; |
1234
|
|
|
|
|
|
|
$self->{tree} .= ( |
1235
|
5
|
100
|
|
|
|
104
|
$bTrOver |
1236
|
|
|
|
|
|
|
? qq( |
)
1237
|
|
|
|
|
|
|
: ' |
'
1238
|
|
|
|
|
|
|
) |
1239
|
|
|
|
|
|
|
. qq( | | | $addon |
|
);
1240
|
5
|
50
|
|
|
|
18
|
if ( $columns > 0 ) { |
1241
|
0
|
0
|
|
|
|
0
|
my $class = $border ? "columnsFolderBorder$size" : "columnsFolder$size"; |
1242
|
|
|
|
|
|
|
$self->{subtree} .= ( |
1243
|
0
|
0
|
|
|
|
0
|
$bTrOver |
1244
|
|
|
|
|
|
|
? qq( | )
1245
|
|
|
|
|
|
|
: qq( | )
1246
|
|
|
|
|
|
|
); |
1247
|
0
|
|
|
|
|
0
|
for ( my $i = 0 ; $i < $columns ; $i++ ) { |
1248
|
0
|
0
|
|
|
|
0
|
if ( defined $node->{columns}[$i] ) { |
1249
|
0
|
|
|
|
|
0
|
my $txt = $node->{columns}[$i]; |
1250
|
0
|
|
|
|
|
0
|
$self->{subtree} .= qq( | $txt | );
1251
|
|
|
|
|
|
|
} ## end if ( defined $node->{columns...}) |
1252
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1253
|
0
|
|
|
|
|
0
|
$self->{subtree} .= ' | ';
1254
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1255
|
5
|
|
|
|
|
68
|
$self->initTree( \@$subtree ); |
1256
|
5
|
50
|
|
|
|
18
|
if ( $columns > 0 ) { |
1257
|
0
|
|
|
|
|
0
|
for ( my $i = 0 ; $i < @$tmpref ; $i++ ) { |
1258
|
0
|
|
|
|
|
0
|
$self->{js}{$ty}[$i] = $$tmpref[$i]; |
1259
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1260
|
0
|
|
|
|
|
0
|
undef @$tmpref; |
1261
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1262
|
5
|
|
|
|
|
30
|
$self->{tree} .= ' | |
';
1263
|
|
|
|
|
|
|
} ## end sub appendFolder |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
=head2 appendLastFolder |
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
$self->appendLastFolder(\@tree); |
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
called by initTree() if the last item of the (sub)Tree is a folder. |
1270
|
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
=cut |
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
sub appendLastFolder { |
1274
|
5
|
|
|
5
|
1
|
14
|
my $self = shift; |
1275
|
5
|
|
|
|
|
10
|
my $node = shift; |
1276
|
5
|
|
|
|
|
10
|
my $subtree = shift; |
1277
|
5
|
|
|
|
|
11
|
$id++; |
1278
|
5
|
|
|
|
|
12
|
my $tmpref; |
1279
|
|
|
|
|
|
|
my $ty; |
1280
|
5
|
50
|
|
|
|
18
|
if ( $columns > 0 ) { |
1281
|
0
|
|
|
|
|
0
|
$ty = $id; |
1282
|
0
|
|
|
|
|
0
|
foreach my $key ( keys %openArrays ) { |
1283
|
0
|
|
|
|
|
0
|
push @{ $openArrays{$key} }, $id; |
|
0
|
|
|
|
|
0
|
|
1284
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %openArrays) |
1285
|
0
|
|
|
|
|
0
|
$tmpref = \@{ $openArrays{$id} }; |
|
0
|
|
|
|
|
0
|
|
1286
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1287
|
|
|
|
|
|
|
$node->{onclick} = |
1288
|
|
|
|
|
|
|
defined $node->{onclick} ? $node->{onclick} |
1289
|
5
|
50
|
|
|
|
28
|
: defined $node->{href} ? "" |
|
|
100
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
: qq(ocpNode('$id.node','$size');ocFolder('$id');displayTree('$id');hideArray('$id');); |
1291
|
5
|
|
|
|
|
30
|
my $onclick = qq(ocFolder('$id');displayTree('$id');hideArray('$id');ocpNode('$id.node','$size');); |
1292
|
5
|
100
|
|
|
|
32
|
$node->{class} = defined $node->{class} ? $node->{class} : "treeviewLink$size"; |
1293
|
|
|
|
|
|
|
my $FolderClass = |
1294
|
|
|
|
|
|
|
defined $node->{FolderClass} |
1295
|
5
|
50
|
|
|
|
33
|
? $node->{FolderClass} . $size |
1296
|
|
|
|
|
|
|
: "folder$size"; |
1297
|
5
|
100
|
|
|
|
18
|
$node->{title} = defined $node->{title} ? $node->{title} : $node->{text}; |
1298
|
5
|
|
|
|
|
9
|
my $tt; |
1299
|
5
|
|
|
|
|
11
|
foreach my $key ( keys %{$node} ) { |
|
5
|
|
|
|
|
22
|
|
1300
|
31
|
100
|
100
|
|
|
116
|
$tt .= $key . '="' . $node->{$key} . '" ' if ( $anker{$key} && $node->{$key} ); |
1301
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %{$node...}) |
1302
|
|
|
|
|
|
|
my $st = $node->{style} = |
1303
|
5
|
50
|
33
|
|
|
61
|
( ( $columns > 0 or defined $node->{addition} ) and not defined $node->{style} ) ? 'style="white-space:nowrap;"' : ''; |
1304
|
|
|
|
|
|
|
my $addon = |
1305
|
|
|
|
|
|
|
defined $node->{addition} |
1306
|
5
|
50
|
|
|
|
28
|
? qq() |
1307
|
|
|
|
|
|
|
: " $node->{text} "; |
1308
|
5
|
50
|
|
|
|
20
|
my $lastminusnode = $clasic ? "clasicLastMinusNode$size" : "lastMinusNode$size"; |
1309
|
|
|
|
|
|
|
$self->{tree} .= ( |
1310
|
5
|
100
|
|
|
|
99
|
$bTrOver |
1311
|
|
|
|
|
|
|
? qq( |
)
1312
|
|
|
|
|
|
|
: ' |
'
1313
|
|
|
|
|
|
|
) |
1314
|
|
|
|
|
|
|
. qq( | | | $addon |
|
| );
1315
|
5
|
50
|
|
|
|
20
|
if ( $columns > 0 ) { |
1316
|
0
|
0
|
|
|
|
0
|
my $class = $border ? "columnsFolderBorder$size" : "columnsFolder$size"; |
1317
|
|
|
|
|
|
|
$self->{subtree} .= ( |
1318
|
0
|
0
|
|
|
|
0
|
$bTrOver |
1319
|
|
|
|
|
|
|
? qq( | )
1320
|
|
|
|
|
|
|
: qq( | )
1321
|
|
|
|
|
|
|
); |
1322
|
0
|
|
|
|
|
0
|
for ( my $i = 0 ; $i < $columns ; $i++ ) { |
1323
|
0
|
0
|
|
|
|
0
|
if ( defined $node->{columns}[$i] ) { |
1324
|
0
|
|
|
|
|
0
|
my $txt = $node->{columns}[$i]; |
1325
|
0
|
|
|
|
|
0
|
$self->{subtree} .= qq( | $txt | );
1326
|
|
|
|
|
|
|
} ## end if ( defined $node->{columns...}) |
1327
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1328
|
0
|
|
|
|
|
0
|
$self->{subtree} .= ' | ';
1329
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1330
|
5
|
|
|
|
|
41
|
$self->initTree( \@$subtree ); |
1331
|
5
|
50
|
|
|
|
24
|
if ( $columns > 0 ) { |
1332
|
0
|
|
|
|
|
0
|
for ( my $i = 0 ; $i < @$tmpref ; $i++ ) { |
1333
|
0
|
|
|
|
|
0
|
$self->{js}{$ty}[$i] = $$tmpref[$i]; |
1334
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1335
|
0
|
|
|
|
|
0
|
undef @$tmpref; |
1336
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1337
|
5
|
|
|
|
|
31
|
$self->{tree} .= ' | |
';
1338
|
|
|
|
|
|
|
} ## end sub appendLastFolder |
1339
|
|
|
|
|
|
|
|
1340
|
|
|
|
|
|
|
=head2 appendEmptyFolder |
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
called by initTree(), append a empty Folder. |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
=cut |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
sub appendEmptyFolder { |
1347
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1348
|
0
|
|
|
|
|
0
|
my $node = shift; |
1349
|
0
|
|
|
|
|
0
|
++$id; |
1350
|
0
|
|
|
|
|
0
|
my ( $tmpref, $ty ); |
1351
|
0
|
0
|
|
|
|
0
|
if ( $columns > 0 ) { |
1352
|
0
|
|
|
|
|
0
|
$ty = $id; |
1353
|
0
|
|
|
|
|
0
|
foreach my $key ( keys %openArrays ) { |
1354
|
0
|
|
|
|
|
0
|
push @{ $openArrays{$key} }, $id; |
|
0
|
|
|
|
|
0
|
|
1355
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %openArrays) |
1356
|
0
|
|
|
|
|
0
|
$tmpref = \@{ $openArrays{$id} }; |
|
0
|
|
|
|
|
0
|
|
1357
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1358
|
0
|
|
|
|
|
0
|
my $onclick = qq(location.href='$node->{href}'); |
1359
|
0
|
0
|
|
|
|
0
|
$node->{class} = defined $node->{class} ? $node->{class} : "treeviewLink$size"; |
1360
|
|
|
|
|
|
|
my $FolderClass = |
1361
|
|
|
|
|
|
|
defined $node->{folderclass} |
1362
|
0
|
0
|
|
|
|
0
|
? $node->{folderclass} . "Closed$size" |
1363
|
|
|
|
|
|
|
: "folderClosed$size"; |
1364
|
0
|
0
|
|
|
|
0
|
$node->{title} = defined $node->{title} ? $node->{title} : $node->{text}; |
1365
|
0
|
|
|
|
|
0
|
my $tt; |
1366
|
0
|
|
|
|
|
0
|
foreach my $key ( keys %{$node} ) { |
|
0
|
|
|
|
|
0
|
|
1367
|
0
|
0
|
0
|
|
|
0
|
$tt .= $key . '="' . $node->{$key} . '" ' if ( $anker{$key} && $node->{$key} ); |
1368
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %{$node...}) |
1369
|
|
|
|
|
|
|
my $st = $node->{style} = |
1370
|
0
|
0
|
0
|
|
|
0
|
( ( $columns > 0 or defined $node->{addition} ) and not defined $node->{style} ) ? 'style="white-space:nowrap;"' : ''; |
1371
|
|
|
|
|
|
|
my $addon = |
1372
|
|
|
|
|
|
|
defined $node->{addition} |
1373
|
0
|
0
|
|
|
|
0
|
? qq() |
1374
|
|
|
|
|
|
|
: " $node->{text} "; |
1375
|
0
|
0
|
|
|
|
0
|
my $plusnode = $clasic ? "clasicPlusNode$size" : "plusNode$size"; |
1376
|
|
|
|
|
|
|
$self->{tree} .= ( |
1377
|
0
|
0
|
|
|
|
0
|
$bTrOver |
1378
|
|
|
|
|
|
|
? qq( |
)
1379
|
|
|
|
|
|
|
: ' |
'
1380
|
|
|
|
|
|
|
) |
1381
|
|
|
|
|
|
|
. qq( | | | $addon |
|
);
1382
|
0
|
0
|
|
|
|
0
|
if ( $columns > 0 ) { |
1383
|
0
|
0
|
|
|
|
0
|
my $class = $border ? "columnsFolderBorder$size" : "columnsFolder$size"; |
1384
|
|
|
|
|
|
|
$self->{subtree} .= ( |
1385
|
0
|
0
|
|
|
|
0
|
$bTrOver |
1386
|
|
|
|
|
|
|
? qq( |
)
1387
|
|
|
|
|
|
|
: qq( |
)
1388
|
|
|
|
|
|
|
); |
1389
|
0
|
|
|
|
|
0
|
for ( my $i = 0 ; $i < $columns ; $i++ ) { |
1390
|
0
|
0
|
|
|
|
0
|
if ( defined $node->{columns}[$i] ) { |
1391
|
0
|
|
|
|
|
0
|
my $txt = $node->{columns}[$i]; |
1392
|
0
|
|
|
|
|
0
|
$self->{subtree} .= qq( | $txt | );
1393
|
|
|
|
|
|
|
} ## end if ( defined $node->{columns...}) |
1394
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1395
|
0
|
|
|
|
|
0
|
$self->{subtree} .= ' |
';
1396
|
0
|
|
|
|
|
0
|
for ( my $i = 0 ; $i < @$tmpref ; $i++ ) { |
1397
|
0
|
|
|
|
|
0
|
$self->{js}{$ty}[$i] = $$tmpref[$i]; |
1398
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1399
|
0
|
|
|
|
|
0
|
undef @$tmpref; |
1400
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1401
|
|
|
|
|
|
|
} ## end sub appendEmptyFolder |
1402
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
=head2 appendLastEmptyFolder |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
$self->appendLastEmptyFolder($node); |
1406
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
called by initTree() if the last item of the (sub)Tree is a folder. |
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
=cut |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
sub appendLastEmptyFolder { |
1412
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1413
|
0
|
|
|
|
|
0
|
my $node = shift; |
1414
|
0
|
|
|
|
|
0
|
$id++; |
1415
|
0
|
|
|
|
|
0
|
my $tmpref; |
1416
|
|
|
|
|
|
|
my $ty; |
1417
|
0
|
0
|
|
|
|
0
|
if ( $columns > 0 ) { |
1418
|
0
|
|
|
|
|
0
|
$ty = $id; |
1419
|
0
|
|
|
|
|
0
|
foreach my $key ( keys %openArrays ) { |
1420
|
0
|
|
|
|
|
0
|
push @{ $openArrays{$key} }, $id; |
|
0
|
|
|
|
|
0
|
|
1421
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %openArrays) |
1422
|
0
|
|
|
|
|
0
|
$tmpref = \@{ $openArrays{$id} }; |
|
0
|
|
|
|
|
0
|
|
1423
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1424
|
0
|
|
|
|
|
0
|
my $onclick = qq(location.href='$node->{href}'); |
1425
|
0
|
0
|
|
|
|
0
|
$node->{class} = defined $node->{class} ? $node->{class} : "treeviewLink$size"; |
1426
|
|
|
|
|
|
|
my $FolderClass = |
1427
|
|
|
|
|
|
|
defined $node->{folderclass} |
1428
|
0
|
0
|
|
|
|
0
|
? $node->{folderclass} . "Closed$size" |
1429
|
|
|
|
|
|
|
: "folderClosed$size"; |
1430
|
0
|
0
|
|
|
|
0
|
$node->{title} = defined $node->{title} ? $node->{title} : $node->{text}; |
1431
|
0
|
|
|
|
|
0
|
my $tt; |
1432
|
0
|
|
|
|
|
0
|
foreach my $key ( keys %{$node} ) { |
|
0
|
|
|
|
|
0
|
|
1433
|
0
|
0
|
0
|
|
|
0
|
$tt .= $key . '="' . $node->{$key} . '" ' if ( $anker{$key} && $node->{$key} ); |
1434
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %{$node...}) |
1435
|
|
|
|
|
|
|
my $st = $node->{style} = |
1436
|
0
|
0
|
0
|
|
|
0
|
( ( $columns > 0 or defined $node->{addition} ) and not defined $node->{style} ) ? 'style="white-space:nowrap;"' : ''; |
1437
|
|
|
|
|
|
|
my $addon = |
1438
|
|
|
|
|
|
|
defined $node->{addition} |
1439
|
0
|
0
|
|
|
|
0
|
? qq() |
1440
|
|
|
|
|
|
|
: " $node->{text} "; |
1441
|
0
|
0
|
|
|
|
0
|
my $lastpusnode = $clasic ? "clasicLastPlusNode$size" : "lastPlusNode$size"; |
1442
|
|
|
|
|
|
|
$self->{tree} .= ( |
1443
|
0
|
0
|
|
|
|
0
|
$bTrOver |
1444
|
|
|
|
|
|
|
? qq( |
)
1445
|
|
|
|
|
|
|
: ' |
'
1446
|
|
|
|
|
|
|
) |
1447
|
|
|
|
|
|
|
. qq( | | | $addon |
|
);
1448
|
0
|
0
|
|
|
|
0
|
if ( $columns > 0 ) { |
1449
|
0
|
0
|
|
|
|
0
|
my $class = $border ? "columnsFolderBorder$size" : "columnsFolder$size"; |
1450
|
|
|
|
|
|
|
$self->{subtree} .= ( |
1451
|
0
|
0
|
|
|
|
0
|
$bTrOver |
1452
|
|
|
|
|
|
|
? qq( |
)
1453
|
|
|
|
|
|
|
: qq( |
)
1454
|
|
|
|
|
|
|
); |
1455
|
0
|
|
|
|
|
0
|
for ( my $i = 0 ; $i < $columns ; $i++ ) { |
1456
|
0
|
0
|
|
|
|
0
|
if ( defined $node->{columns}[$i] ) { |
1457
|
0
|
|
|
|
|
0
|
my $txt = $node->{columns}[$i]; |
1458
|
0
|
|
|
|
|
0
|
$self->{subtree} .= qq( | $txt | );
1459
|
|
|
|
|
|
|
} ## end if ( defined $node->{columns...}) |
1460
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1461
|
0
|
|
|
|
|
0
|
$self->{subtree} .= ' |
';
1462
|
0
|
|
|
|
|
0
|
for ( my $i = 0 ; $i < @$tmpref ; $i++ ) { |
1463
|
0
|
|
|
|
|
0
|
$self->{js}{$ty}[$i] = $$tmpref[$i]; |
1464
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1465
|
0
|
|
|
|
|
0
|
undef @$tmpref; |
1466
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1467
|
|
|
|
|
|
|
} ## end sub appendLastEmptyFolder |
1468
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
=head2 appendNode |
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
$self->appendNode(\$node); |
1472
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
called by initTree() if the current item of the (sub)Tree is a node. |
1474
|
|
|
|
|
|
|
|
1475
|
|
|
|
|
|
|
=cut |
1476
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
sub appendNode { |
1478
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
1479
|
1
|
|
|
|
|
2
|
my $node = shift; |
1480
|
1
|
50
|
|
|
|
15
|
$node->{image} = defined $node->{image} ? $node->{image} : 'link_overlay.png'; |
1481
|
1
|
50
|
|
|
|
7
|
$node->{class} = defined $node->{class} ? $node->{class} : "treeviewLink$size"; |
1482
|
1
|
50
|
|
|
|
5
|
$node->{title} = defined $node->{title} ? $node->{title} : $node->{text}; |
1483
|
1
|
|
|
|
|
3
|
$id++; |
1484
|
1
|
50
|
|
|
|
4
|
if ( $columns > 0 ) { |
1485
|
0
|
|
|
|
|
0
|
foreach my $key ( keys %openArrays ) { |
1486
|
0
|
|
|
|
|
0
|
push @{ $openArrays{$key} }, $id; |
|
0
|
|
|
|
|
0
|
|
1487
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %openArrays) |
1488
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1489
|
1
|
|
|
|
|
2
|
my $tt; |
1490
|
1
|
|
|
|
|
2
|
foreach my $key ( keys %{$node} ) { |
|
1
|
|
|
|
|
5
|
|
1491
|
6
|
50
|
66
|
|
|
37
|
$tt .= $key . '="' . $node->{$key} . '" ' if ( $anker{$key} && $node->{$key} ); |
1492
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %{$node...}) |
1493
|
|
|
|
|
|
|
my $st = $node->{style} = |
1494
|
1
|
50
|
33
|
|
|
17
|
( ( $columns > 0 or defined $node->{addition} ) and not defined $node->{style} ) ? 'style="white-space:nowrap;"' : ''; |
1495
|
|
|
|
|
|
|
my $addon = |
1496
|
|
|
|
|
|
|
defined $node->{addition} |
1497
|
1
|
50
|
|
|
|
7
|
? qq() |
1498
|
|
|
|
|
|
|
: " $node->{text}"; |
1499
|
|
|
|
|
|
|
$self->{tree} .= ( |
1500
|
1
|
50
|
|
|
|
21
|
$bTrOver |
1501
|
|
|
|
|
|
|
? qq( |
)
1502
|
|
|
|
|
|
|
: ' |
'
1503
|
|
|
|
|
|
|
) |
1504
|
|
|
|
|
|
|
. qq( | | $addon |
);
1505
|
1
|
50
|
|
|
|
7
|
if ( $columns > 0 ) { |
1506
|
|
|
|
|
|
|
$self->{subtree} .= ( |
1507
|
0
|
0
|
|
|
|
0
|
$bTrOver |
1508
|
|
|
|
|
|
|
? qq( |
)
1509
|
|
|
|
|
|
|
: qq( |
)
1510
|
|
|
|
|
|
|
); |
1511
|
0
|
0
|
|
|
|
0
|
my $class = $border ? "columnsNodeBorder$size" : "columnsNode$size"; |
1512
|
0
|
|
|
|
|
0
|
for ( my $i = 0 ; $i < $columns ; $i++ ) { |
1513
|
0
|
0
|
|
|
|
0
|
if ( defined $node->{columns}[$i] ) { |
1514
|
0
|
|
|
|
|
0
|
my $txt = $node->{columns}[$i]; |
1515
|
0
|
|
|
|
|
0
|
$self->{subtree} .= qq( | $txt | );
1516
|
|
|
|
|
|
|
} ## end if ( defined $node->{columns...}) |
1517
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1518
|
0
|
|
|
|
|
0
|
$self->{subtree} .= ' |
';
1519
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1520
|
|
|
|
|
|
|
} ## end sub appendNode |
1521
|
|
|
|
|
|
|
|
1522
|
|
|
|
|
|
|
=head2 appendLastNode |
1523
|
|
|
|
|
|
|
|
1524
|
|
|
|
|
|
|
$self->appendLastNode(\$node); |
1525
|
|
|
|
|
|
|
|
1526
|
|
|
|
|
|
|
called by initTree() if the last item of the current (sub)Tree is a node. |
1527
|
|
|
|
|
|
|
|
1528
|
|
|
|
|
|
|
=cut |
1529
|
|
|
|
|
|
|
|
1530
|
|
|
|
|
|
|
sub appendLastNode { |
1531
|
15
|
|
|
15
|
1
|
41
|
my $self = shift; |
1532
|
15
|
|
|
|
|
27
|
my $node = shift; |
1533
|
15
|
50
|
|
|
|
49
|
$node->{image} = defined $node->{image} ? $node->{image} : 'link_overlay.png'; |
1534
|
15
|
100
|
|
|
|
51
|
$node->{class} = defined $node->{class} ? $node->{class} : "treeviewLink$size"; |
1535
|
15
|
100
|
|
|
|
41
|
$node->{title} = defined $node->{title} ? $node->{title} : $node->{text}; |
1536
|
15
|
|
|
|
|
25
|
$id++; |
1537
|
15
|
50
|
|
|
|
46
|
if ( $columns > 0 ) { |
1538
|
0
|
|
|
|
|
0
|
foreach my $key ( keys %openArrays ) { |
1539
|
0
|
|
|
|
|
0
|
push @{ $openArrays{$key} }, $id; |
|
0
|
|
|
|
|
0
|
|
1540
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %openArrays) |
1541
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1542
|
15
|
|
|
|
|
21
|
my $tt; |
1543
|
15
|
|
|
|
|
25
|
foreach my $key ( keys %{$node} ) { |
|
15
|
|
|
|
|
54
|
|
1544
|
95
|
100
|
100
|
|
|
318
|
$tt .= $key . '="' . $node->{$key} . '" ' if ( $anker{$key} && $node->{$key} ); |
1545
|
|
|
|
|
|
|
} ## end foreach my $key ( keys %{$node...}) |
1546
|
|
|
|
|
|
|
my $st = $node->{style} = |
1547
|
15
|
50
|
33
|
|
|
122
|
( ( $columns > 0 or defined $node->{addition} ) and not defined $node->{style} ) ? 'style="white-space:nowrap;"' : ''; |
1548
|
|
|
|
|
|
|
my $addon = |
1549
|
|
|
|
|
|
|
defined $node->{addition} |
1550
|
15
|
50
|
|
|
|
68
|
? qq() |
1551
|
|
|
|
|
|
|
: " $node->{text}"; |
1552
|
|
|
|
|
|
|
$self->{tree} .= ( |
1553
|
15
|
100
|
|
|
|
130
|
$bTrOver |
1554
|
|
|
|
|
|
|
? qq( |
)
1555
|
|
|
|
|
|
|
: ' |
'
1556
|
|
|
|
|
|
|
) |
1557
|
|
|
|
|
|
|
. qq( | | $addon |
);
1558
|
15
|
50
|
|
|
|
93
|
if ( $columns > 0 ) { |
1559
|
0
|
0
|
|
|
|
|
my $class = $border ? "columnsLastNodeBorder$size" : "columnsLastNode$size"; |
1560
|
|
|
|
|
|
|
$self->{subtree} .= ( |
1561
|
0
|
0
|
|
|
|
|
$bTrOver |
1562
|
|
|
|
|
|
|
? qq( |
)
1563
|
|
|
|
|
|
|
: qq( |
)
1564
|
|
|
|
|
|
|
); |
1565
|
0
|
|
|
|
|
|
for ( my $i = 0 ; $i < $columns ; $i++ ) { |
1566
|
0
|
0
|
|
|
|
|
if ( defined $node->{columns}[$i] ) { |
1567
|
0
|
|
|
|
|
|
my $txt = $node->{columns}[$i]; |
1568
|
0
|
|
|
|
|
|
$self->{subtree} .= qq( | $txt | );
1569
|
|
|
|
|
|
|
} ## end if ( defined $node->{columns...}) |
1570
|
|
|
|
|
|
|
} ## end for ( my $i = 0 ; $i < ...) |
1571
|
0
|
|
|
|
|
|
$self->{subtree} .= ' |
';
1572
|
|
|
|
|
|
|
} ## end if ( $columns > 0 ) |
1573
|
|
|
|
|
|
|
} ## end sub appendLastNode |
1574
|
|
|
|
|
|
|
|
1575
|
|
|
|
|
|
|
=head1 SEE ALSO |
1576
|
|
|
|
|
|
|
|
1577
|
|
|
|
|
|
|
http://lindnerei.sourceforge.net |
1578
|
|
|
|
|
|
|
|
1579
|
|
|
|
|
|
|
=head1 AUTHOR |
1580
|
|
|
|
|
|
|
|
1581
|
|
|
|
|
|
|
Dirk Lindner |
1582
|
|
|
|
|
|
|
|
1583
|
|
|
|
|
|
|
=head1 LICENSE |
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
LGPL |
1586
|
|
|
|
|
|
|
|
1587
|
|
|
|
|
|
|
Copyright (C) 2018 by Hr. Dirk Lindner |
1588
|
|
|
|
|
|
|
|
1589
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
1590
|
|
|
|
|
|
|
modify it under the terms of the GNU Lesser General Public License |
1591
|
|
|
|
|
|
|
as published by the Free Software Foundation; |
1592
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
1593
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1594
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1595
|
|
|
|
|
|
|
GNU Lesser General Public License for more details. |
1596
|
|
|
|
|
|
|
|
1597
|
|
|
|
|
|
|
=cut |
1598
|
|
|
|
|
|
|
1; |