line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JQuery::Taconite; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1302
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
6
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
517
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
10
|
0
|
|
0
|
|
|
|
my $class = ref($this) || $this; |
11
|
0
|
|
|
|
|
|
my $my ; |
12
|
0
|
|
|
|
|
|
%{$my->{param}} = @_ ; |
|
0
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# die "No id defined for Taconite" unless $my->{param}{id} =~ /\S/ ; |
14
|
|
|
|
|
|
|
# die "No remote program defined for Taconite" unless $my->{param}{remoteProgram} =~ /\S/ ; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
bless $my, $class; |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
if ($my->{param}{css}) { |
19
|
0
|
|
|
|
|
|
push @{$my->{css}},$my->{param}{css} ; |
|
0
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
$my->{param}{debug} = 0 unless defined $my->{param}{debug} ; |
23
|
0
|
|
|
|
|
|
$my->add_to_jquery ; |
24
|
0
|
|
|
|
|
|
return $my ; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub add_to_jquery { |
28
|
0
|
|
|
0
|
0
|
|
my $my = shift ; |
29
|
0
|
|
|
|
|
|
my $jquery = $my->{param}{addToJQuery} ; |
30
|
0
|
0
|
|
|
|
|
if (defined $jquery) { |
31
|
0
|
|
|
|
|
|
$jquery->add($my) ; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub id { |
36
|
0
|
|
|
0
|
0
|
|
my $my = shift ; |
37
|
0
|
|
|
|
|
|
return $my->{param}{id} ; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub packages_needed { |
42
|
0
|
|
|
0
|
0
|
|
my $my = shift ; |
43
|
0
|
|
|
|
|
|
return ('taconite/jquery.taconite.js') ; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub get_jquery_code { |
48
|
0
|
|
|
0
|
0
|
|
my $my = shift ; |
49
|
0
|
|
|
|
|
|
my $id = $my->id ; |
50
|
0
|
|
|
|
|
|
my $remoteProgram = $my->{param}{remoteProgram} ; |
51
|
0
|
0
|
|
|
|
|
return '' unless $id =~ /\S/ ; |
52
|
0
|
|
|
|
|
|
my $runMode = '' ; |
53
|
0
|
0
|
|
|
|
|
if (defined $my->{param}{rm}) { |
54
|
0
|
|
|
|
|
|
$runMode = qq[rm: "$my->{param}{rm}", ] ; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my $function =<<'EOD'; |
58
|
|
|
|
|
|
|
DEBUG |
59
|
|
|
|
|
|
|
$('#ID').click(function() { |
60
|
|
|
|
|
|
|
$.post("PROGRAM_TO_RUN", { RUNMODE ts: new Date().getTime()} ); |
61
|
|
|
|
|
|
|
}); |
62
|
|
|
|
|
|
|
EOD |
63
|
0
|
0
|
|
|
|
|
if ( $my->{param}{debug} ) { |
64
|
0
|
|
|
|
|
|
$function =~ s!DEBUG!$.taconite.debug = true;! ; |
65
|
|
|
|
|
|
|
} else { |
66
|
0
|
|
|
|
|
|
$function =~ s!DEBUG!! ; |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
|
$function =~ s/ID/$id/ ; |
69
|
0
|
|
|
|
|
|
$function =~ s/PROGRAM_TO_RUN/$remoteProgram/ ; |
70
|
0
|
|
|
|
|
|
$function =~ s/RUNMODE/$runMode/ ; |
71
|
0
|
|
|
|
|
|
return $function ; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 NAME |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
JQuery::Taconite - an Ajax interface |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 VERSION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Version 1.00 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SYNOPSIS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Taconite installs the taconite javascript and doesn't do much else |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
use JQuery; |
90
|
|
|
|
|
|
|
use JQuery::Taconite; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$jquery = new JQuery(...) ; |
93
|
|
|
|
|
|
|
JQuery::Taconite->new(addToJQuery => $jquery) ; |
94
|
|
|
|
|
|
|
JQuery::Form->new(id => 'myForm', addToJQuery => $jquery) ; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
If used without a form: |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
$jquery = new JQuery(...) ; |
100
|
|
|
|
|
|
|
JQuery::Taconite->new(id => 'ex6', remoteProgram => '/cgi-bin/program_to_run.pl', rm => 'reply', addToJQuery => $jquery); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 FUNCTIONS |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=over |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item new |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Instantiate the object |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item debug |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Set to 1 to enable debugging. You can see the results in Firebug. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=back |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Peter Gordon, C<< >> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 BUGS |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
124
|
|
|
|
|
|
|
C, or through the web interface at |
125
|
|
|
|
|
|
|
L. |
126
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
127
|
|
|
|
|
|
|
your bug as I make changes. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SUPPORT |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
perldoc JQuery |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
You can also look for information at: |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=over 4 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
L |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * CPAN Ratings |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
L |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
L |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * Search CPAN |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
L |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=back |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Copyright 2007 Peter Gordon, all rights reserved. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
164
|
|
|
|
|
|
|
under the same terms as Perl itself. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
1; # End of JQuery::Taconite |