[tmp page_title]__COMPANY__ -- [L]Edit Page Content[/L][/tmp] [tmpn display_class]noleft[/tmpn] [set bounce_error][/set] [set bounce_success][/set] [set pagename][/set] [set pagedata][/set] [if !session admin] [error name=edit_permission set="Not authorized to edit pages, not admin."] [bounce page=admin/edit_error] [/if] [perl] my $pn = $CGI->{page_name}; $pn =~ s/\.html$//; my $fn = "pages/$pn.html"; if(! -f $fn) { $Tag->error({ name => 'edit_page', set => "$fn does not exist"}); $Scratch->{bounce_error} = 1; } my $pagedata = $Tag->file($fn); my $preamble; my $postamble; ( $pagedata =~ s{(.*)\n", $newdata, "\n", $postamble; $Tag->write_relative_file($fn, $newpage); $Scratch->{bounce_success} = 1; $Scratch->{bounce_page} = $pn; } else { $Scratch->{allowed_pages} ||= {}; $Scratch->{allowed_pages}{$pn} = 1; } $Scratch->{pagename} = $pn; $Scratch->{pagedata} = $pagedata; return; [/perl] [bounce page=admin/edit_error if="[scratch bounce_error]"] [bounce page="[scratch bounce_page]" if="[scratch bounce_success]"] @_TOP_@ [form-session-id] [display type=textarea height=30 name=page_data value="[scratch pagedata]" class="form-control"]
@_BOTTOM_@