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

(-)a/admin/smtp_servers.pl (+240 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2020 Theke Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
use Scalar::Util qw(blessed);
24
use Try::Tiny;
25
26
use C4::Auth qw(get_template_and_user);
27
use C4::Output qw(output_html_with_http_headers);
28
29
use Koha::Libraries;
30
use Koha::SMTP::Servers;
31
32
my $input = CGI->new;
33
my $op    = $input->param('op') || 'list';
34
35
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
36
    {   template_name   => "admin/smtp_servers.tt",
37
        query           => $input,
38
        type            => "intranet",
39
        flagsrequired   => { parameters => 1 },
40
    }
41
);
42
43
my @messages;
44
45
if ( $op eq 'add' ) {
46
47
    my $library_id = $input->param('library_id');
48
    $library_id = undef
49
        if defined $library_id and $library_id eq '*';
50
51
    my $name       = $input->param('smtp_name');
52
    my $host       = $input->param('smtp_host');
53
    my $port       = $input->param('smtp_port') || 25;
54
    my $timeout    = $input->param('smtp_timeout') || 120;
55
    my $ssl_mode   = $input->param('smtp_ssl_mode');
56
    my $user_name  = $input->param('smtp_user_name') || undef;
57
    my $password   = $input->param('smtp_password') || undef;
58
    my $debug      = ( scalar $input->param('smtp_debug_mode') ) ? 1 : 0;
59
60
    try {
61
        Koha::SMTP::Server->new(
62
            {
63
                library_id => $library_id,
64
                name       => $name,
65
                host       => $host,
66
                port       => $port,
67
                timeout    => $timeout,
68
                ssl_mode   => $ssl_mode,
69
                user_name  => $user_name,
70
                password   => $password,
71
                debug      => $debug,
72
            }
73
        )->store;
74
75
        push @messages, { type => 'message', code => 'success_on_insert' };
76
    }
77
    catch {
78
        if ( blessed $_ and $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
79
            push @messages,
80
              {
81
                type   => 'alert',
82
                code   => 'error_on_insert',
83
                reason => 'duplicate_id'
84
              };
85
        }
86
    };
87
88
    # list servers after adding
89
    $op = 'list';
90
}
91
elsif ( $op eq 'delete' ) {
92
    my $smtp_server_id = $input->param('smtp_server_id');
93
    my $smtp_server;
94
95
    $smtp_server = Koha::SMTP::Servers->find($smtp_server_id)
96
        unless !$smtp_server_id;
97
98
    if ( $smtp_server ) {
99
        try {
100
            my $name = $smtp_server->name;
101
            $smtp_server->delete;
102
            push @messages,
103
              {
104
                type => 'message',
105
                code => 'success_on_delete'
106
              };
107
        }
108
        catch {
109
            push @messages,
110
              {
111
                type   => 'alert',
112
                code   => 'error_on_delete'
113
              };
114
        };
115
    }
116
    else {
117
        push @messages,
118
            {
119
                type   => 'alert',
120
                code   => 'error_on_delete',
121
                reason => 'invalid_id'
122
            };
123
    }
124
125
    # list servers after delete
126
    $op = 'list';
127
}
128
elsif ( $op eq 'edit_form' ) {
129
    my $smtp_server_id = $input->param('smtp_server_id');
130
    my $smtp_server;
131
132
    $smtp_server = Koha::SMTP::Servers->find($smtp_server_id)
133
        unless !$smtp_server_id;
134
135
    if ( $smtp_server ) {
136
        $template->param(
137
            smtp_server => $smtp_server
138
        );
139
    }
140
    else {
141
        push @messages,
142
            {
143
                type   => 'alert',
144
                code   => 'error_on_edit',
145
                reason => 'invalid_id'
146
            };
147
    }
148
}
149
elsif ( $op eq 'edit_save' ) {
150
151
    my $smtp_server_id = $input->param('smtp_server_id');
152
    my $smtp_server;
153
154
    $smtp_server = Koha::SMTP::Servers->find($smtp_server_id)
155
        unless !$smtp_server_id;
156
157
    if ( $smtp_server ) {
158
159
        my $name       = $input->param('smtp_name');
160
        my $host       = $input->param('smtp_host');
161
        my $port       = $input->param('smtp_port') || 25;
162
        my $timeout    = $input->param('smtp_timeout') || 120;
163
        my $ssl_mode   = $input->param('smtp_ssl_mode');
164
        my $user_name  = $input->param('smtp_user_name') || undef;
165
        my $password   = $input->param('smtp_password') || undef;
166
        my $debug      = ( scalar $input->param('smtp_debug_mode') ) ? 1 : 0;
167
168
        try {
169
            $smtp_server->password( $password )
170
                if $password;
171
172
            $smtp_server->set(
173
                {
174
                    name      => $name,
175
                    host      => $host,
176
                    port      => $port,
177
                    timeout   => $timeout,
178
                    ssl_mode  => $ssl_mode,
179
                    user_name => $user_name,
180
                    debug     => $debug
181
                }
182
            )->store;
183
184
            push @messages,
185
            {
186
                type => 'message',
187
                code => 'success_on_update'
188
            };
189
        }
190
        catch {
191
            push @messages,
192
            {
193
                type   => 'alert',
194
                code   => 'error_on_update'
195
            };
196
        };
197
198
        # list servers after adding
199
        $op = 'list';
200
    }
201
    else {
202
        push @messages,
203
            {
204
                type   => 'alert',
205
                code   => 'error_on_update',
206
                reason => 'invalid_id'
207
            };
208
    }
209
}
210
211
if ( $op eq 'list' ) {
212
    my $smtp_servers = Koha::SMTP::Servers->search;
213
    $template->param(
214
        servers_count  => $smtp_servers->count,
215
        default_config => $smtp_servers->default_setting
216
    );
217
}
218
219
my @already_set_library_ids = Koha::SMTP::Servers->search(
220
    {
221
        library_id => { '!=' => undef }
222
    }
223
)->get_column('library_id');
224
225
my $libraries = Koha::Libraries->search(
226
    {
227
        'me.branchcode' => { -not_in => \@already_set_library_ids }
228
    }
229
);
230
231
my $default = Koha::SMTP::Servers->search({ library_id => undef })->count;
232
233
$template->param(
234
    op              => $op,
235
    default_set     => ( $default ) ? 1 : 0,
236
    unset_libraries => $libraries,
237
    messages        => \@messages,
238
);
239
240
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (+4 lines)
Lines 208-213 Link Here
208
                        <dt><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a></dt>
