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