Bug 20891: Escape list's names in JSON
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / virtualshelves / tables / shelves_results.tt
1 [% USE KohaDates %]
2 [% USE To %]
3 {
4     "sEcho": [% sEcho %],
5     "iTotalRecords": [% iTotalRecords %],
6     "iTotalDisplayRecords": [% iTotalDisplayRecords %],
7     "aaData": [
8         [% FOREACH data IN aaData %]
9             {
10                 "dt_type":
11                     "[% data.type %]",
12                 "dt_shelfname":
13                     "<a href='/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% data.shelfnumber | html %]'>[% To.json(data.shelfname) | html%]</a>",
14                 "dt_count":
15                     "[% data.count %] item(s)",
16                 "dt_is_shared":
17                     "[% IF data.type == 2 %]Public[% ELSIF data.is_shared %]Shared[% ELSE %]Private[% END %]",
18                 "dt_owner":
19                     "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.owner | html %]'>[% To.json(data.firstname) | html %] [% To.json(data.surname) | html %]</a>",
20                 "dt_sortby":
21                     [% IF data.sortby == "author" %]"Author"[% ELSIF data.sortby == "copyrightdate" %]"Year"[% ELSIF data.sortby == "itemcallnumber" %]"Call number"[% ELSE %]"Title"[% END %],
22                 "dt_created_on":
23                     "[% data.created_on | $KohaDates %]",
24                 "dt_modification_time":
25                     "[% data.modification_time | $KohaDates %]",
26                 "dt_action":
27                     "[% PROCESS action_form shelfnumber=data.shelfnumber can_manage_shelf=data.can_manage_shelf can_delete_shelf=data.can_delete_shelf type=data.type %]"
28             }[% UNLESS loop.last %],[% END %]
29         [% END %]
30     ]
31 }
32
33 [% BLOCK action_form -%]
34 [%~ SET action_block = '' ~%]
35 [%~ IF can_manage_shelf OR can_delete_shelf ~%]
36     [%~ IF can_manage_shelf ~%]
37         [%~ action_block =                '<form action="shelves.pl" method="get">' ~%]
38         [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
39         [%~ action_block = action_block _ '<input type="hidden" name="op" value="edit_form" />' ~%]
40         [%~ action_block = action_block _ '<input type="hidden" name="category" value="' _ type _ '" />' ~%]
41         [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
42         [%~ action_block = action_block _ '<button class="editshelf btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</button>' ~%]
43         [%~ action_block = action_block _ '</form> ' ~%]
44     [%~ END ~%]
45     [%~ IF can_manage_shelf OR can_delete_shelf ~%]
46         [%~ action_block = action_block _ ' <form action="shelves.pl" method="post">' ~%]
47         [%~ action_block = action_block _ '<input type="hidden" name="shelfoff" value="' _ shelfoff _ '" />' ~%]
48         [%~ action_block = action_block _ '<input type="hidden" name="shelves" value="1" />' ~%]
49         [%~ action_block = action_block _ '<input type="hidden" name="op" value="delete" />' ~%]
50         [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
51         [%~ action_block = action_block _ '<input type="hidden" name="category" value="' _ type _ '" />' ~%]
52         [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
53         [%~ action_block = action_block _ '<button type="submit" class="deleteshelf btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>' ~%]
54         [%~ action_block = action_block _ '</form>' ~%]
55     [%~ END ~%]
56 [%~ ELSE ~%]
57     [%~ SET action_block = 'None' ~%]
58 [%~ END ~%]
59 [%~ To.json(action_block) ~%]
60 [%~ END ~%]