View | Details | Raw Unified | Return to bug 33260
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc (-1 / +4 lines)
Lines 7-13 Link Here
7
        <ul>
7
        <ul>
8
            <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools home</a></li>
8
            <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools home</a></li>
9
        </ul>
9
        </ul>
10
        [% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons  || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons  || CAN_user_tools_edit_patrons || CAN_user_tools_moderate_tags || ( CAN_user_tools_batch_upload_patron_images && Koha.Preference('patronimages') ) || CAN_user_tools_rotating_collections ) %]
10
        [% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons  || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons  || CAN_user_tools_edit_patrons || CAN_user_tools_moderate_tags || ( CAN_user_tools_batch_upload_patron_images && Koha.Preference('patronimages') ) || CAN_user_tools_rotating_collections ) || ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %]
11
            <h5>Patrons and circulation</h5>
11
            <h5>Patrons and circulation</h5>
12
            <ul>
12
            <ul>
13
                [% IF ( CAN_user_tools_manage_patron_lists ) %]
13
                [% IF ( CAN_user_tools_manage_patron_lists ) %]
Lines 28-33 Link Here
28
                [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
28
                [% IF ( CAN_user_tools_edit_notice_status_triggers ) %]
29
                    <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
29
                    <li><a href="/cgi-bin/koha/tools/overduerules.pl">Overdue notice/status triggers</a></li>
30
                [% END %]
30
                [% END %]
31
                [% IF ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %]
32
                    <li><a href="/cgi-bin/koha/tools/notices.pl">Notices management</a></li>
33
                [% END %]
31
                [% IF ( CAN_user_tools_label_creator ) %]
34
                [% IF ( CAN_user_tools_label_creator ) %]
32
                    <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
35
                    <li><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></li>
33
                [% END %]
36
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/notices.tt (+145 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE Asset %]
3
[% USE KohaDates %]
4
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Notices management &rsaquo; Tools &rsaquo; Koha</title>
7
[% INCLUDE 'doc-head-close.inc' %]
8
<style>
9
    .notice { display: none; }
10
</style>
11
</head>
12
13
<body id="tools_notices_mgmt" class="tools">
14
[% WRAPPER 'header.inc' %]
15
    [% INCLUDE 'circ-search.inc' %]
16
[% END %]
17
18
[% WRAPPER 'sub-header.inc' %]
19
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20
    <ol>
21
        <li>
22
            <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23
        </li>
24
        <li>
25
            <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
26
        </li>
27
        <li>
28
            <a href="#" aria-current="page">
29
                Notices management
30
            </a>
31
        </li>
32
    </ol>
33
</nav>
34
[% END %]
35
36
<div class="main container-fluid">
37
    <div class="row">
38
        <div class="col-sm-10 col-sm-push-2">
39
            <main>
40
41
                <h1>Notices management</h1>
42
43
                [% IF notices %]
44
45
                <table id="notices">
46
                    <thead>
47
                        <tr>
48
                            <th>Time created</th>
49
                            <th>Patron</th>
50
                            <th>Notice</th>
51
                            <th>Type</th>
52
                            <th>Status</th>
53
                            <th>Updated on</th>
54
                            <th>Actions</th>
55
                        </tr>
56
                    </thead>
57
                    <tbody>
58
                        [% FOREACH notice IN notices %]
59
                        <tr>
60
                            <td>[% notice.time_queued | $KohaDates with_hours = 1 %]</td>
61
                            <td>[% INCLUDE 'patron-title.inc' patron=notice.patron hide_patron_infos_if_needed=1 %]</td>
62
                            <!--                            <td>[% notice.subject | html %]</td>-->
63
                            <td>
64
                                <a class="notice-title" data-noticeid="[% notice.message_id | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% notice.borrowernumber | uri %]&amp;noticeid=[% notice.message_id | uri %]">[% notice.subject | html %]</a>
65
                                <iframe class="notice" id="notice[% notice.message_id | html %]" srcdoc="[% notice.content | html | html_line_break %]"></iframe>
66
                            </td>
67
                            <td>[% notice.message_transport_type | html %]</td>
68
                            <td>[% notice.status | html %]</td>
69
                            <td>[% notice.updated_on | $KohaDates with_hours = 1 %]</td>
70
                            <td class="actions"><button class="btn btn-default btn-xs print"><i class="fa fa-print"></i> Print</button></td>
71
                        </tr>
72
                        [% END %]
73
                    </tbody>
74
                </table>
75
76
                [% ELSE %]
77
78
                <div class="dialog message">
79
                    There are no notices.
80
                </div>
81
82
                [% END %]
83
84
            </main>
85
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
86
87
        <div class="col-sm-2 col-sm-pull-10">
88
            <aside>
89
                [% INCLUDE 'tools-menu.inc' %]
90
            </aside>
91
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
92
     </div> <!-- /.row -->
93
94
<!-- Modal -->
95
<div class="modal" id="noticeModal" tabindex="-1" aria-labelledby="noticeModalLabel" aria-hidden="true">
96
    <div class="modal-dialog">
97
        <div class="modal-content">
98
            <div class="modal-header">
99
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
100
                    <span aria-hidden="true">&times;</span>
101
                </button>
102
                <h5 class="modal-title" id="noticeModalLabel">Notice</h5>
103
            </div>
104
            <div class="modal-body">
105
                ...
106
            </div>
107
            <div class="modal-footer">
108
                <button type="button" class="btn btn-default deny cancel" data-dismiss="modal"><i class="fa fa-remove"></i> Close</button>
109
            </div>
110
        </div> <!-- /.modal-content -->
111
    </div> <!-- /.modal-dialog -->
112
</div> <!-- /.modal -->
113
114
[% MACRO jsinclude BLOCK %]
115
    [% Asset.js("js/tools-menu.js") | $raw %]
116
    [% INCLUDE 'calendar.inc' %]
117
    [% INCLUDE 'datatables.inc' %]
118
119
    <script>
120
        $(document).ready(function() {
121
            $("#notices").dataTable($.extend(true, {}, dataTablesDefaults, {
122
                "aaSorting": [[ 3, "desc" ]],
123
                "sPaginationType": "full"
124
            }));
125
126
            $("#notices").on("click", ".notice-title", function(e){
127
                e.preventDefault();
128
                var title = $(this).text();
129
                var noticeid = $(this).data("noticeid");
130
                var body = $("#notice" + noticeid ).attr("srcdoc");
131
                $("#noticeModalLabel").text( title );
132
                $("#noticeModal .modal-body").html( body );
133
                $("#noticeModal").modal("show");
134
            });
135
136
            $("#noticeModal").on("hide.bs.modal", function(){
137
                $("#noticeModalLabel").text("");
138
                $("#noticeModal .modal-body").html("");
139
            });
140
        });
141
    </script>
142
143
[% END %]
144
145
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (-1 / +6 lines)
Lines 32-38 Link Here
32
            <h1>Tools</h1>
32
            <h1>Tools</h1>
33
            <div class="row">
33
            <div class="row">
34
                <div class="col-sm-6">
34
                <div class="col-sm-6">
35
                    [% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons  || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons  || CAN_user_tools_edit_patrons || CAN_user_tools_batch_extend_due_dates || CAN_user_tools_moderate_tags || CAN_user_tools_rotating_collections || ( CAN_user_tools_batch_upload_patron_images && Koha.Preference('patronimages') ) ) %]
