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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt (-17 / +28 lines)
Lines 360-365 Link Here
360
    [% Asset.js("js/tools-menu.js") | $raw %]
360
    [% Asset.js("js/tools-menu.js") | $raw %]
361
    [% INCLUDE 'datatables.inc' %]
361
    [% INCLUDE 'datatables.inc' %]
362
    [% Asset.js("js/file-upload.js") | $raw %]
362
    [% Asset.js("js/file-upload.js") | $raw %]
363
    <script>
364
        var plugin = [% plugin ? 1 : 0 | html %];
365
        var plugin_index = "[% index | html %]";
366
367
        var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'upload', 'uploadresults', 'json' ) | $raw %];
368
        if (plugin){
369
            table_settings['columns'].splice(6, 1);
370
            table_settings['columns'].splice(5, 1);
371
        }
372
373
        addPrefs({
374
            OPACBaseURL: "[% Koha.Preference('OPACBaseURL') | html %]",
375
        });
376
        const msg_alert = "[% msg | html %]";
377
    </script>
378
363
    <script>
379
    <script>
364
        function StartUpload() {
380
        function StartUpload() {
365
            if( $('#fileToUpload').prop('files').length == 0 ) return;
381
            if( $('#fileToUpload').prop('files').length == 0 ) return;
Lines 378-389 Link Here
378
            if( $("#uploadcategory").val() )
394
            if( $("#uploadcategory").val() )
379
                cat = encodeURIComponent( $("#uploadcategory").val() );
395
                cat = encodeURIComponent( $("#uploadcategory").val() );
380
            if( cat ) xtra= 'category=' + cat + '&';
396
            if( cat ) xtra= 'category=' + cat + '&';
381
            [% IF plugin %]
397
            if (plugin){
382
                xtra = xtra + 'public=1&temp=0';
398
                xtra = xtra + 'public=1&temp=0';
383
            [% ELSE %]
399
            } else {
384
                if( !cat ) xtra = 'temp=1&';
400
                if( !cat ) xtra = 'temp=1&';
385
                if( $('#public').prop('checked') ) xtra = xtra + 'public=1';
401
                if( $('#public').prop('checked') ) xtra = xtra + 'public=1';
386
            [% END %]
402
            }
387
            xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), xtra, cbUpload );
403
            xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), xtra, cbUpload );
388
        }
404
        }
389
        function CancelUpload() {
405
        function CancelUpload() {
Lines 473-502 Link Here
473
            $("#form_delete").submit();
489
            $("#form_delete").submit();
474
        }
490
        }
475
        function ClearField() {
491
        function ClearField() {
476
            [% IF plugin %]
492
            if (plugin){
477
                $(window.opener.document).find('#[% index | html %]').val( '' );
493
                $(window.opener.document).find('#' + plugin_index).val( '' );
478
            [% END %]
494
            }
479
        }
495
        }
480
        function Choose(hashval) {
496
        function Choose(hashval) {
481
            var res = '[% Koha.Preference('OPACBaseURL') | html %]';
497
            var res = prefs.OPACBaseURL;
482
            res = res.replace( /\/$/, '');
498
            res = res.replace( /\/$/, '');
483
            res = res + '/cgi-bin/koha/opac-retrieve-file.pl?id=' + hashval;
499
            res = res + '/cgi-bin/koha/opac-retrieve-file.pl?id=' + hashval;
484
            var index = '[% index | html %]';
500
            var index = plugin_index;
485
            index = index.replace( /^buttonDot_/, '' );
501
            index = index.replace( /^buttonDot_/, '' );
486
            if(index) $(window.opener.document).find('#'+index).val( res );
502
            if(index) $(window.opener.document).find('#'+index).val( res );
487
            window.close();
503
            window.close();
488
        }
504
        }
489
        var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'upload', 'uploadresults', 'json' ) | $raw %];
505
490
        [% IF plugin %]
491
            table_settings['columns'].splice(6, 1);
492
            table_settings['columns'].splice(5, 1);
493
        [% END %]
494
        $(document).ready(function() {
506
        $(document).ready(function() {
495
            $("#uploadresults").kohaTable({}, table_settings);
507
            $("#uploadresults").kohaTable({}, table_settings);
496
508
497
            [% IF msg %]
509
            if (msg_alert){
498
                ShowAlerts( [% msg | html %] );
510
                ShowAlerts(msg_alert);
499
            [% END %]
511
            }
500
            $("#fileuploadcancel").hide();
512
            $("#fileuploadcancel").hide();
501
            $("#public_cb").click(function() {
513
            $("#public_cb").click(function() {
502
                $("#public").click();
514
                $("#public").click();
503
- 

Return to bug 41580