Bug 34650: Remove unnecessary CSRF check on edit_form
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / virtualshelves / tables / shelves_results.tt
1 [% USE raw %]
2 [% USE KohaDates %]
3 [% USE To %]
4 [% PROCESS 'i18n.inc' %]
5 {
6     "sEcho": [% sEcho | html %],
7     "iTotalRecords": [% iTotalRecords | html %],
8     "iTotalDisplayRecords": [% iTotalDisplayRecords | html %],
9     "aaData": [
10         [% FOREACH data IN aaData %]
11             {
12                 "dt_public":
13                     "[% data.public | html %]",
14                 "dt_shelfname":
15                     "<a href='/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% data.shelfnumber | html %]'>[% data.shelfname | html | $To %]</a>",
16                 "dt_count":
17                     "[% tnx('{count} item', '{count} items', count, { count = data.count }) | $raw %]",
18                 "dt_is_shared":
19                     "[% IF data.public %]<span>Public</span>[% ELSIF data.is_shared %]<span>Shared</span>[% ELSE %]<span>Private</span>[% END %]",
20                 "dt_owner":
21                     "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.owner | html %]'>[% data.firstname | html | $To %] [% data.surname | html | $To %]</a>",
22                 "dt_sortby":
23                     [% IF data.sortby == "author" %]"<span>Author</span>"[% ELSIF data.sortby == "copyrightdate" %]"<span>Year</span>"[% ELSIF data.sortby == "itemcallnumber" %]"<span>Call number</span>"[% ELSIF data.sortby == "dateadded" %]"<span>Date added</span>"[% ELSE %]"<span>Title</span>"[% END %],
24                 "dt_created_on":
25                     "[% data.created_on | $KohaDates %]",
26                 "dt_modification_time":
27                     "[% data.modification_time | $KohaDates %]",
28                 "dt_action":
29                     "[% PROCESS action_form shelfnumber=data.shelfnumber can_manage_shelf=data.can_manage_shelf can_delete_shelf=data.can_delete_shelf type=data.type %]"
30             }[% UNLESS loop.last %],[% END %]
31         [% END %]
32     ]
33 }
34
35 [% BLOCK action_form -%]
36 [%~ SET action_block = '' ~%]
37 [%~ IF can_manage_shelf OR can_delete_shelf ~%]
38     [%~ shelfnumber = shelfnumber | html ~%]
39     [%~ public      = public | html ~%]
40     [%~ IF can_manage_shelf ~%]
41         [%~ action_block =                '<form action="shelves.pl" method="get">' ~%]
42         [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
43         [%~ action_block = action_block _ '<input type="hidden" name="op" value="edit_form" />' ~%]
44         [%~ action_block = action_block _ '<input type="hidden" name="public" value="' _ public _ '" />' ~%]
45         [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
46         [%~ action_block = action_block _ '<button class="editshelf btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</button>' ~%]
47         [%~ action_block = action_block _ '</form> ' ~%]
48     [%~ END ~%]
49     [%~ IF can_delete_shelf ~%]
50         [%~ action_block = action_block _ ' <form action="shelves.pl" method="post">' ~%]
51         [%~ action_block = BLOCK ~%][%~ action_block | $raw ~%][%~ INCLUDE 'csrf-token.inc' | trim ~%][%~ END ~%]
52         [%~ action_block = action_block _ '<input type="hidden" name="shelves" value="1" />' ~%]
53         [%~ action_block = action_block _ '<input type="hidden" name="op" value="delete" />' ~%]
54         [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
55         [%~ action_block = action_block _ '<input type="hidden" name="public" value="' _ public _ '" />' ~%]
56         [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
57         [%~ action_block = action_block _ '<button type="submit" class="deleteshelf btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>' ~%]
58         [%~ action_block = action_block _ '</form>' ~%]
59     [%~ END ~%]
60     [%~ IF public AND allow_transfer ~%]
61         [%~ action_block = action_block _ ' <form action="shelves.pl" method="post">' ~%]
62         [%~ action_block = action_block _ '<input type="hidden" name="shelves" value="1" />' ~%]
63         [%~ action_block = action_block _ '<input type="hidden" name="op" value="transfer" />' ~%]
64         [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
65         [%~ action_block = action_block _ '<input type="hidden" name="public" value="1" />' ~%]
66         [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
67         [%~ action_block = action_block _ '<button type="submit" class="btn btn-default btn-xs"><i class="fa"></i> Transfer</button>' ~%]
68         [%~ action_block = action_block _ '</form>' ~%]
69     [%~ END ~%]
70 [%~ ELSE ~%]
71     [%~ SET action_block = 'None' ~%]
72 [%~ END ~%]
73 [%~ To.json(action_block) | $raw ~%]
74
75 [%~ END ~%]