line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kwiki::Theme::BlueOcean; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
27149
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
398
|
use Kwiki::Theme '-Base'; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use mixin 'Kwiki::Installer'; |
7
|
|
|
|
|
|
|
use Template::Stash; |
8
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
const theme_id => 'blueocean'; |
11
|
|
|
|
|
|
|
const class_title => 'Blue Kwiki Theme'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$Template::Stash::SCALAR_OPS->{'image_desc'} = sub { |
14
|
|
|
|
|
|
|
$_[0] =~ s/alt\s*=\s*"([^\"]+)"([^\>]*)\>/alt="$1" $2> $1<\/span>/gi; |
15
|
|
|
|
|
|
|
return $_[0]; |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub register { |
19
|
|
|
|
|
|
|
super |
20
|
|
|
|
|
|
|
my $registry = shift; |
21
|
|
|
|
|
|
|
$registry->add(hook => 'user_preferences:preference_objects', |
22
|
|
|
|
|
|
|
post => 'tweak_kwiki_user_name_query', |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
$registry->add(hook => 'user_preferences:preference_objects', |
25
|
|
|
|
|
|
|
post => 'remove_show_icons_option', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
$registry->add(hook => 'user_preferences:user_preferences', |
28
|
|
|
|
|
|
|
pre => 'redirect_on_pref_save', |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
$registry->add(hook => 'icons:init', |
31
|
|
|
|
|
|
|
post => 'add_local_template_path', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub add_local_template_path { |
36
|
|
|
|
|
|
|
$self->template->add_path('local/template'); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub tweak_kwiki_user_name_query { |
40
|
|
|
|
|
|
|
my $new_text = <
|
41
|
|
|
|
|
|
|
Enter a UserName to identify yourself. |
42
|
|
|
|
|
|
|
(Must be alphanumeric with NO whitespace) |
43
|
|
|
|
|
|
|
HTML |
44
|
|
|
|
|
|
|
return [map { |
45
|
|
|
|
|
|
|
$_->query($new_text) |
46
|
|
|
|
|
|
|
if $_->id eq 'user_name'; |
47
|
|
|
|
|
|
|
$_; |
48
|
|
|
|
|
|
|
} @{$_[-1]->returned}]; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub remove_show_icons_option { |
52
|
|
|
|
|
|
|
return [grep { |
53
|
|
|
|
|
|
|
$_->id ne 'use_icons' |
54
|
|
|
|
|
|
|
} @{$_[-1]->returned}]; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub redirect_on_pref_save { |
58
|
|
|
|
|
|
|
$self->get_preference_objects; |
59
|
|
|
|
|
|
|
my $errors = 0; |
60
|
|
|
|
|
|
|
if( $self->cgi->button ) { |
61
|
|
|
|
|
|
|
$errors = $self->save; |
62
|
|
|
|
|
|
|
unless( $errors ) { |
63
|
|
|
|
|
|
|
$_[-1]->cancel(); |
64
|
|
|
|
|
|
|
return $self->redirect($self->pages->current->uri); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; # End of Kwiki::Theme::BlueOcean |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__DATA__ |