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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-19 / +21 lines)
Lines 222-229 Link Here
222
        var columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
222
        var columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
223
        $(document).ready(function() {
223
        $(document).ready(function() {
224
224
225
            const to_html = (x) => $('<div/>').text(x).html();
226
227
            var libraries_url = '/api/v1/libraries';
225
            var libraries_url = '/api/v1/libraries';
228
            var libraries = $("#libraries").api({
226
            var libraries = $("#libraries").api({
229
                "ajax": {
227
                "ajax": {
Lines 234-240 Link Here
234
                    "targets": [0,1,3,4,7,8,9,10,11,12,13,14,15],
232
                    "targets": [0,1,3,4,7,8,9,10,11,12,13,14,15],
235
                    "render": function (data, type, row, meta) {
233
                    "render": function (data, type, row, meta) {
236
                        if ( type == 'display' ) {
234
                        if ( type == 'display' ) {
237
                            return to_html(data);
235
                            if ( data != null ) {
236
                                return data.escapeHtml();
237
                            }
238
                            else {
239
                                return "";
240
                            }
238
                        }
241
                        }
239
                        return data;
242
                        return data;
240
                    }
243
                    }
Lines 253-279 Link Here
253
                    {
256
                    {
254
                        "data": function( row, type, val, meta ) {
257
                        "data": function( row, type, val, meta ) {
255
                            const library_info = [];
258
                            const library_info = [];
256
                            if ( row.address1 != null ) library_info.push(to_html(row.address1));
259
                            if ( row.address1 != null ) library_info.push(row.address1.escapeHtml());
257
                            if ( row.address2 != null ) library_info.push(to_html(row.address2));
260
                            if ( row.address2 != null ) library_info.push(row.address2.escapeHtml());
258
                            if ( row.address3 != null ) library_info.push(to_html(row.address3));
261
                            if ( row.address3 != null ) library_info.push(row.address3.escapeHtml());
259
                            // geographical_location = city, state postal_code
262
                            // geographical_location = city, state postal_code
260
                            const locations = [];
263
                            const locations = [];
261
                            if ( row.city != null ) locations.push(to_html(row.city));
264
                            if ( row.city != null ) locations.push(row.city.escapeHtml());
262
                            if ( row.state != null ) locations.push(to_html(row.state));
265
                            if ( row.state != null ) locations.push(row.state.escapeHtml());
263
                            const geographical_location = locations.join(', ');
266
                            const geographical_location = locations.join(', ');
264
                            if ( geographical_location != '' && row.postal_code != null) {
267
                            if ( geographical_location != '' && row.postal_code != null) {
265
                                library_info.push(geographical_location+' '+to_html(row.postal_code));
268
                                library_info.push(geographical_location+' '+row.postal_code.escapeHtml());
266
                            }
269
                            }
267
                            else {
270
                            else {
268
                                library_info.push(geographical_location);
271
                                library_info.push(geographical_location);
269
                            }
272
                            }
270
                            if ( row.country != null ) library_info.push(to_html(row.country));
273
                            if ( row.country != null ) library_info.push(row.country.escapeHtml());
271
                            if ( row.phone != null ) library_info.push(_("Ph: ") + to_html(row.phone));
274
                            if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone.escapeHtml());
272
                            if ( row.fax != null ) library_info.push(_("Fax: ") + to_html(row.fax));
275
                            if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax.escapeHtml());
273
                            if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+to_html(row.email)+'</a>');
276
                            if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+row.email.escapeHtml()+'</a>');
274
                            if ( row.url != null ) library_info.push('<a href="'+encodeURIComponent(row.url)+'">'+to_html(row.url)+'</a>');
277
                            if ( row.url != null ) library_info.push('<a href="'+encodeURIComponent(row.url)+'">'+row.url.escapeHtml()+'</a>');
275
                            if ( row.opac_info != null ) library_info.push(_("OPAC Info") + ': <div>'+to_html(row.opac_info)+'</div>');
278
                            if ( row.opac_info != null ) library_info.push(_("OPAC Info") + ': <div>'+row.opac_info.escapeHtml()+'</div>');
276
                            if ( row.notes != null ) library_info.push(_("Notes")+': '+to_html(row.notes));
279
                            if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes.escapeHtml());
277
                            return library_info.join('<br/>');
280
                            return library_info.join('<br/>');
278
                        },
281
                        },
279
                        "searchable": false,
282
                        "searchable": false,
Lines 302-310 Link Here
302
305
303
                            var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&amp;branchcode='+encodeURIComponent(row.library_id)+'" role="button"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
306
                            var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&amp;branchcode='+encodeURIComponent(row.library_id)+'" role="button"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
304
                            result += '<form action="/cgi-bin/koha/admin/branches.pl" method="post">';
307
                            result += '<form action="/cgi-bin/koha/admin/branches.pl" method="post">';
305
                            result += '<input type="hidden" name="branchcode" value="'+to_html(row.library_id)+'" />'+"\n";
308
                            result += '<input type="hidden" name="branchcode" value="'+row.library_id.escapeHtml()+'" />'+"\n";
306
                            result += '<input type="hidden" name="op" value="delete_confirm" />';
309
                            result += '<input type="hidden" name="op" value="delete_confirm" />';
307
                            result += '<button type="submit" id="delete_library_'+to_html(row.library_id)+'" class="btn btn-default btn-xs" role="button"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Delete")+'</button></form>';
310
                            result += '<button type="submit" id="delete_library_'+row.library_id.escapeHtml()+'" class="btn btn-default btn-xs" role="button"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Delete")+'</button></form>';
308
311
309
                            return result;
312
                            return result;
310
313
311
- 

Return to bug 25288