208
                        <dt><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a></dt>
209
                        <dd>Define which external servers to query for MARC data.</dd>
209
                        <dd>Define which external servers to query for MARC data.</dd>
210
                    [% END %]
210
                    [% END %]
211
                    [% IF ( CAN_user_parameters ) %]
212
                        <dt><a href="/cgi-bin/koha/admin/smtp_servers.pl">SMTP servers</a></dt>
213
                        <dd>Define which SMTP servers to use.</dd>
214
                    [% END %]
211
                    [% IF ( CAN_user_parameters_manage_didyoumean ) %]
215
                    [% IF ( CAN_user_parameters_manage_didyoumean ) %]
212
                        <dt><a href="/cgi-bin/koha/admin/didyoumean.pl">Did you mean?</a></dt>
216
                        <dt><a href="/cgi-bin/koha/admin/didyoumean.pl">Did you mean?</a></dt>
213
                        <dd>Choose which plugins to use to suggest searches to patrons and staff.</dd>
217
                        <dd>Choose which plugins to use to suggest searches to patrons and staff.</dd>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt (-1 / +398 lines)
Line 0 Link Here
0
- 
1
[% USE raw %]
2
[% USE Asset %]
3
[% SET footerjs = 1 %]
4
[% USE TablesSettings %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Koha &rsaquo; Administration &rsaquo; SMTP servers
7
[% IF op == 'add_form' %]
8
    &rsaquo;[% IF library %]Modify SMTP server[% ELSE %]New SMTP server[% END %]
9
[% ELSIF op == 'delete_confirm' %]
10
    &rsaquo; Confirm deletion of SMTP server '[% server.name | html %]'
11
[% END %]
12
</title>
13
[% INCLUDE 'doc-head-close.inc' %]
14
</head>
15
16
<body id="admin_smtp_servers" class="admin">
17
[% INCLUDE 'header.inc' %]
18
[% INCLUDE 'prefs-admin-search.inc' %]
19
20
<div id="breadcrumbs">
21
    <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
22
    <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
23
    <a href="/cgi-bin/koha/admin/smtp_servers.pl">SMTP servers</a>
24
[% IF op == 'add_form' %]
25
 &rsaquo; <span> New</span>
26
[% ELSIF op == 'edit_form' %]
27
 &rsaquo; <span> Edit</span>
28
[% END %]
29
</div>
30
31
<div class="main container-fluid">
32
    <div class="row">
33
        <div class="col-sm-10 col-sm-push-2">
34
            <main>
35
36
[% FOREACH m IN messages %]
37
    <div class="dialog [% m.type | html %]">
38
        [% SWITCH m.code %]
39
        [% CASE 'error_on_edit' %]
40
            An error occurred trying to open the server for editing. The passed id is invalid.
41
        [% CASE 'error_on_insert' %]
42
            An error occurred when adding the server. The library already has an SMTP server set.
43
        [% CASE 'error_on_delete' %]
44
            An error occurred when deleting this server. Check the logs.
45
        [% CASE 'success_on_update' %]
46
            Server updated successfully.
47
        [% CASE 'success_on_insert' %]
48
            Server added successfully.
49
        [% CASE 'success_on_delete' %]
50
            Server deleted successfully.
51
        [% CASE %]
52
            [% m.code | html %]
53
        [% END %]
54
    </div>
55
[% END %]
56
57
[% IF op == 'add_form' %]
58
    <h3>New SMTP server</h3>
59
    <form action="/cgi-bin/koha/admin/smtp_servers.pl" id="add" name="add" class="validated" method="post">
60
        <input type="hidden" name="op" value="add" />
61
        <fieldset class="rows">
62
            <ol>
63
                <li>
64
                    <label for="library_id" class="required">Library: </label>
65
                    <select name="library_id" id="library_id">
66
                    [%- UNLESS default_set -%]
67
                        <option value="*">All libraries</option>
68
                    [%- END -%]
69
                    [%- FOREACH library IN unset_libraries -%]
70
                        <option value="[% library.branchcode | html %]">[% library.branchname | html %]</option>
71
                    [%- END -%]
72
                    </select>
73
                    <span class="required">Required</span>
74
                </li>
75
                </select>
76
                <li>
77
                    <label for="smtp_name" class="required">Name: </label>
78
                    <input type="text" name="smtp_name" id="smtp_name" size="60" class="required" required="required" />
79
                    <span class="required">Required</span>
80
                </li>
81
            </ol>
82
        </fieldset>
83
84
        <fieldset class="rows">
85
            <ol>
86
                <li>
87
                    <label for="smtp_host">Host: </label>
88
                    <input type="text" name="smtp_host" id="smtp_host" size="60" class="required"/>
89
                    <span class="required">Required</span>
90
                </li>
91
                <li>
92
                    <label for="smtp_port">Port: </label>
93
                    <input type="number" step="1" value="25" name="smtp_port" id="smtp_port" size="20" class="required"/>
94
                    <span class="required">Required</span>
95
                </li>
96
                <li>
97
                    <label for="smtp_timeout">Timeout (seconds): </label>
98
                    <input type="number" step="1" value="120" name="smtp_timeout" id="smtp_timeout" size="20" />
99
                </li>
100
                <li>
101
                    <label for="smtp_ssl_mode">SSL: </label>
102
                    <select name="smtp_ssl_mode" id="smtp_ssl_mode">
103
                        <option value="disabled" selected="selected">Disabled</option>
104
                        <option value="ssl">SSL</option>
105
                        <option value="starttls">STARTTLS</option>
106
                    </select>
107
                </li>
108
                <li>
109
                    <label for="smtp_user_name">User name: </label>
110
                    <input type="text" name="smtp_user_name" id="smtp_user_name" size="60" />
111
                </li>
112
                <li>
113
                    <label for="smtp_password">Password: </label>
114
                    <input type="password" name="smtp_password" id="smtp_password" size="60" />
115
                </li>
116
                <li>
117
                    <label for="smtp_debug_mode">Debug mode: </label>
118
                    <select name="smtp_debug_mode" id="smtp_debug_mode">
119
                        <option value="1">Enabled</option>
120
                        <option value="0" selected="selected">Disabled</option>
121
                    </select>
122
                </li>
123
            </ol>
124
        </fieldset>
125
        <fieldset class="action">
126
            <input type="submit" value="Submit" />
127
            <a class="cancel" href="/cgi-bin/koha/admin/smtp_servers.pl">Cancel</a>
128
        </fieldset>
129
    </form>
130
[% END %]
131
132
[% IF op == 'edit_form' %]
133
    <h3>Edit SMTP server</h3>
134
    <form action="/cgi-bin/koha/admin/smtp_servers.pl" id="edit_save" name="edit_save" class="validated" method="post">
135
        <input type="hidden" name="op" value="edit_save" />
136
        <input type="hidden" name="smtp_server_id" value="[%- smtp_server.id | html -%]" />
137
        <fieldset class="rows">
138
            <ol>
139
                <li>
140
                    <label for="library_id">Library: </label>
141
                    [% IF smtp_server.library %]
142
                        <span name="library_id" id="library_id">[%- smtp_server.library.branchname | html -%]</span>
143
                    [%- ELSE -%]
144
                        <span name="library_id" id="library_id">All libraries</span>
145
                    [%- END -%]
146
                </li>
147
                </select>
148
                <li>
149
                    <label for="smtp_name" class="required">Name: </label>
150
                    <input type="text" name="smtp_name" id="smtp_name" size="60" class="required" required="required" value="[%- smtp_server.name | html -%]"/>
151
                    <span class="required">Required</span>
152
                </li>
153
            </ol>
154
        </fieldset>
155
156
        <fieldset class="rows">
157
            <ol>
158
                <li>
159
                    <label for="smtp_host">Host: </label>
160
                    <input type="text" name="smtp_host" id="smtp_host" size="60" class="required" value="[%- smtp_server.host | html -%]"/>
161
                    <span class="required">Required</span>
162
                </li>
163
                <li>
164
                    <label for="smtp_port">Port: </label>
165
                    <input type="number" step="1" name="smtp_port" id="smtp_port" size="20" class="required" value="[%- smtp_server.port | html -%]"/>
166
                    <span class="required">Required</span>
167
                </li>
168
                <li>
169
                    <label for="smtp_timeout">Timeout (seconds): </label>
170
                    <input type="number" step="1" name="smtp_timeout" id="smtp_timeout" size="20" value="[%- smtp_server.timeout | html -%]"/>
171
                </li>
172
                <li>
173
                    <label for="smtp_ssl_mode">SSL: </label>
174
                    <select name="smtp_ssl_mode" id="smtp_ssl_mode">
175
                    [%- IF smtp_server.ssl_mode == 'disabled' -%]
176
                        <option value="disabled" selected="selected">Disabled</option>
177
                        <option value="ssl">SSL</option>
178
                        <option value="starttls">STARTTLS</option>
179
                    [%- ELSIF smtp_server.ssl_mode == 'ssl' -%]
180
                        <option value="disabled">Disabled</option>
181
                        <option value="ssl" selected="selected">SSL</option>
182
                        <option value="starttls">STARTTLS</option>
183
                    [%- ELSE -%]
184
                        <option value="disabled">Disabled</option>
185
                        <option value="ssl">SSL</option>
186
                        <option value="starttls" selected="selected">STARTTLS</option>
187
                    [%- END -%]
188
                    </select>
189
                </li>
190
                <li>
191
                    <label for="smtp_user_name">User name: </label>
192
                    <input type="text" name="smtp_user_name" id="smtp_user_name" size="60"  value="[%- smtp_server.user_name | html -%]"/>
193
                </li>
194
                <li>
195
                    <label for="smtp_password">Password: </label>
196
                    <input type="password" name="smtp_password" id="smtp_password" size="60"  value="[%- smtp_server.password | html -%]"/>
197
                </li>
198
                <li>
199
                    <label for="smtp_debug_mode">Debug mode: </label>
200
                    <select name="smtp_debug_mode" id="smtp_debug_mode">
201
                    [%- IF smtp_server.debug == 1 -%]
202
                        <option value="1" selected="selected">Enabled</option>
203
                        <option value="0">Disabled</option>
204
                    [%- ELSE -%]
205
                        <option value="1">Enabled</option>
206
                        <option value="0" selected="selected">Disabled</option>
207
                    [%- END -%]
208
                    </select>
209
                </li>
210
            </ol>
211
        </fieldset>
212
        <fieldset class="action">
213
            <input type="submit" value="Submit" />
214
            <a class="cancel" href="/cgi-bin/koha/admin/smtp_servers.pl">Cancel</a>
215
        </fieldset>
216
    </form>
217
[% END %]
218
219
[% IF op == 'list' %]
220
221
    [%- IF unset_libraries.count > 0 -%]
222
    <div id="toolbar" class="btn-toolbar">
223
        <a class="btn btn-default" id="new_smtp_server" href="/cgi-bin/koha/admin/smtp_servers.pl?op=add_form"><i class="fa fa-plus"></i> New SMTP server</a>
224
    </div>
225
    [%- END -%]
226
227
    <h3>SMTP servers</h3>
228
229
    [% IF servers_count > 0 %]
230
        <table id="smtp_servers">
231
            <thead>
232
                <tr>
233
                    <th>Library</th>
234
                    <th>Name</th>
235
                    <th>Host</th>
236
                    <th>Port</th>
237
                    <th>Timeout (secs)</th>
238
                    <th>SSL</th>
239
                    <th>Authenticated</th>
240
                    <th data-class-name="actions">Actions</th>
241
                </tr>
242
            </thead>
243
        </table>
244
    [% ELSE %]
245
        <div class="dialog message">No user-defined SMTP servers. Using the default configuration:
246
            <ul>
247
                <li><strong>Host</strong>: [%- default_config.host | html -%]</li>
248
                <li><strong>Port</strong>: [%- default_config.port | html -%]</li>
249
                <li><strong>Timeout (secs)</strong>: [%- default_config.timeout | html -%]</li>
250
                <li><strong>SSL</strong>: [%- IF default_config.ssl_mode == 'disabled' -%]Disabled[%- ELSIF default_config.ssl_mode == 'ssl' -%]SSL[%- ELSE -%]STARTTLS[%- END -%]</li>
251
                <li><strong>Debug mode</strong>: [%- IF default_config.debug -%]Yes[%- ELSE -%]No[%- END -%]</li>
252
            </ul>
253
            </pre>
254
        </div>
255
    [% END %]
256
[% END %]
257
258
            <div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
259
                <div class="modal-dialog">
260
                    <div class="modal-content">
261
                        <div class="modal-header">
262
                            <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
263
                            <h3 id="delete_confirm_modal_label">Delete server</h3>
264
                        </div>
265
                        <div class="modal-body">
266
                            <div id="delete_confirm_dialog"></div>
267
                        </div>
268
                        <div class="modal-footer">
269
                            <a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
270
                            <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
271
                        </div>
272
                    </div> <!-- /.modal-content -->
273
                </div> <!-- /.modal-dialog -->
274
            </div> <!-- #delete_confirm_modal -->
275
276
            </main>
277
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
278
279
        <div class="col-sm-2 col-sm-pull-10">
280
            <aside>
281
                [% INCLUDE 'admin-menu.inc' %]
282
            </aside>
283
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
284
     </div> <!-- /.row -->
285
286
287
[% MACRO jsinclude BLOCK %]
288
    [% Asset.js("js/admin-menu.js") | $raw %]
289
    [% INCLUDE 'datatables.inc' %]
290
    [% INCLUDE 'columns_settings.inc' %]
291
    [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
292
    [% INCLUDE 'str/tinymce_i18n.inc' %]
293
    <script>
294
        $(document).ready(function() {
295
296
            var smtp_servers_url = '/api/v1/config/smtp_servers';
297
            var smtp_servers = $("#smtp_servers").api({
298
                "ajax": {
299
                    "url": smtp_servers_url
300
                },
301
                "embed": [
302
                    "library"
303
                ],
304
                'emptyTable': '<div class="dialog message">'+_("There are no SMTP servers defined.")+'</div>',
305
                "columnDefs": [ {
306
                    "targets": [0,1,2],
307
                    "render": function (data, type, row, meta) {
308
                        if ( type == 'display' ) {
309
                            if ( data != null ) {
310
                                return data.escapeHtml();
311
                            }
312
                            else {
313
                                return "Default";
314
                            }
315
                        }
316
                        return data;
317
                    }
318
                } ],
319
                "columns": [
320
                    {
321
                        "data": "library.name",
322
                        "searchable": true,
323
                        "orderable": true
324
                    },
325
                    {
326
                        "data": "name",
327
                        "searchable": true,
328
                        "orderable": true
329
                    },
330
                    {
331
                        "data": "host",
332
                        "searchable": true,
333
                        "orderable": true
334
                    },
335
                    {
336
                        "data": "port",
337
                        "searchable": true,
338
                        "orderable": false
339
                    },
340
                    {
341
                        "data": "timeout",
342
                        "searchable": true,
343
                        "orderable": false
344
                    },
345
                    {
346
                        "data": "ssl_mode",
347
                        "render": function (data, type, row, meta) {
348
                            if (data == 'disabled') {
349
                                return _("Disabled");
350
                            }
351
                            else if (data == 'ssl') {
352
                                return _("SSL");
353
                            }
354
                            else {
355
                                return _("STARTTLS");
356
                            }
357
                        },
358
                        "searchable": false,
359
                        "orderable": false
360
                    },
361
                    {
362
                        "data": function( row, type, val, meta ) {
363
                            if ( row.user_name != null ) {
364
                                return _("Yes");
365
                            }
366
                            else {
367
                                return _("No");
368
                            }
369
                        },
370
                        "searchable": false,
371
                        "orderable": false
372
                    },
373
                    {
374
                        "data": function( row, type, val, meta ) {
375
                            var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&amp;smtp_server_id='+ encodeURIComponent(row.smtp_server_id) +'"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n";
376
                            result += '<a class="btn btn-default btn-xs delete_server" role="button" href="#" data-toggle="modal" data-target="#delete_confirm_modal" data-smtp-server-id="'+ encodeURIComponent(row.smtp_server_id) +'" data-smtp-server-name="'+ encodeURIComponent(row.name) +'"><i class="fa fa-trash" aria-hidden="true"></i>'+_("Delete")+'</a>';
377
                            return result;
378
                        },
379
                        "searchable": false,
380
                        "orderable": false
381
                    }
382
                ]
383
            });
384
385
            $('#smtp_servers').on( "click", '.delete_server', function () {
386
                var smtp_server_id   = $(this).data('smtp-server-id');
387
                var smtp_server_name = $(this).data('smtp-server-name');
388
389
                $("#delete_confirm_dialog").html(
390
                    _("You are about to delete the \"%s\" SMTP server.").format(smtp_server_name)
391
                );
392
                $("#delete_confirm_modal_button").attr("href", "/cgi-bin/koha/admin/smtp_servers.pl?op=delete&amp;smtp_server_id=" + encodeURIComponent(smtp_server_id));
393
            });
394
        });
395
    </script>
396
[% END %]
397
398
[% INCLUDE 'intranet-bottom.inc' %]

Return to bug 22343