41 |
|
|
42 |
$c->stash->{template_filename} = $template_filename; |
$c->stash->{template_filename} = $template_filename; |
43 |
|
|
44 |
|
$c->stash->{databases} = $c->comp('Model::Databases')->list_inputs; |
45 |
|
|
46 |
$c->stash->{template} = 'editor.tt'; |
$c->stash->{template} = 'editor.tt'; |
47 |
} |
} |
48 |
|
|
77 |
if ($webpac->save_html( $template_full_path, $t )) { |
if ($webpac->save_html( $template_full_path, $t )) { |
78 |
$c->res->output("<span>saved $template_filename, $size bytes</span>"); |
$c->res->output("<span>saved $template_filename, $size bytes</span>"); |
79 |
} else { |
} else { |
80 |
$c->res->output("<span>error saving $template_filename!</span>"); |
$c->res->output("<span class=\"error\">error saving $template_filename!</span>"); |
81 |
} |
} |
82 |
return; |
return; |
83 |
} |
} |
133 |
if ($webpac->save_html( $css_full_path, $t )) { |
if ($webpac->save_html( $css_full_path, $t )) { |
134 |
$c->res->output("<span>saved $css_filename, $size bytes</span>"); |
$c->res->output("<span>saved $css_filename, $size bytes</span>"); |
135 |
} else { |
} else { |
136 |
$c->res->output("<span>error saving $css_filename!</span>"); |
$c->res->output("<span class=\"error\">error saving $css_filename!</span>"); |
137 |
} |
} |
138 |
return; |
return; |
139 |
} |
} |
158 |
|
|
159 |
$c->log->debug('record params '.Dumper($c->req->params)); |
$c->log->debug('record params '.Dumper($c->req->params)); |
160 |
|
|
161 |
my $mfn = $c->req->params->{mfn}; |
my $record_uri = $c->req->params->{record_uri}; |
162 |
|
$record_uri ||= $c->config->{editor}->{default_record_uri} and |
163 |
if (! $mfn) { |
$c->log->warn("using editor: default_record_uri"); |
164 |
$c->log->warn("no mfn, using 1"); |
|
165 |
$mfn = 1; |
if (! $record_uri) { |
166 |
|
$c->log->fatal("record called without record_uri and default_record_uri not found in config under editor"); |
167 |
|
$c->stash->{error} = 'record retrival failed'; |
168 |
|
$c->stash->{template} = 'error.tt'; |
169 |
|
return; |
170 |
} |
} |
171 |
|
|
172 |
my $template_filename = $c->req->params->{template_filename}; |
my $template_filename = $c->req->params->{template_filename}; |
177 |
|
|
178 |
my $webpac = $c->comp('Model::WebPAC'); |
my $webpac = $c->comp('Model::WebPAC'); |
179 |
|
|
180 |
my $html = $webpac->record( mfn => $mfn, template => $template_filename ); |
my $html = $webpac->record( record_uri => $record_uri, template => $template_filename ); |
181 |
|
|
182 |
if ($html) { |
if ($html) { |
183 |
$c->log->debug('check html with tidy'); |
$c->log->debug('check html with tidy'); |
222 |
} else { |
} else { |
223 |
$html .= qq{<div class="no_results">Can't find record</div>}; |
$html .= qq{<div class="no_results">Can't find record</div>}; |
224 |
} |
} |
225 |
|
|
|
|
|
226 |
$c->response->content_type('text/html; charset=utf-8'); |
$c->response->content_type('text/html; charset=utf-8'); |
227 |
$c->response->body( $html ); |
$c->response->body( $html ); |
228 |
} |
} |