Bug 19035 - Stored XSS in lists.pl
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patron_lists / lists.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Tools &rsaquo; Patron lists</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% INCLUDE 'greybox.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7
8 <script type="text/javascript">
9 //<![CDATA[
10     $(document).ready(function() {
11         var patronExportModal = $("#patronExportModal");
12         var patronExportModalBody = $("#patronExportModal .modal-body")
13
14         $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
15             "autoWidth": false,
16             "aoColumnDefs": [
17                 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }
18             ],
19             "sPaginationType": "four_button"
20         } ));
21         $(".delete_patron").on("click", function(){
22             $(".dropdown").removeClass("open");
23             var list = $(this).data("list-name");
24             return confirmDelete( _("Are you sure you want to delete the list %s?").format(list) );
25         });
26
27         $(".print_cards").on("click", function(e){
28             e.preventDefault();
29             var page = $(this).attr("href");
30             patronExportModalBody.load(page + " #exportingf");
31             patronExportModal.modal("show");
32         });
33
34         patronExportModal.on("hidden", function(){
35             patronExportModalBody.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
36         });
37
38         patronExportModal.on("submit", "#exportingf", function(e){
39             e.preventDefault();
40             modal_body = patronExportModalBody;
41             modal_body.html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
42             target_url = $(this).attr("action");
43             params =  $( this ).serialize();
44             modal_body.load( target_url + "?" + params + " #custom-doc");
45         });
46
47         patronExportModal.on("click",".closebtn,.gb-close",function(e){
48             e.preventDefault();
49             patronExportModal.modal("hide");
50         });
51
52     });
53 //]]>
54 </script>
55
56 </head>
57
58 <body id="patlist_lists" class="pat patlist">
59 [% INCLUDE 'header.inc' %]
60 [% INCLUDE 'cat-search.inc' %]
61 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Patron lists</div>
62
63 <div id="doc3" class="yui-t2">
64    <div id="bd">
65     <div id="yui-main">
66         <div class="yui-b">
67
68         <div id="toolbar" class="btn-toolbar">
69             <div class="btn-group">
70                 <a class="btn btn-default btn-sm" href="add-modify.pl"><i class="fa fa-plus"></i> New patron list</a>
71             </div>
72         </div>
73
74         <h1>Your patron lists</h1>
75
76         [% IF ( lists ) %]
77
78         <table id="patron-lists-table">
79             <thead>
80                 <tr>
81                     <th>Name</th>
82                     <th>Patrons in list</th>
83                     <th class="NoSort">&nbsp;</th>
84                 </tr>
85             </thead>
86
87             <tbody>
88                 [% FOREACH l IN lists %]
89                     <tr>
90                         <td>[% l.name |html %]</td>
91                         <td>[% l.patron_list_patrons_rs.count || 0 %]</td>
92                         <td>
93                             <div class="dropdown">
94                                 <a class="btn btn-default btn-xs dropdown-toggle" id="listactions[% l.patron_list_id %]" role="button" data-toggle="dropdown" href="#">
95                                    Actions <b class="caret"></b>
96                                 </a>
97                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="listactions[% l.patron_list_id %]">
98                                     <li><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id %]"><i class="fa fa-user"></i> Add patrons</a></li>
99                                     <li><a href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id %]"><i class="fa fa-pencil"></i> Edit list</a></li>
100                                     <li><a class="delete_patron" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id %]" data-list-name="[% l.name %]"><i class="fa fa-trash"></i> Delete list</a></li>
101                                     [% IF ( l.patron_list_patrons_rs.count ) %]
102                                         <li class="divider"></li>
103                                         <li>
104                                             <a class="print_cards" href="/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id %]" data-patron_list_id="[% l.patron_list_id %]"><i class="fa fa-print"></i> Print patron cards</a>
105                                         </li>
106                                         [% IF CAN_user_tools_edit_patrons %]
107                                             <li>
108                                                 <a href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id %]&op=show">
109                                                     <i class="fa fa-pencil"></i> Batch edit patrons
110                                                 </a>
111                                             </li>
112                                         [% END %]
113                                         [% IF CAN_user_tools_delete_anonymize_patrons %]
114                                             <li>
115                                                 <a href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id %]&checkbox=borrower">
116                                                     <i class="fa fa-trash"></i> Batch delete patrons
117                                                 </a>
118                                             </li>
119                                         [% END %]
120                                     [% END %]
121                                 </ul>
122                             </div>
123                         </td>
124                     </tr>
125                 [% END %]
126             </tbody>
127         </table>
128
129             <!-- Modal to print patron cards -->
130             <div class="modal" id="patronExportModal" tabindex="-1" role="dialog" aria-labelledby="patronExportModal_label" aria-hidden="true">
131                 <div class="modal-dialog">
132                 <div class="modal-content">
133                 <div class="modal-header">
134                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">&times;</button>
135                     <h3 id="patronExportModal_label">Print patron cards</h3>
136                 </div>
137                 <div class="modal-body">
138                     <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
139                 </div>
140                 </div>
141                 </div>
142             </div>
143
144         [% ELSE %]
145            <div class="dialog message">There are no patron lists.</div>
146         [% END %]
147
148             </div>
149         </div>
150         <div class="yui-b noprint">
151             [% INCLUDE 'tools-menu.inc' %]
152         </div>
153     </div>
154 [% INCLUDE 'intranet-bottom.inc' %]