| 1 | package HTML::FormHandler::Render::Simple; | ||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: simple rendering role | ||||||||||||||||||||||||||||||||||
| 3 | 8 | $HTML::FormHandler::Render::Simple::VERSION = '0.410002'; | |||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||
| 6 | 8 | requires( 'sorted_fields', 'field' ); | |||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||
| 8 | 8 | ▶ | use HTML::FormHandler::Render::Util ('process_attrs', 'ucc_widget'); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use HTML::Entities qw( encode_entities ); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||
| 13 | 6 | ▶ | sub render { | ||||||||||||||||||||||||||||||||
|
Subroutine
render: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 14 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 15 | 6 | my $output = $self->render_start; | |||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||
| 17 | 6 | $output .= $self->render_form_errors; | |||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||
| 19 | 6 | foreach my $field ( $self->sorted_fields ) { | |||||||||||||||||||||||||||||||||
| 20 | 39 | $output .= $self->render_field($field); | |||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||
| 23 | 6 | $output .= $self->render_end; | |||||||||||||||||||||||||||||||||
| 24 | 6 | return $output; | |||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||
| 28 | 6 | ▶ | sub render_form_errors { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_form_errors: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 29 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||
| 31 | 6 | ▶ | return '' unless $self->has_form_errors; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 32 | 1 | my $output = "\n<div class=\"form_errors\">"; | |||||||||||||||||||||||||||||||||
| 33 | $output .= qq{\n<span class="error_message">$_</span>} | ||||||||||||||||||||||||||||||||||
| 34 | 1 | for map { encode_entities($_) } $self->all_form_errors; | |||||||||||||||||||||||||||||||||
| 35 | 1 | $output .= "\n</div>"; | |||||||||||||||||||||||||||||||||
| 36 | 1 | return $output; | |||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||
| 39 | 96 | ▶ | sub render_field { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_field: called CC=7 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 40 | 96 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||
| 42 | 96 | ▶ | if ( ref( \$field ) eq 'SCALAR' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 43 | 2 | $field = $self->field($field); | |||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||
| 45 | 96 | ▶ | die "must pass field to render_field" | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $field and $field->isa("HTML::FormHandler::Field")
MC/DC0%0/2
defined $field and $field->isa("HTML::FormHandler::Field")
defined $field
$field->isa("HTML::FormHandler::Field")
Truth table33%1/3
A and B
A= defined $fieldB= $field->isa("HTML::FormHandler::Field")
| |||||||||||||||||||||||||||||||||||
| 46 | unless ( defined $field && $field->isa('HTML::FormHandler::Field') ); | ||||||||||||||||||||||||||||||||||
| 47 | # widgets should be in camel case, since they are Perl package names | ||||||||||||||||||||||||||||||||||
| 48 | 96 | my $widget = ucc_widget($field->widget); | |||||||||||||||||||||||||||||||||
| 49 | 96 | ▶ | return '' if $widget eq 'no_render'; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 50 | 91 | my $rendered_field; | |||||||||||||||||||||||||||||||||
| 51 | 91 | my $form_render = 'render_' . $widget; | |||||||||||||||||||||||||||||||||
| 52 | 91 | ▶ | if ( $self->can($form_render) ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 53 | 90 | $rendered_field = $self->$form_render($field); | |||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||
| 55 | elsif ( $field->can('render') ) { | ||||||||||||||||||||||||||||||||||
| 56 | 1 | $rendered_field = $field->render; | |||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||
| 58 | else { | ||||||||||||||||||||||||||||||||||
| 59 | 0 | die "No widget method found for '$widget' in H::F::Render::Simple"; | |||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||
| 61 | 91 | return $self->wrap_field( $field, $rendered_field ); | |||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||
| 64 | 67 | ▶ | sub wrap_field { | ||||||||||||||||||||||||||||||||
|
Subroutine
wrap_field: called CC=10 SCAR=23.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 65 | 67 | my ( $self, $field, $rendered_field ) = @_; | |||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||
| 67 | 67 | ▶ | return "\n$rendered_field" if $field->uwrapper eq 'none'; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 68 | 67 | ▶ | return "\n$rendered_field" if ! $field->do_wrapper; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||
| 70 | 67 | my $output = "\n"; | |||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||
| 72 | 67 | my $wrapper_tag = $field->get_tag('wrapper_tag'); | |||||||||||||||||||||||||||||||||
| 73 | 67 | ▶ | $wrapper_tag ||= $field->has_flag('is_repeatable') ? 'fieldset' : 'div'; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$wrapper_tag ||= $field->has_flag("is_repeatable") ? "fieldset" : "div"
MC/DC0%0/2
$wrapper_tag ||= $field->has_flag("is_repeatable") ? "fieldset" : "div"
$wrapper_tag
$field->has_flag("is_repeatable") ? "fieldset" : "div"
Truth table66%2/3
A ||= B
A= $wrapper_tagB= $field->has_flag("is_repeatable") ? "fieldset" : "div"
| |||||||||||||||||||||||||||||||||||
| 74 | 67 | my $attrs = process_attrs($field->wrapper_attributes); | |||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||
| 76 | 67 | $output .= qq{<$wrapper_tag$attrs>}; | |||||||||||||||||||||||||||||||||
| 77 | 67 | ▶ | if( $wrapper_tag eq 'fieldset' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 78 | 2 | $output .= '<legend>' . $field->loc_label . '</legend>'; | |||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||
| 80 | ▶ | elsif ( ! $field->get_tag('label_none') && $field->do_label && length( $field->label ) > 0 ) { | |||||||||||||||||||||||||||||||||
|
Condition66%4/6
not $field->get_tag("label_none") and $field->do_label and length $field->label > 0
not $field->get_tag("label_none") and $field->do_label
MC/DC33%1/3
not $field->get_tag("label_none") and $field->do_label and length $field->label > 0
not $field->get_tag("label_none")
$field->do_label
length $field->label > 0
Truth table50%2/4
not(A) and B and C
A= not $field->get_tag("label_none")B= $field->do_labelC= length $field->label > 0
| |||||||||||||||||||||||||||||||||||
| 81 | 57 | $output .= "\n" . $self->render_label($field); | |||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||
| 84 | 67 | $output .= "\n$rendered_field"; | |||||||||||||||||||||||||||||||||
| 85 | $output .= qq{\n<span class="error_message">$_</span>} | ||||||||||||||||||||||||||||||||||
| 86 | 67 | for map { encode_entities($_) } $field->all_errors; | |||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||
| 88 | 67 | $output .= "\n</$wrapper_tag>"; | |||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||
| 90 | 67 | return "$output"; | |||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||
| 93 | 43 | ▶ | sub render_text { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_text: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 94 | 43 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 95 | 43 | my $output = '<input type="' . $field->input_type . '" name="'; | |||||||||||||||||||||||||||||||||
| 96 | 43 | $output .= $field->html_name . '"'; | |||||||||||||||||||||||||||||||||
| 97 | 43 | $output .= ' id="' . $field->id . '"'; | |||||||||||||||||||||||||||||||||
| 98 | 43 | ▶ | $output .= ' size="' . $field->size . '"' if $field->size; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 99 | 43 | ▶ | $output .= ' maxlength="' . $field->maxlength . '"' if $field->maxlength; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 100 | 43 | $output .= ' value="' . $field->html_filter($field->fif) . '"'; | |||||||||||||||||||||||||||||||||
| 101 | 43 | $output .= process_attrs($field->element_attributes); | |||||||||||||||||||||||||||||||||
| 102 | 43 | $output .= ' />'; | |||||||||||||||||||||||||||||||||
| 103 | 43 | return $output; | |||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub render_password { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_password: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 107 | 0 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 108 | 0 | my $output = '<input type="password" name="'; | |||||||||||||||||||||||||||||||||
| 109 | 0 | $output .= $field->html_name . '"'; | |||||||||||||||||||||||||||||||||
| 110 | 0 | $output .= ' id="' . $field->id . '"'; | |||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | $output .= ' size="' . $field->size . '"' if $field->size; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | $output .= ' maxlength="' . $field->maxlength . '"' if $field->maxlength; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 113 | 0 | $output .= ' value="' . $field->html_filter($field->fif) . '"'; | |||||||||||||||||||||||||||||||||
| 114 | 0 | $output .= process_attrs($field->element_attributes); | |||||||||||||||||||||||||||||||||
| 115 | 0 | $output .= ' />'; | |||||||||||||||||||||||||||||||||
| 116 | 0 | return $output; | |||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||
| 119 | 5 | ▶ | sub render_hidden { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_hidden: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 120 | 5 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 121 | 5 | my $output = '<input type="hidden" name="'; | |||||||||||||||||||||||||||||||||
| 122 | 5 | $output .= $field->html_name . '"'; | |||||||||||||||||||||||||||||||||
| 123 | 5 | $output .= ' id="' . $field->id . '"'; | |||||||||||||||||||||||||||||||||
| 124 | 5 | $output .= ' value="' . $field->html_filter($field->fif) . '"'; | |||||||||||||||||||||||||||||||||
| 125 | 5 | $output .= process_attrs($field->element_attributes); | |||||||||||||||||||||||||||||||||
| 126 | 5 | $output .= ' />'; | |||||||||||||||||||||||||||||||||
| 127 | 5 | return $output; | |||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||
| 130 | 14 | ▶ | sub render_select { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_select: called CC=13 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 131 | 14 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||
| 133 | 14 | my $multiple = $field->multiple; | |||||||||||||||||||||||||||||||||
| 134 | 14 | my $id = $field->id; | |||||||||||||||||||||||||||||||||
| 135 | 14 | my $output = '<select name="' . $field->html_name . '"'; | |||||||||||||||||||||||||||||||||
| 136 | 14 | $output .= qq{ id="$id"}; | |||||||||||||||||||||||||||||||||
| 137 | 14 | ▶ | $output .= ' multiple="multiple"' if $multiple == 1; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 138 | 14 | ▶ | $output .= ' size="' . $field->size . '"' if $field->size; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 139 | 14 | my $html_attributes = process_attrs($field->element_attributes); | |||||||||||||||||||||||||||||||||
| 140 | 14 | $output .= $html_attributes; | |||||||||||||||||||||||||||||||||
| 141 | 14 | $output .= '>'; | |||||||||||||||||||||||||||||||||
| 142 | 14 | my $index = 0; | |||||||||||||||||||||||||||||||||
| 143 | 14 | ▶ | if( defined $field->empty_select ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 144 | 0 | $output .= '<option value="">' . $field->_localize($field->empty_select) . '</option>'; | |||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||
| 146 | 14 | my $fif = $field->fif; | |||||||||||||||||||||||||||||||||
| 147 | 14 | my %fif_lookup; | |||||||||||||||||||||||||||||||||
| 148 | 14 | ▶ | @fif_lookup{@$fif} = () if $multiple; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 149 | 14 | foreach my $option ( @{ $field->{options} } ) { | |||||||||||||||||||||||||||||||||
| 150 | 47 | my $value = $option->{value}; | |||||||||||||||||||||||||||||||||
| 151 | 47 | $output .= '<option value="' | |||||||||||||||||||||||||||||||||
| 152 | . $field->html_filter($value) | ||||||||||||||||||||||||||||||||||
| 153 | . qq{" id="$id.$index"}; | ||||||||||||||||||||||||||||||||||
| 154 | 47 | ▶ | if( defined $option->{disabled} && $option->{disabled} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $option->{"disabled"} and $option->{"disabled"}
MC/DC100%2/2
defined $option->{"disabled"} and $option->{"disabled"}
defined $option->{"disabled"}
$option->{"disabled"}
Truth table100%3/3
A and B
A= defined $option->{"disabled"}B= $option->{"disabled"}
| |||||||||||||||||||||||||||||||||||
| 155 | 4 | $output .= ' disabled="disabled"'; | |||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||
| 157 | 47 | ▶ | if ( defined $fif ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 158 | 47 | ▶ | if ( $multiple && exists $fif_lookup{$value} ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$multiple and exists $fif_lookup{$value}
MC/DC100%2/2
$multiple and exists $fif_lookup{$value}
$multiple
exists $fif_lookup{$value}
Truth table100%3/3
A and B
A= $multipleB= exists $fif_lookup{$value}
| |||||||||||||||||||||||||||||||||||
| 159 | 8 | $output .= ' selected="selected"'; | |||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||
| 161 | elsif ( $fif eq $value ) { | ||||||||||||||||||||||||||||||||||
| 162 | 4 | $output .= ' selected="selected"'; | |||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||
| 165 | 47 | $output .= $html_attributes; | |||||||||||||||||||||||||||||||||
| 166 | 47 | my $label = $option->{label}; | |||||||||||||||||||||||||||||||||
| 167 | 47 | ▶ | $label = $field->_localize($label) if $field->localize_labels; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 168 | 47 | $output .= '>' . ( $field->html_filter($label) ) . '</option>'; | |||||||||||||||||||||||||||||||||
| 169 | 47 | $index++; | |||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||
| 171 | 14 | $output .= '</select>'; | |||||||||||||||||||||||||||||||||
| 172 | 14 | return $output; | |||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||
| 175 | 10 | ▶ | sub render_checkbox { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_checkbox: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 176 | 10 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||
| 178 | 10 | my $output = '<input type="checkbox" name="' . $field->html_name . '"'; | |||||||||||||||||||||||||||||||||
| 179 | 10 | $output .= ' id="' . $field->id . '"'; | |||||||||||||||||||||||||||||||||
| 180 | 10 | $output .= ' value="' . $field->html_filter($field->checkbox_value) . '"'; | |||||||||||||||||||||||||||||||||
| 181 | 10 | ▶ | $output .= ' checked="checked"' if $field->fif eq $field->checkbox_value; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 182 | 10 | $output .= process_attrs($field->element_attributes); | |||||||||||||||||||||||||||||||||
| 183 | 10 | $output .= ' />'; | |||||||||||||||||||||||||||||||||
| 184 | 10 | return $output; | |||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||
| 187 | 5 | ▶ | sub render_radio_group { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_radio_group: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 188 | 5 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||
| 190 | 5 | my $output = " <br />"; | |||||||||||||||||||||||||||||||||
| 191 | 5 | my $index = 0; | |||||||||||||||||||||||||||||||||
| 192 | 5 | foreach my $option ( @{ $field->options } ) { | |||||||||||||||||||||||||||||||||
| 193 | 10 | my $id = $field->id . ".$index"; | |||||||||||||||||||||||||||||||||
| 194 | 10 | $output .= qq{<label for="$id"><input type="radio" value="} . $field->html_filter($option->{value}) . '"'; | |||||||||||||||||||||||||||||||||
| 195 | 10 | $output .= ' name="' . $field->html_name . '" id="' . "$id\""; | |||||||||||||||||||||||||||||||||
| 196 | 10 | ▶ | $output .= ' checked="checked"' if $option->{value} eq $field->fif; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 197 | 10 | $output .= ' />'; | |||||||||||||||||||||||||||||||||
| 198 | 10 | $output .= $field->html_filter($option->{label}) . '</label><br />'; | |||||||||||||||||||||||||||||||||
| 199 | 10 | $index++; | |||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||
| 201 | 5 | return $output; | |||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||
| 204 | 5 | ▶ | sub render_textarea { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_textarea: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 205 | 5 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 206 | 5 | ▶ | my $fif = $field->fif || ''; | ||||||||||||||||||||||||||||||||
|
Condition100%2/2
$field->fif || ''
MC/DC100%1/1
$field->fif || ''
$field->fif
Truth table100%2/2
A
A= $field->fif
| |||||||||||||||||||||||||||||||||||
| 207 | 5 | my $id = $field->id; | |||||||||||||||||||||||||||||||||
| 208 | 5 | ▶ | my $cols = $field->cols || 10; | ||||||||||||||||||||||||||||||||
|
Condition100%2/2
$field->cols || 10
MC/DC100%1/1
$field->cols || 10
$field->cols
Truth table100%2/2
A
A= $field->cols
| |||||||||||||||||||||||||||||||||||
| 209 | 5 | ▶ | my $rows = $field->rows || 5; | ||||||||||||||||||||||||||||||||
|
Condition100%2/2
$field->rows || 5
MC/DC100%1/1
$field->rows || 5
$field->rows
Truth table100%2/2
A
A= $field->rows
| |||||||||||||||||||||||||||||||||||
| 210 | 5 | my $name = $field->html_name; | |||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||
| 212 | 5 | my $output = | |||||||||||||||||||||||||||||||||
| 213 | qq(<textarea name="$name" id="$id" ) | ||||||||||||||||||||||||||||||||||
| 214 | . process_attrs($field->element_attributes) | ||||||||||||||||||||||||||||||||||
| 215 | . qq(rows="$rows" cols="$cols">) | ||||||||||||||||||||||||||||||||||
| 216 | . $field->html_filter($fif) | ||||||||||||||||||||||||||||||||||
| 217 | . q(</textarea>); | ||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||
| 219 | 5 | return $output; | |||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub render_upload { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_upload: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 223 | 0 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||
| 225 | 0 | my $output; | |||||||||||||||||||||||||||||||||
| 226 | 0 | $output = '<input type="file" name="'; | |||||||||||||||||||||||||||||||||
| 227 | 0 | $output .= $field->html_name . '"'; | |||||||||||||||||||||||||||||||||
| 228 | 0 | $output .= ' id="' . $field->id . '"'; | |||||||||||||||||||||||||||||||||
| 229 | 0 | $output .= process_attrs($field->element_attributes); | |||||||||||||||||||||||||||||||||
| 230 | 0 | $output .= ' />'; | |||||||||||||||||||||||||||||||||
| 231 | 0 | return $output; | |||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||
| 234 | 81 | ▶ | sub render_label { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_label: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 235 | 81 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||
| 237 | 81 | my $attrs = process_attrs( $field->label_attributes ); | |||||||||||||||||||||||||||||||||
| 238 | 81 | my $label = $field->html_filter($field->loc_label); | |||||||||||||||||||||||||||||||||
| 239 | 81 | ▶ | $label .= $field->get_tag('label_after') | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 240 | if( $field->tag_exists('label_after') ); | ||||||||||||||||||||||||||||||||||
| 241 | 81 | ▶ | my $label_tag = $field->tag_exists('label_tag') ? $field->get_tag('label_tag') : 'label'; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 242 | 81 | return qq{<$label_tag$attrs for="} . $field->id . qq{">$label</$label_tag>}; | |||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||
| 245 | 3 | ▶ | sub render_compound { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_compound: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 246 | 3 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||
| 248 | 3 | my $output = ''; | |||||||||||||||||||||||||||||||||
| 249 | 3 | foreach my $subfield ( $field->sorted_fields ) { | |||||||||||||||||||||||||||||||||
| 250 | 9 | $output .= $self->render_field($subfield); | |||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||
| 252 | 3 | return $output; | |||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||
| 255 | 5 | ▶ | sub render_submit { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_submit: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 256 | 5 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||
| 258 | 5 | my $output = '<input type="submit" name="'; | |||||||||||||||||||||||||||||||||
| 259 | 5 | $output .= $field->html_name . '"'; | |||||||||||||||||||||||||||||||||
| 260 | 5 | $output .= ' id="' . $field->id . '"'; | |||||||||||||||||||||||||||||||||
| 261 | 5 | $output .= process_attrs($field->element_attributes); | |||||||||||||||||||||||||||||||||
| 262 | 5 | $output .= ' value="' . $field->html_filter($field->_localize($field->value)) . '" />'; | |||||||||||||||||||||||||||||||||
| 263 | 5 | return $output; | |||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | sub render_reset { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_reset: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 267 | 0 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||
| 269 | 0 | my $output = '<input type="reset" name="'; | |||||||||||||||||||||||||||||||||
| 270 | 0 | $output .= $field->html_name . '"'; | |||||||||||||||||||||||||||||||||
| 271 | 0 | $output .= ' id="' . $field->id . '"'; | |||||||||||||||||||||||||||||||||
| 272 | 0 | $output .= process_attrs($field->element_attributes); | |||||||||||||||||||||||||||||||||
| 273 | 0 | $output .= ' value="' . $field->html_filter($field->value) . '" />'; | |||||||||||||||||||||||||||||||||
| 274 | 0 | return $output; | |||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | sub render_captcha { | ||||||||||||||||||||||||||||||||
|
Subroutine
render_captcha: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 278 | 0 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||
| 280 | 0 | my $output = '<img src="' . $self->captcha_image_url . '"/>'; | |||||||||||||||||||||||||||||||||
| 281 | 0 | $output .= '<input id="' . $field->id . '" name="'; | |||||||||||||||||||||||||||||||||
| 282 | 0 | $output .= $field->html_name . '"/>'; | |||||||||||||||||||||||||||||||||
| 283 | 0 | return $output; | |||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||
| 287 | 8 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 288 | 8 | 1; | |||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||
| 290 | __END__ | ||||||||||||||||||||||||||||||||||