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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt (-1 / +19 lines)
Lines 170-176 Link Here
170
        <td>[% record.hashvalue | html %]</td>
170
        <td>[% record.hashvalue | html %]</td>
171
        <td>[% record.uploadcategorycode | html %]</td>
171
        <td>[% record.uploadcategorycode | html %]</td>
172
        [% IF !plugin %]
172
        [% IF !plugin %]
173
            <td>[% IF record.public %]Yes[% ELSE %]No[% END %]</td>
173
            <td>
174
                [% IF record.public %]
175
                    <a href="[% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-retrieve-file.pl?id=[% record.hashvalue | uri %]" class="get-file" data-toggle="tooltip" title="Copy link to this file"><i class="fa fa-link" aria-hidden="true"></i> Yes</a>
176
                [% ELSE %]
177
                    No
178
                [% END %]
179
            </td>
174
            <td>[% IF record.permanent %]No[% ELSE %]Yes[% END %]</td>
180
            <td>[% IF record.permanent %]No[% ELSE %]Yes[% END %]</td>
175
        [% END %]
181
        [% END %]
176
        <td class="actions">
182
        <td class="actions">
Lines 425-430 Link Here
425
                e.preventDefault();
431
                e.preventDefault();
426
                SubmitMe('new');
432
                SubmitMe('new');
427
            });
433
            });
434
435
            $(".get-file").on("click", function(e){
436
                e.preventDefault();
437
                copyToClipboard( $(this).attr("href") );
438
                $(this).attr("data-original-title", _( "Link copied to the clipboard" ) )
439
                    .tooltip("show");
440
            });
441
            $(".get-file").tooltip({
442
                delay: { "show": 100, "hide": 500 }
443
            }).on("hidden.bs.tooltip", function(){
444
                $(this).attr("data-original-title", _( "Copy link to this file" ) );
445
            });
428
        });
446
        });
429
    </script>
447
    </script>
430
[% END %]
448
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-2 / +14 lines)
Lines 1-5 Link Here
1
/* global shortcut delCookie delBasket Sticky */
1
/* global shortcut delCookie delBasket Sticky */
2
/* exported paramOfUrl addBibToContext delBibToContext */
2
/* exported paramOfUrl addBibToContext delBibToContext copyToClipboard */
3
if ( KOHA === undefined ) var KOHA = {};
3
if ( KOHA === undefined ) var KOHA = {};
4
4
5
function _(s) { return s; } // dummy function for gettext
5
function _(s) { return s; } // dummy function for gettext
Lines 358-360 function saveOrClearSimpleSearchParams() { Link Here
358
    localStorage.setItem('cat_search_pulldown_selection', pulldown_selection );
358
    localStorage.setItem('cat_search_pulldown_selection', pulldown_selection );
359
    localStorage.setItem('searchbox_value', searchbox_value );
359
    localStorage.setItem('searchbox_value', searchbox_value );
360
}
360
}
361
- 
361
362
// https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f
363
function copyToClipboard( text ){
364
    var el = document.createElement("textarea");  // Create a <textarea> element
365
    el.value = text;                                 // Set its value to the string that you want copied
366
    el.setAttribute("readonly", "");                // Make it readonly to be tamper-proof
367
    el.style.position = "absolute";
368
    el.style.left = "-9999px";                      // Move outside the screen to make it invisible
369
    document.body.appendChild(el);                  // Append the <textarea> element to the HTML document
370
    el.select();                                    // Select the <textarea> content
371
    document.execCommand("copy");                   // Copy - only works as a result of a user action (e.g. click events)
372
    document.body.removeChild(el);                  // Remove the <textarea> element
373
}

Return to bug 27594