Bug 12123: Prevent HTML notices to break the notice viewer
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / notices.tt
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE AuthorisedValues %]
4 [% USE Branches %]
5 [% USE KohaDates %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Sent notices for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% Asset.css("css/datatables.css") %]
11 <style type="text/css">
12     .notice { display: none; }
13     .notice-title { font-weight: bold; display: block; }
14 </style>
15 </head>
16
17 <body id="pat_notices" class="pat">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'patron-search.inc' %]
20
21 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Sent notices for [% INCLUDE 'patron-title.inc' %]</div>
22
23 <div id="doc3" class="yui-t2">
24     <div id="bd">
25     <div id="yui-main">
26     <div class="yui-b">
27 [% INCLUDE 'members-toolbar.inc' %]
28 <h1>Sent notices for [% INCLUDE 'patron-title.inc' %]</h1>
29
30 [% IF ( QUEUED_MESSAGES ) %]
31     <table id="noticestable">
32         <thead>
33             <tr>
34                 <th>Notice</th>
35                 <th>Type</th>
36                 <th>Status</th>
37                 <th>Time</th>
38             </tr>
39         </thead>
40         <tbody>
41             [% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %]
42             <tr>
43                 <td>
44             <a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id %]" href="#">[% QUEUED_MESSAGE.subject %]</a>
45             <div id="notice[% QUEUED_MESSAGE.message_id %]" class="notice">
46                 <iframe srcdoc="[% QUEUED_MESSAGE.content FILTER html_line_break FILTER html %]"></iframe>
47             </div>
48         </td>
49                 <td>
50             [% IF ( QUEUED_MESSAGE.message_transport_type == 'email' ) %]email
51             [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'print' ) %]print
52             [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'feed' ) %]feed
53             [% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'sms' ) %]sms
54             [% ELSE %][% QUEUED_MESSAGE.message_transport_type %][% END %]
55         </td>
56                 <td>
57             [% IF ( QUEUED_MESSAGE.status == 'sent' ) %]sent
58             [% ELSIF ( QUEUED_MESSAGE.status == 'pending' ) %]pending
59             [% ELSIF ( QUEUED_MESSAGE.status == 'failed' ) %]failed
60             [% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]deleted
61             [% ELSE %][% QUEUED_MESSAGE.status %][% END %]
62             [% IF ( QUEUED_MESSAGE.status != 'pending' ) %]
63             <div id="resend_notice[% QUEUED_MESSAGE.message_id %]"  class="notice">
64                 <form action="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber %]" method="POST">
65                     <input type="hidden" name="op" value="resend_notice" />
66                     <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
67                     <input type="hidden" name="message_id" value="[% QUEUED_MESSAGE.message_id %]" />
68                     <fieldset class="action">
69                         <button class="btn btn-default btn-xs" type="submit">Resend</button>
70                     </fieldset>
71                 </form>
72             </div>
73             [% END %]
74         </td>
75         <td><span title="[% QUEUED_MESSAGE.time_queued %]">[% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 %]</span></td>
76             </tr>
77             [% END %]
78         </tbody>
79     </table>
80 [% ELSE %]
81     <div class="dialog message">There is no record of any messages that have been sent to this patron.</div>
82 [% END %]
83
84 </div>
85 </div>
86
87 <div class="yui-b">
88 [% INCLUDE 'circ-menu.inc' %]
89 </div>
90 </div>
91
92 [% MACRO jsinclude BLOCK %]
93     [% Asset.js("js/members-menu.js") %]
94     [% INCLUDE 'datatables.inc' %]
95     <script type="text/javascript">
96         $(document).ready(function() {
97             $("#noticestable").dataTable($.extend(true, {}, dataTablesDefaults, {
98                 "aaSorting": [[ 3, "desc" ]],
99                 "aoColumns": [ null,null,null,{ "sType": "title-string" } ],
100                 "sPaginationType": "four_button"
101             }));
102
103             $("#noticestable").on("click", ".notice-title", function(e){
104                 e.preventDefault();
105                 var rowid = $(this).data("noticeid");
106                 $("#notice"+rowid).toggle();
107                 $("#resend_notice"+rowid).toggle();
108             });
109         });
110     </script>
111 [% END %]
112
113 [% INCLUDE 'intranet-bottom.inc' %]