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