chiark / gitweb /
Make a licensing decision: it's all AGPLv3+.
[odin-cgi] / mason / pastebin / %edit
CommitLineData
128543b0
MW
1%# -*-html-*-
2%#
3%# Pastebin editing webservice for Odin
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<&| SELF:wrapper, title => "odin.gg Paste Bin" &>
26<h1><tt>odin.gg</tt> Paste Bin</h1>
27%#
28% my $sep = "<div class=menu>\n";
29% my $end = "";
30% if (length $tag) {
31% $m->print($sep);
32 <span class="item"><a href="<% "$Odin::PASTEBIN/$tag" %>">View</a></span>
33 <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?edit=$edit;op=del" %>">Delete</a></span>
7f77ead8 34 <span class="item"><a href="<% "$Odin::PASTEBIN/" %>">New</a></span>
be24e9af
MW
35% $sep = ""; $end = "</div>\n";
36% }
37% $m->print($end);
38%#
39<form method="POST" action="<% "$Odin::PASTEBIN/$tag" %>"
40 accept-charset="UTF-8" enctype="multipart/form-data">
41 <div class="pastebin">
42% if (defined $edit) {
43 <input type="hidden" name="edit" value="<% $edit |h %>">
44% }
45%#
46 <label class="invis" for="content" accesskey="c"><u>C</u>ontent</label>
47 <textarea id="content" name="content" rows=48 cols=80><%
48 $content |h %></textarea>
49%#
50 <div class="paste-widgets">
51%#
52 <label class="invis" for="lang" accesskey="l"><u>L</u>abel</label>
97a33b9c 53 <select id="lang" name="lang" default="txt">
be24e9af
MW
54% my $lh = $db->selectall_hashref
55% ("SELECT lang, descr FROM odin_pastebin_lang", "descr");
56% for my $d (sort { Odin::nice_name $a cmp Odin::nice_name $b }
57% keys %$lh) {
58% my $l = $lh->{$d}{lang};
59 <option value="<% $l %>"<%
60 $l eq $lang ? " selected" : "" %>><%
61 $d |h %></option>
62% }
63 </select>
64%#
65 <label class="invis" for="title" accesskey="t"><u>T</u>itle</label>
66 <input id="title" name="title" value="<% $title |h %>">
67%#
68 <button type="submit">Go</button>
69%#
70 </div>
71 </div>
72</form>
73</&>
74%#
75<%args>
76 $content => ""
77 $tag => ""
78 $edit => undef
79 $lang => "txt"
80 $title => "(untitled)"
81</%args>
82%#
83<%init>
84 my $db = Odin::open_db;
85</%init>
86%#
87<%once>
88 use utf8;
89</%once>