--- Webpacus/lib/Webpacus/Controller/Editor.pm 2005/11/26 21:11:41 167 +++ Webpacus/lib/Webpacus/Controller/Editor.pm 2005/11/27 01:42:33 172 @@ -64,6 +64,18 @@ my $template_full_path = "$template_path/$template_filename"; + if ($c->req->params->{save_template}) { + my $t = $c->req->params->{template_content}; + my $size = length($t); + $c->log->debug("saving $template_full_path, $size bytes"); + if ($webpac->save_html( $template_full_path, $t )) { + $c->res->output("saved $template_filename, $size bytes"); + } else { + $c->res->output("error saving $template_filename!"); + } + return; + } + $c->log->debug("loading $template_full_path"); if (! -r $template_full_path) { @@ -98,11 +110,23 @@ sub css : Local { my ( $self, $c ) = @_; - my $css_file = $c->config->{webpac}->{default_css} || die("need default_css"); + my $css_filename = $c->config->{webpac}->{default_css} || die("need default_css"); my $css_path = $c->config->{webpac}->{css_path} || die("need css_path"); my $webpac = $c->comp('Model::WebPAC'); - my $css_full_path = "$css_path/$css_file"; + my $css_full_path = "$css_path/$css_filename"; + + if ($c->req->params->{save_css}) { + my $t = $c->req->params->{css_content}; + my $size = length($t); + $c->log->debug("saving $css_full_path, $size bytes"); + if ($webpac->save_html( $css_full_path, $t )) { + $c->res->output("saved $css_filename, $size bytes"); + } else { + $c->res->output("error saving $css_filename!"); + } + return; + } $c->log->debug("loading $css_full_path");