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