Bugzilla – Attachment 119304 Details for
Bug 27594
Add access to public download link for publicly-accessible uploads
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27594: Add access to public download link for publicly-accessible uploads
Bug-27594-Add-access-to-public-download-link-for-p.patch (text/plain), 3.56 KB, created by
Jonathan Druart
on 2021-04-07 14:15:31 UTC
(
hide
)
Description:
Bug 27594: Add access to public download link for publicly-accessible uploads
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-04-07 14:15:31 UTC
Size:
3.56 KB
patch
obsolete
>From fdac75e51d84fd0a2f37ee988980c3dff7188055 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 2 Feb 2021 14:10:49 +0000 >Subject: [PATCH] Bug 27594: Add access to public download link for > publicly-accessible uploads > >This patch adds a link to the display of publicly-accessible uploads so >that the user can copy the public link. This will hopefully lead to >easier use of sound file uploads in the Audio Alerts system. > >To test, apply the patch and go to Tools -> Upload. > >- 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. > >Signed-off-by: David Nind <david@davidnind.com> > >Bug 27594: (QA follow-up): Use clipboard API > >While the Clipboard API doesn't >have 100% coverage (https://www.caniuse.com/?search=clipboard), it has >enough coverage for the "copy" operation that it can be counted on for >use in the staff interface. > >This patch removes the global copyToClipboard function and replaces it >with a call to ndavigator.clipboard.writeText() in the template. > >To test, follow the previous test plan and confirm that the public >download link is still copied correctly to the clipboard. >--- > .../prog/en/modules/tools/upload.tt | 22 ++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >index 847940f628..00d380a813 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >@@ -185,7 +185,13 @@ > <td>[% record.hashvalue | html %]</td> > <td>[% record.uploadcategorycode | html %]</td> > [% IF !plugin %] >- <td>[% IF record.public %]Yes[% ELSE %]No[% END %]</td> >+ <td> >+ [% IF record.public %] >+ <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> >+ [% ELSE %] >+ No >+ [% END %] >+ </td> > <td>[% IF record.permanent %]No[% ELSE %]Yes[% END %]</td> > [% END %] > <td class="actions"> >@@ -436,6 +442,20 @@ > e.preventDefault(); > SubmitMe('new'); > }); >+ >+ $(".get-file").on("click", function(e){ >+ e.preventDefault(); >+ if( navigator.clipboard ){ >+ navigator.clipboard.writeText( $(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" ) ); >+ }); > }); > </script> > [% END %] >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27594
:
116218
|
116219
|
117289
|
117310
|
119241
|
119304
|
119305
|
119398
|
119906
|
119995
|
119996
|
119997
|
120416