| 1 | package Kwiki::Display; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Kwiki::Plugin -Base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use mixin 'Kwiki::Installer'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | const config_file => 'display.yaml'; | |||||||||||||||||||||||||||
| 6 | 1 | const class_id => 'display'; | |||||||||||||||||||||||||||
| 7 | 1 | const class_title => 'Page Display'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 0 | ▶ | sub register { | ||||||||||||||||||||||||||
|
Subroutine
register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 0 | my $registry = shift; | |||||||||||||||||||||||||||
| 11 | 0 | $registry->add(action => 'display'); | |||||||||||||||||||||||||||
| 12 | 0 | $registry->add(toolbar => 'home_button', | |||||||||||||||||||||||||||
| 13 | template => 'home_button.html', | ||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||
| 15 | 0 | $registry->add(preference => $self->display_changed_by); | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub display_changed_by { | ||||||||||||||||||||||||||
|
Subroutine
display_changed_by: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 0 | my $p = $self->new_preference('display_changed_by'); | |||||||||||||||||||||||||||
| 20 | 0 | $p->query('Show a "Changed by ..." section on each page?'); | |||||||||||||||||||||||||||
| 21 | 0 | $p->default(0); | |||||||||||||||||||||||||||
| 22 | 0 | return $p; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub display { | ||||||||||||||||||||||||||
|
Subroutine
display: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | 0 | my $page = $self->pages->current; | |||||||||||||||||||||||||||
| 27 | 0 | ▶ | return $self->redirect('') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | unless $page; | ||||||||||||||||||||||||||||
| 29 | 0 | my $page_title = $page->title; | |||||||||||||||||||||||||||
| 30 | 0 | my $page_uri = $page->uri; | |||||||||||||||||||||||||||
| 31 | 0 | ▶ | return $self->redirect("action=edit;page_name=$page_uri") | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $page->exists and $self->have_plugin("edit")
MC/DC0%0/2
not $page->exists and $self->have_plugin("edit")
not $page->exists
$self->have_plugin("edit")
Truth table0%0/3
not(A) and B
A= not $page->existsB= $self->have_plugin("edit")
| |||||||||||||||||||||||||||||
| 32 | if not($page->exists) and $self->have_plugin('edit'); | ||||||||||||||||||||||||||||
| 33 | 0 | my $script = $self->config->script_name; | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | my $screen_title = $self->hub->have_plugin('search') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | ? "<a href=\"$script?action=search;search_term=$page_uri\">$page_title</a>" | ||||||||||||||||||||||||||||
| 36 | : $page_title; | ||||||||||||||||||||||||||||
| 37 | 0 | eval { | |||||||||||||||||||||||||||
| 38 | 0 | $page->content; | |||||||||||||||||||||||||||
| 39 | }; | ||||||||||||||||||||||||||||
| 40 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 0 | my $main_page = $self->config->main_page; | |||||||||||||||||||||||||||
| 42 | 0 | ▶ | die $@ if $page->title eq $main_page; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 0 | return $self->redirect($main_page); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | $self->render_screen( | ||||||||||||||||||||||||||||
| 46 | 0 | screen_title => $screen_title, | |||||||||||||||||||||||||||
| 47 | page_html => $page->to_html, | ||||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 1 | __DATA__ | |||||||||||||||||||||||||||