chiark / gitweb /
mason/pastebin/%show: Don't flush FS buffers in `filter' child.
[odin-cgi] / mason / common / autohandler
1 %# -*-html-*-
2 %#
3 %# Common Mason machinery for Odin web services
4 %#
5 %# (c) 2015 Mark Wooding
6 %#
7 %#----- Licensing notice ----------------------------------------------------
8 %#
9 %# This file is part of the `odin.gg' service, `odin-cgi'.
10 %#
11 %# `odin-cgi' is free software; you can redistribute it and/or modify
12 %# it under the terms of the GNU Affero General Public License as
13 %# published by the Free Software Foundation; either version 3 of the
14 %# License, or (at your option) any later version.
15 %#
16 %# `odin-cgi' is distributed in the hope that it will be useful,
17 %# but WITHOUT ANY WARRANTY; without even the implied warranty of
18 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 %# GNU Affero General Public License for more details.
20 %#
21 %# You should have received a copy of the GNU Affero General Public
22 %# License along with `odin-cgi'; if not, see
23 %# <http://www.gnu.org/licenses/>.
24 %#
25 <%perl>
26         Odin::set_mason_failproc $m;
27         Odin::cgi_who $r;
28         Odin::fetch_cookies $r;
29         $r->content_type("text/html; charset=utf8");
30         $r->header_out("X-AGPL-Source" => $Odin::SRCURL);
31         $m->call_next;
32 </%perl>
33 %#
34 <%method wrapper>\
35 % $r->header_out(Status => $status) if defined $status;
36 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
37           "http://www.w3c.org/TR/html4/strict.dtd">
38
39 <html>
40 <head>
41 <link rel="stylesheet" type="text/css" href="<% $Odin::STATIC %>odin.css">
42 <meta name="viewport" content="width=device-width" initial-scale=1.0>
43 <& SELF:header &>
44 <title>\
45 % defined $title ? $m->print($title) : $m->comp("SELF:title");
46 </title>
47 </head>
48 <body>
49
50 <% $m->content %>
51 <div class="footer">
52 (c) 2015&ndash;2017 Mark Wooding;
53 <a href=<% $Odin::SRCURL %>>Free software</a><br>
54 </div>
55 </body>
56 </html>
57 <%args>
58         $status => undef
59         $title => undef
60 </%args>
61 </%method>
62 %#
63 <%method title>(Untitled page)</%method>
64 <%method header></%method>
65 %#
66 <%method error>\
67 <&| SELF:wrapper, status => $status, title => $title // $m->content &>\
68 <h1>\
69 % if (defined $title) {
70 Error: <% $title  %>\
71 % } else {
72 Error\
73 % }
74 </h1>
75 <p><% $m->content %>
76 </&>
77 <%args>
78         $status => 500
79         $title => undef
80 </%args>
81 </%method>
82 %#
83 <%init>
84         Odin::update_now;
85 </%init>
86 %#
87 <%once>
88         use utf8;
89         use Odin;
90 </%once>