mason/common/autohandler: Add an AGPL link to the HTML header.
[odin-cgi] / mason / common / autohandler
CommitLineData
128543b0
MW
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%#
be24e9af
MW
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");
2322e7a8 30 $r->header_out("X-AGPL-Source" => $Odin::SRCURL);
be24e9af
MW
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>
4d7d891c 41<link rel="license" "type="text/html" href="https://www.gnu.org/licenses/agpl-3.0.html">
be24e9af
MW
42<link rel="stylesheet" type="text/css" href="<% $Odin::STATIC %>odin.css">
43<meta name="viewport" content="width=device-width" initial-scale=1.0>
44<& SELF:header &>
45<title>\
46% defined $title ? $m->print($title) : $m->comp("SELF:title");
47</title>
48</head>
49<body>
50
51<% $m->content %>
52<div class="footer">
128543b0
MW
53(c) 2015&ndash;2017 Mark Wooding;
54<a href=<% $Odin::SRCURL %>>Free software</a><br>
be24e9af
MW
55</div>
56</body>
57</html>
58<%args>
59 $status => undef
60 $title => undef
61</%args>
62</%method>
63%#
64<%method title>(Untitled page)</%method>
65<%method header></%method>
66%#
67<%method error>\
68<&| SELF:wrapper, status => $status, title => $title // $m->content &>\
69<h1>\
70% if (defined $title) {
71Error: <% $title %>\
72% } else {
73Error\
74% }
75</h1>
76<p><% $m->content %>
77</&>
78<%args>
79 $status => 500
80 $title => undef
81</%args>
82</%method>
83%#
503f7910
MW
84<%init>
85 Odin::update_now;
86</%init>
87%#
be24e9af
MW
88<%once>
89 use utf8;
90 use Odin;
91</%once>