| 1 | package HTML::Latemp::NavLinks::GenHtml::ArrowImages; | ||||||||||||
| 2 | |||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 4 | our $VERSION = '0.2.6'; | |||||||||||
| 7 | |||||||||||||
| 8 | 4 | ▶ | use vars qw($nav_buttons_html); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 4 | ▶ | use parent 'HTML::Latemp::NavLinks::GenHtml'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | |||||||||||||
| 12 | 4 | __PACKAGE__->mk_accessors(qw( | |||||||||||
| 13 | _ext | ||||||||||||
| 14 | ) | ||||||||||||
| 15 | ); | ||||||||||||
| 16 | |||||||||||||
| 17 | sub _init | ||||||||||||
| 18 | { | ||||||||||||
| 19 | 2 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
_init: called CC=2 SCAR=6.9
| |||||||||||||
| 20 | 2 | my (%args) = (@_); | |||||||||||
| 21 | |||||||||||||
| 22 | 2 | $self->SUPER::_init(%args); | |||||||||||
| 23 | |||||||||||||
| 24 | 2 | ▶ | $self->_ext($args{ext} || '.png'); | ||||||||||
|
Condition100%2/2
$args{'ext'} || '.png'
MC/DC100%1/1
$args{'ext'} || '.png'
$args{'ext'}
Truth table100%2/2
A
A= $args{'ext'}
| |||||||||||||
| 25 | |||||||||||||
| 26 | 2 | return; | |||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | |||||||||||||
| 30 | 4 | ▶ | use Template; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 31 | |||||||||||||
| 32 | # load Template::Stash to make method tables visible | ||||||||||||
| 33 | 4 | ▶ | use Template::Stash; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 34 | |||||||||||||
| 35 | # Define a method to return a substring. | ||||||||||||
| 36 | $Template::Stash::SCALAR_OPS->{ 'substr' } = sub { | ||||||||||||
| 37 | 6 | ▶ | return substr($_[0], $_[1], $_[2]); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 38 | 4 | }; | |||||||||||
| 39 | |||||||||||||
| 40 | sub _get_nav_buttons_html | ||||||||||||
| 41 | { | ||||||||||||
| 42 | 2 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
_get_nav_buttons_html: called CC=1 SCAR=0.0
| |||||||||||||
| 43 | |||||||||||||
| 44 | 2 | my (%args) = (@_); | |||||||||||
| 45 | |||||||||||||
| 46 | 2 | my $with_accesskey = $args{'with_accesskey'}; | |||||||||||
| 47 | |||||||||||||
| 48 | 2 | my $root = $self->root(); | |||||||||||
| 49 | |||||||||||||
| 50 | 2 | my $template = | |||||||||||
| 51 | Template->new( | ||||||||||||
| 52 | { | ||||||||||||
| 53 | 'POST_CHOMP' => 1, | ||||||||||||
| 54 | } | ||||||||||||
| 55 | ); | ||||||||||||
| 56 | |||||||||||||
| 57 | 2 | my $vars = | |||||||||||
| 58 | { | ||||||||||||
| 59 | 'buttons' => $self->_get_buttons(), | ||||||||||||
| 60 | 'root' => $root, | ||||||||||||
| 61 | 'with_accesskey' => $with_accesskey, | ||||||||||||
| 62 | 'image_base' => $self->get_image_base(), | ||||||||||||
| 63 | ext => $self->_ext(), | ||||||||||||
| 64 | }; | ||||||||||||
| 65 | |||||||||||||
| 66 | 2 | my $nav_links_template = <<'EOF'; | |||||||||||
| 67 | [% USE HTML %] | ||||||||||||
| 68 | [% FOREACH b = buttons %] | ||||||||||||
| 69 | [% SET key = b.dir.substr(0, 1) %] | ||||||||||||
| 70 | <li> | ||||||||||||
| 71 | [% IF b.exists %] | ||||||||||||
| 72 | <a href="[% HTML.escape(b.link_obj.direct_url()) %]" title="[% b.title %] (Alt+[% key FILTER upper %])" | ||||||||||||
| 73 | [% IF with_accesskey %] | ||||||||||||
| 74 | accesskey="[% key %]" | ||||||||||||
| 75 | [% END %] | ||||||||||||
| 76 | >[% END %]<img src="[% root %]/images/[% image_base %][% b.button %][% UNLESS b.exists %]-disabled[% END %][% ext %]" | ||||||||||||
| 77 | alt="[% b.title %]" class="bless" />[% IF b.exists %]</a> | ||||||||||||
| 78 | [% END %] | ||||||||||||
| 79 | </li> | ||||||||||||
| 80 | [% END %] | ||||||||||||
| 81 | EOF | ||||||||||||
| 82 | |||||||||||||
| 83 | 2 | my $nav_buttons_html = ""; | |||||||||||
| 84 | |||||||||||||
| 85 | 2 | $template->process(\$nav_links_template, $vars, \$nav_buttons_html); | |||||||||||
| 86 | 2 | return $nav_buttons_html; | |||||||||||
| 87 | } | ||||||||||||
| 88 | |||||||||||||
| 89 | |||||||||||||
| 90 | |||||||||||||
| 91 | sub get_image_base | ||||||||||||
| 92 | { | ||||||||||||
| 93 | 2 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
get_image_base: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 94 | |||||||||||||
| 95 | 2 | return "arrow-"; | |||||||||||
| 96 | } | ||||||||||||
| 97 | |||||||||||||
| 98 | |||||||||||||
| 99 | sub get_total_html | ||||||||||||
| 100 | { | ||||||||||||
| 101 | 2 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
get_total_html: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 102 | |||||||||||||
| 103 | 2 | return "<ul class=\"nav_links\">\n" . | |||||||||||
| 104 | $self->_get_nav_buttons_html(@_) . | ||||||||||||
| 105 | "\n</ul>"; | ||||||||||||
| 106 | } | ||||||||||||
| 107 | |||||||||||||
| 108 | |||||||||||||
| 109 | 4 | 1; | |||||||||||
| 110 | |||||||||||||
| 111 | __END__ | ||||||||||||