35
                    [% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons  || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons  || CAN_user_tools_edit_patrons || CAN_user_tools_batch_extend_due_dates || CAN_user_tools_moderate_tags || CAN_user_tools_rotating_collections || ( CAN_user_tools_batch_upload_patron_images && Koha.Preference('patronimages') ) || ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) ) %]
36
                        <h3>Patrons and circulation</h3>
36
                        <h3>Patrons and circulation</h3>
37
                    [% END %]
37
                    [% END %]
38
                    <dl>
38
                    <dl>
Lines 71-76 Link Here
71
                            <dd>Set notice/status triggers for overdue items</dd>
71
                            <dd>Set notice/status triggers for overdue items</dd>
72
                        [% END %]
72
                        [% END %]
73
73
74
                        [% IF ( CAN_user_tools_view_generated_notices && Koha.Preference('NoticesManagement') ) %]
75
                            <dt><a href="/cgi-bin/koha/tools/notices.pl">Notices management</a></dt>
76
                            <dd>View and print generated notices</dd>
77
                        [% END %]
78
74
                        [% IF ( CAN_user_tools_label_creator ) %]
79
                        [% IF ( CAN_user_tools_label_creator ) %]
75
                            <dt><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></dt>
80
                            <dt><a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a></dt>
76
                            <dd>Create printable patron cards</dd>
81
                            <dd>Create printable patron cards</dd>
(-)a/tools/notices.pl (-1 / +41 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use CGI qw ( -utf8 );
21
use C4::Auth qw( get_template_and_user );
22
use C4::Output qw( output_html_with_http_headers );
23
use Koha::Notice::Messages;
24
25
my $query = CGI->new;
26
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
27
    {
28
        template_name   => "tools/notices.tt",
29
        query           => $query,
30
        type            => "intranet",
31
        flagsrequired   => tools => 'view_generated_notices',
32
    }
33
);
34
35
my $notices = Koha::Notice::Messages->search;
36
37
$template->param(
38
    notices => $notices,
39
);
40
41
output_html_with_http_headers $query, $cookie, $template->output;

Return to bug 33260