chiark / gitweb /
mason/pastebin/: Add `New' links to the `show' and `edit' pages.
[odin-cgi] / mason / pastebin / %edit
CommitLineData
be24e9af
MW
1<&| SELF:wrapper, title => "odin.gg Paste Bin" &>
2<h1><tt>odin.gg</tt> Paste Bin</h1>
3%#
4% my $sep = "<div class=menu>\n";
5% my $end = "";
6% if (length $tag) {
7% $m->print($sep);
8 <span class="item"><a href="<% "$Odin::PASTEBIN/$tag" %>">View</a></span>
9 <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?edit=$edit;op=del" %>">Delete</a></span>
7f77ead8 10 <span class="item"><a href="<% "$Odin::PASTEBIN/" %>">New</a></span>
be24e9af
MW
11% $sep = ""; $end = "</div>\n";
12% }
13% $m->print($end);
14%#
15<form method="POST" action="<% "$Odin::PASTEBIN/$tag" %>"
16 accept-charset="UTF-8" enctype="multipart/form-data">
17 <div class="pastebin">
18% if (defined $edit) {
19 <input type="hidden" name="edit" value="<% $edit |h %>">
20% }
21%#
22 <label class="invis" for="content" accesskey="c"><u>C</u>ontent</label>
23 <textarea id="content" name="content" rows=48 cols=80><%
24 $content |h %></textarea>
25%#
26 <div class="paste-widgets">
27%#
28 <label class="invis" for="lang" accesskey="l"><u>L</u>abel</label>
97a33b9c 29 <select id="lang" name="lang" default="txt">
be24e9af
MW
30% my $lh = $db->selectall_hashref
31% ("SELECT lang, descr FROM odin_pastebin_lang", "descr");
32% for my $d (sort { Odin::nice_name $a cmp Odin::nice_name $b }
33% keys %$lh) {
34% my $l = $lh->{$d}{lang};
35 <option value="<% $l %>"<%
36 $l eq $lang ? " selected" : "" %>><%
37 $d |h %></option>
38% }
39 </select>
40%#
41 <label class="invis" for="title" accesskey="t"><u>T</u>itle</label>
42 <input id="title" name="title" value="<% $title |h %>">
43%#
44 <button type="submit">Go</button>
45%#
46 </div>
47 </div>
48</form>
49</&>
50%#
51<%args>
52 $content => ""
53 $tag => ""
54 $edit => undef
55 $lang => "txt"
56 $title => "(untitled)"
57</%args>
58%#
59<%init>
60 my $db = Odin::open_db;
61</%init>
62%#
63<%once>
64 use utf8;
65</%once>