lib/Jifty/Plugin/Media/Widget.pm

filter: Statementstmt 38.4% 10 / 26 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 41.1% 14 / 34 CC 2 SCAR 11.0
CC
2
Cov
36%
render_widget
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
↑ Summary lib/Jifty/Plugin/Media/Action/ManageFile.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Jifty::Plugin::Media::Widget;
5 1 ▶use base qw/Jifty::Web::Form::Field/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 Jifty::Plugin::Media::Widget - widget for managing files in Jifty
10  
11 =head2 render_widget
12  
13 html widget
14  
15 =cut
16  
17 0 ▶sub render_widget {
Subroutine render_widget: not called CC=2 SCAR=17.9
Pod documented
18 0 my $self = shift;
19 0 my $field;
20  
21 0 my $element_id = "@{[ $self->element_id ]}";
22 0 $element_id=~s/://g;
23  
24 0 ▶ my $current_value = $self->current_value || '';
Condition0%0/2
$self->current_value || ''
l!l
00
MC/DC0%0/1
$self->current_value || ''
$self->current_value
Truth table0%0/2
A
A= $self->current_value
Aresult
11
00
25  
26 0 $field .= qq!<div>!;
27 0 $field .= qq!<input id="$element_id"!;
28 0 $field .= qq! name="@{[ $self->input_name ]}"!;
29 0 $field .= qq! type="text" value="$current_value" /></div>!;
30 0 my $folder = 'f'.$element_id;
31 0 $field .= qq! <div id="$folder"></div>!;
32  
33 0 $field .= <<"EOF";
34 <script language="javascript">
35 jQuery(document).ready( function() {
36 jQuery('#$folder').fileTree ({
37 root: '/',
38 script: '/media_browse',
39 expandSpeed: 300,
40 collapseSpeed: 300,
41 multiFolder: false
42 }, function(file) {
43 jQuery('#$element_id').val(file);
44 });
45 });
46 </script>
47 EOF
48  
49 0 Jifty->web->out($field);
50 0 '';
51 };
52  
53 =head1 AUTHOR
54  
55 Yves Agostini, <yvesago@cpan.org>
56  
57 =head1 LICENSE
58  
59 Copyright 2010, Yves Agostini.
60  
61 This program is free software and may be modified and distributed under the same terms as Perl itself.
62  
63 =cut
64  
65  
66 1 1;
67  
↑ Summary lib/Jifty/Plugin/Media/Action/ManageFile.pm »