line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Lazy::Widget::DomLoader; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use base qw(CGI::Lazy::Widget); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
85
|
|
6
|
1
|
|
|
1
|
|
5
|
use JSON; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------- |
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
11
|
0
|
|
|
|
|
|
my $q = shift; |
12
|
0
|
|
|
|
|
|
my $inputvars = shift; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
my $vars = {}; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
foreach (keys %{$inputvars->{lookups}}) { |
|
0
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
$vars->{lookups}->{$_} = $_; |
18
|
0
|
|
|
|
|
|
$vars->{lookups}->{$_}->{preload} = 1; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
$vars->{raw} = $inputvars->{raw}; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $widgetID = $vars->{id}; |
24
|
0
|
|
|
|
|
|
return bless {_q => $q, _vars => $vars, _widgetID => $widgetID}, $class; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------- |
28
|
|
|
|
|
|
|
sub output { |
29
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $rawObjectJs; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
foreach my $rawvar (keys %{$self->vars->{raw};}) { |
|
0
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$rawObjectJs .= "var $rawvar = JSON.parse('".to_json($self->vars->{raw}->{$rawvar})."');\n"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
$rawObjectJs = $self->q->jswrap($rawObjectJs) if $rawObjectJs; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $output = $self->preloadLookup; |
40
|
0
|
0
|
|
|
|
|
$output .= $rawObjectJs if $rawObjectJs; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $output; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |