--- Webpacus/lib/Webpacus/Controller/Editor.pm 2005/11/26 20:21:59 166 +++ Webpacus/lib/Webpacus/Controller/Editor.pm 2005/11/26 21:11:41 167 @@ -53,14 +53,16 @@ sub template : Local { my ( $self, $c ) = @_; - my $template_file = + my $template_filename = $c->req->params->{template_filename} || $c->config->{webpac}->{default_template} || $c->log->fatal("need default_template"); my $webpac = $c->comp('Model::WebPAC'); - 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"); + + my $template_full_path = "$template_path/$template_filename"; $c->log->debug("loading $template_full_path"); @@ -70,14 +72,27 @@ return; } + # load template html $c->stash->{'template_content'} = $webpac->load_html( $template_full_path ); + # load template list + + opendir(my $d, $template_path) || $c->log->fatal("can't opendir '$template_path': $!"); + my @templates = grep { /\.tt$/i } readdir($d); + + $c->stash->{template_list} = \@templates; + $c->stash->{template_filename} = $template_filename; + $c->stash->{template} = 'editor/template.tt'; } =item css +Return css. + +B + =cut sub css : Local { @@ -98,6 +113,8 @@ =item record +Return html of record taking C and C from request. + =cut sub record : Local { @@ -125,9 +142,10 @@ ); } -=back +=back + =head1 AUTHOR Dobrica Pavlinusic, C<< >>