line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kwiki::Theme; |
2
|
1
|
|
|
1
|
|
1665
|
use Kwiki::Plugin -Base; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use mixin 'Kwiki::Installer'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
const class_id => 'theme'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub register { |
8
|
|
|
|
|
|
|
my $register = shift; |
9
|
|
|
|
|
|
|
$register->add(preload => 'theme', |
10
|
|
|
|
|
|
|
priority => 1, |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
$register->add(prerequisite => 'toolbar'); |
13
|
|
|
|
|
|
|
$register->add(prerequisite => 'widgets'); |
14
|
|
|
|
|
|
|
$register->add(prerequisite => 'status'); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
const default_template_path => "theme/%s/template/tt2"; |
18
|
|
|
|
|
|
|
const default_css_path => "theme/%s/css"; |
19
|
|
|
|
|
|
|
const default_javascript_path => "theme/%s/javascript"; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
const default_css_file => 'kwiki.css'; |
22
|
|
|
|
|
|
|
const default_javascript_file => ''; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub init { |
25
|
|
|
|
|
|
|
super; |
26
|
|
|
|
|
|
|
my $theme_id = $self->theme_id; |
27
|
|
|
|
|
|
|
my $template_path = |
28
|
|
|
|
|
|
|
sprintf $self->default_template_path, $theme_id; |
29
|
|
|
|
|
|
|
$self->template->add_path($template_path) |
30
|
|
|
|
|
|
|
if -e $template_path; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $css_path = |
33
|
|
|
|
|
|
|
sprintf $self->default_css_path, $theme_id; |
34
|
|
|
|
|
|
|
$self->hub->css->add_path($css_path) |
35
|
|
|
|
|
|
|
if -e $css_path; |
36
|
|
|
|
|
|
|
$self->hub->css->add_file |
37
|
|
|
|
|
|
|
(ref $self->default_css_file |
38
|
|
|
|
|
|
|
? @{$self->default_css_file} |
39
|
|
|
|
|
|
|
: $self->default_css_file); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $javascript_path = |
42
|
|
|
|
|
|
|
sprintf $self->default_javascript_path, $theme_id; |
43
|
|
|
|
|
|
|
$self->hub->javascript->add_path($javascript_path) |
44
|
|
|
|
|
|
|
if -e $javascript_path; |
45
|
|
|
|
|
|
|
$self->hub->javascript->add_file |
46
|
|
|
|
|
|
|
(ref $self->default_javascript_file |
47
|
|
|
|
|
|
|
? @{$self->default_javascript_file} |
48
|
|
|
|
|
|
|
: $self->default_javascript_file); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$self->hub->cookie; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub resolve_install_path { |
54
|
|
|
|
|
|
|
sprintf shift, $self->theme_id; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__DATA__ |