@@ -, +, @@
publicly-accessible uploads
- If necessary, upload a file with the "Allow public downloads"
checkbox checked.
- Upon upload you should be shown the results of your upload in a table
with the file details.
- In the "Public" column you should see that "Yes" is a link.
- When you hover your mouse over the link you should see a tooltip,
"Copy link to this file."
- When you click the link the tooltip should say "Link copied to the
clipboard."
- Verify that the correct link has been copied.
- Test uploading a file which is not publicly-accessible.
- Confirm that the information in the "Public" column says "No" and is
not a link.
---
.../intranet-tmpl/prog/en/modules/tools/upload.tt | 20 +++++++++++++++++++-
koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 15 ++++++++++++++-
2 files changed, 33 insertions(+), 2 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt
@@ -178,7 +178,13 @@
[% record.hashvalue | html %] |
[% record.uploadcategorycode | html %] |
[% IF !plugin %]
- [% IF record.public %]Yes[% ELSE %]No[% END %] |
+
+ [% IF record.public %]
+ Yes
+ [% ELSE %]
+ No
+ [% END %]
+ |
[% IF record.permanent %]No[% ELSE %]Yes[% END %] |
[% END %]
@@ -429,6 +435,18 @@
e.preventDefault();
SubmitMe('new');
});
+
+ $(".get-file").on("click", function(e){
+ e.preventDefault();
+ copyToClipboard( $(this).attr("href") );
+ $(this).attr("data-original-title", _( "Link copied to the clipboard" ) )
+ .tooltip("show");
+ });
+ $(".get-file").tooltip({
+ delay: { "show": 100, "hide": 500 }
+ }).on("hidden.bs.tooltip", function(){
+ $(this).attr("data-original-title", _( "Copy link to this file" ) );
+ });
});
[% END %]
--- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js
+++ a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js
@@ -1,5 +1,5 @@
/* global shortcut delCookie delBasket Sticky */
-/* exported paramOfUrl addBibToContext delBibToContext */
+/* exported paramOfUrl addBibToContext delBibToContext copyToClipboard */
if ( KOHA === undefined ) var KOHA = {};
function _(s) { return s; } // dummy function for gettext
@@ -358,3 +358,16 @@ function saveOrClearSimpleSearchParams() {
localStorage.setItem('cat_search_pulldown_selection', pulldown_selection );
localStorage.setItem('searchbox_value', searchbox_value );
}
+
+// https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f
+function copyToClipboard( text ){
+ var el = document.createElement("textarea"); // Create a |