chiark / gitweb /
38cc9c49764461f7c0ec997855136a8760bfe8a7
[odin-cgi] / mason / pastebin / %edit
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>
10 % $sep = ""; $end = "</div>\n";
11 % }
12 % $m->print($end);
13 %#
14 <form method="POST" action="<% "$Odin::PASTEBIN/$tag" %>"
15       accept-charset="UTF-8" enctype="multipart/form-data">
16   <div class="pastebin">
17 % if (defined $edit) {
18     <input type="hidden" name="edit" value="<% $edit |h %>">
19 % }
20 %#
21     <label class="invis" for="content" accesskey="c"><u>C</u>ontent</label>
22     <textarea id="content" name="content" rows=48 cols=80><%
23         $content |h %></textarea>
24 %#
25     <div class="paste-widgets">
26 %#
27       <label class="invis" for="lang" accesskey="l"><u>L</u>abel</label>
28       <select id="lang" name="lang" default="txt">
29 %     my $lh = $db->selectall_hashref
30 %       ("SELECT lang, descr FROM odin_pastebin_lang", "descr");
31 %     for my $d (sort { Odin::nice_name $a cmp Odin::nice_name $b }
32 %                     keys %$lh) {
33 %       my $l = $lh->{$d}{lang};
34         <option value="<% $l %>"<%
35           $l eq $lang ? " selected" : "" %>><%
36           $d |h %></option>
37 %     }
38       </select>
39 %#
40       <label class="invis" for="title" accesskey="t"><u>T</u>itle</label>
41       <input id="title" name="title" value="<% $title |h %>">
42 %#
43       <button type="submit">Go</button>
44 %#
45     </div>
46   </div>
47 </form>
48 </&>
49 %#
50 <%args>
51         $content => ""
52         $tag => ""
53         $edit => undef
54         $lang => "txt"
55         $title => "(untitled)"
56 </%args>
57 %#
58 <%init>
59         my $db = Odin::open_db;
60 </%init>
61 %#
62 <%once>
63         use utf8;
64 </%once>