53 |
sub template : Local { |
sub template : Local { |
54 |
my ( $self, $c ) = @_; |
my ( $self, $c ) = @_; |
55 |
|
|
56 |
my $template_file = |
my $template_filename = |
57 |
$c->req->params->{template_filename} || |
$c->req->params->{template_filename} || |
58 |
$c->config->{webpac}->{default_template} || |
$c->config->{webpac}->{default_template} || |
59 |
$c->log->fatal("need default_template"); |
$c->log->fatal("need default_template"); |
60 |
|
|
61 |
my $webpac = $c->comp('Model::WebPAC'); |
my $webpac = $c->comp('Model::WebPAC'); |
62 |
|
|
63 |
my $template_full_path = $webpac->{template_path} . "/$template_file"; |
my $template_path = $webpac->{template_path} || $c->log->fatal("can't find template_path in Model::WebPAC"); |
64 |
|
|
65 |
|
my $template_full_path = "$template_path/$template_filename"; |
66 |
|
|
67 |
$c->log->debug("loading $template_full_path"); |
$c->log->debug("loading $template_full_path"); |
68 |
|
|
72 |
return; |
return; |
73 |
} |
} |
74 |
|
|
75 |
|
# load template html |
76 |
$c->stash->{'template_content'} = |
$c->stash->{'template_content'} = |
77 |
$webpac->load_html( $template_full_path ); |
$webpac->load_html( $template_full_path ); |
78 |
|
|
79 |
|
# load template list |
80 |
|
|
81 |
|
opendir(my $d, $template_path) || $c->log->fatal("can't opendir '$template_path': $!"); |
82 |
|
my @templates = grep { /\.tt$/i } readdir($d); |
83 |
|
|
84 |
|
$c->stash->{template_list} = \@templates; |
85 |
|
$c->stash->{template_filename} = $template_filename; |
86 |
|
|
87 |
$c->stash->{template} = 'editor/template.tt'; |
$c->stash->{template} = 'editor/template.tt'; |
88 |
} |
} |
89 |
|
|
90 |
=item css |
=item css |
91 |
|
|
92 |
|
Return css. |
93 |
|
|
94 |
|
B<Not finished> |
95 |
|
|
96 |
=cut |
=cut |
97 |
|
|
98 |
sub css : Local { |
sub css : Local { |
113 |
|
|
114 |
=item record |
=item record |
115 |
|
|
116 |
|
Return html of record taking C<mfn> and C<template_filename> from request. |
117 |
|
|
118 |
=cut |
=cut |
119 |
|
|
120 |
sub record : Local { |
sub record : Local { |
142 |
); |
); |
143 |
} |
} |
144 |
|
|
|
=back |
|
145 |
|
|
146 |
|
|
147 |
|
=back |
148 |
|
|
149 |
=head1 AUTHOR |
=head1 AUTHOR |
150 |
|
|
151 |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |