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 178-184 Link Here
178
        <td>[% record.hashvalue | html %]</td>
178
        <td>[% record.hashvalue | html %]</td>
179
        <td>[% record.uploadcategorycode | html %]</td>
179
        <td>[% record.uploadcategorycode | html %]</td>
180
        [% IF !plugin %]
180
        [% IF !plugin %]
181
            <td>[% IF record.public %]Yes[% ELSE %]No[% END %]</td>
181
            <td>
182
                [% IF record.public %]
183
                    <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>
184
                [% ELSE %]
185
                    No
186
                [% END %]
187
            </td>
182
            <td>[% IF record.permanent %]No[% ELSE %]Yes[% END %]</td>
188
            <td>[% IF record.permanent %]No[% ELSE %]Yes[% END %]</td>
183
        [% END %]
189
        [% END %]
184
        <td class="actions">
190
        <td class="actions">
Lines 429-434 Link Here
429
                e.preventDefault();
435
                e.preventDefault();
430
                SubmitMe('new');
436
                SubmitMe('new');
431
            });
437
            });
438
439
            $(".get-file").on("click", function(e){
440
                e.preventDefault();
441
                copyToClipboard( $(this).attr("href") );
442
                $(this).attr("data-original-title", _( "Link copied to the clipboard" ) )
443
                    .tooltip("show");
444
            });
445
            $(".get-file").tooltip({
446
                delay: { "show": 100, "hide": 500 }
447
            }).on("hidden.bs.tooltip", function(){
448
                $(this).attr("data-original-title", _( "Copy link to this file" ) );
449
            });
432
        });
450
        });
433
    </script>
451
    </script>
434
[% END %]
452
[% 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