| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package RapidApp::Module::NavTree; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1954
|
use strict; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
108
|
|
|
4
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
94
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
19
|
use Moose; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
|
|
extends 'RapidApp::Module::Tree'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
21506
|
use RapidApp::Util qw(:all); |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
3332
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'module_scope', is => 'ro', lazy => 1, default => sub { return shift }; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has '+fetch_nodes_deep', default => 1; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'double_click_nav', is => 'ro', isa => 'Bool', default => 0; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub BUILD { |
|
18
|
4
|
|
|
4
|
0
|
22
|
my $self = shift; |
|
19
|
4
|
|
|
|
|
25
|
$self->setup_nav_listeners; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Add these listeners in a sub so derived classes can override/remove this: |
|
23
|
|
|
|
|
|
|
sub setup_nav_listeners { |
|
24
|
4
|
|
|
4
|
0
|
11
|
my $self = shift; |
|
25
|
|
|
|
|
|
|
|
|
26
|
4
|
50
|
|
|
|
122
|
my $event = $self->double_click_nav ? 'dblclick' : 'click'; |
|
27
|
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
158
|
$self->add_listener( $event => RapidApp::JSONFunc->new( raw => 1, func => 'Ext.ux.RapidApp.AppTab.treenav_click' ) ); |
|
29
|
4
|
|
|
|
|
103
|
$self->add_listener( beforerender => RapidApp::JSONFunc->new( raw => 1, func => 'Ext.ux.RapidApp.AppTab.cnt_init_loadTarget' ) ); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub apply_node_navopts_recursive { |
|
33
|
13
|
|
|
13
|
0
|
22
|
my $self = shift; |
|
34
|
13
|
|
|
|
|
15
|
my $nodes = shift; |
|
35
|
|
|
|
|
|
|
|
|
36
|
13
|
100
|
|
|
|
26
|
if(ref($nodes) eq 'HASH') { |
|
37
|
1
|
50
|
|
|
|
8
|
$self->apply_node_navopts_recursive($nodes->{children}) if ($nodes->{children}); |
|
38
|
1
|
|
|
|
|
6
|
return $self->apply_node_navopts($nodes); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
12
|
50
|
|
|
|
20
|
return undef unless (ref($nodes) eq 'ARRAY'); |
|
42
|
|
|
|
|
|
|
|
|
43
|
12
|
|
|
|
|
25
|
foreach my $item (@$nodes) { |
|
44
|
|
|
|
|
|
|
|
|
45
|
11
|
50
|
33
|
|
|
55
|
if (ref($item->{children}) eq 'ARRAY' and scalar $item->{children} > 0) { |
|
46
|
11
|
50
|
|
|
|
33
|
$self->apply_node_navopts_recursive($item->{children}) if ($item->{children}); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
#else { |
|
49
|
|
|
|
|
|
|
# #$item->{leaf} = \1; |
|
50
|
|
|
|
|
|
|
# $item->{loaded} = \1; |
|
51
|
|
|
|
|
|
|
# delete $item->{children} if ($item->{children}); |
|
52
|
|
|
|
|
|
|
#} |
|
53
|
|
|
|
|
|
|
|
|
54
|
11
|
50
|
|
|
|
28
|
$item->{expanded} = \1 if ($item->{expand}); |
|
55
|
|
|
|
|
|
|
|
|
56
|
11
|
|
|
|
|
25
|
$self->apply_node_navopts($item); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
12
|
|
|
|
|
16
|
return $nodes; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub apply_node_navopts { |
|
63
|
12
|
|
|
12
|
0
|
17
|
my $self = shift; |
|
64
|
12
|
|
|
|
|
15
|
my $item = shift; |
|
65
|
|
|
|
|
|
|
|
|
66
|
12
|
|
|
|
|
15
|
my $autoLoad = {}; |
|
67
|
12
|
50
|
|
|
|
33
|
$autoLoad->{params} = $item->{params} if ($item->{params}); |
|
68
|
12
|
50
|
|
|
|
27
|
$autoLoad->{url} = $item->{url} if ($item->{url}); |
|
69
|
|
|
|
|
|
|
|
|
70
|
12
|
|
|
|
|
20
|
my $module = $item->{module}; |
|
71
|
12
|
50
|
|
|
|
18
|
if ($module) { |
|
72
|
12
|
50
|
|
|
|
321
|
$module = $self->module_scope->Module($item->{module}) unless(ref($module)); |
|
73
|
12
|
|
|
|
|
275
|
$autoLoad->{url} = $module->base_url; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
else { |
|
76
|
|
|
|
|
|
|
# Don't build a loadContentCnf if there is no module or url |
|
77
|
0
|
0
|
|
|
|
0
|
return unless ($autoLoad->{url}); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
12
|
|
|
|
|
24
|
my $loadCnf = {}; |
|
81
|
12
|
|
|
|
|
25
|
$loadCnf->{itemId} = $item->{itemId}; |
|
82
|
12
|
50
|
|
|
|
31
|
$loadCnf->{itemId} = $item->{id} unless ($loadCnf->{itemId}); |
|
83
|
|
|
|
|
|
|
|
|
84
|
12
|
|
33
|
|
|
48
|
$loadCnf->{title} = $item->{title} || $item->{text}; |
|
85
|
12
|
|
|
|
|
31
|
$loadCnf->{iconCls} = $item->{iconCls}; |
|
86
|
|
|
|
|
|
|
|
|
87
|
12
|
|
|
|
|
19
|
$loadCnf->{autoLoad} = $autoLoad; |
|
88
|
12
|
|
|
|
|
28
|
$item->{loadContentCnf} = $loadCnf; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Default fetch_nodes uses an array of nodes returned from 'TreeConfig' |
|
92
|
|
|
|
|
|
|
sub fetch_nodes { |
|
93
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
|
94
|
1
|
|
50
|
|
|
28
|
return $self->TreeConfig || []; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# New: automatically apply navopts logic to all nodes, including for subclasses |
|
99
|
|
|
|
|
|
|
# which define their own own fetch_nodes method |
|
100
|
|
|
|
|
|
|
around 'prepare_node' => sub { |
|
101
|
|
|
|
|
|
|
my ($orig, $self, @args) = @_; |
|
102
|
|
|
|
|
|
|
my $nodes = $self->$orig(@args); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
$self->apply_node_navopts_recursive($nodes); |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
$nodes |
|
107
|
|
|
|
|
|
|
}; |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
#### --------------------- #### |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
4
|
|
|
4
|
|
30
|
no Moose; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
21
|
|
|
115
|
|
|
|
|
|
|
#__PACKAGE__->meta->make_immutable; |
|
116
|
|
|
|
|
|
|
1; |