Bugzilla – Attachment 111296 Details for
Bug 25475
upload.pl should provide a "Copy link" option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25475: add "Copy link" button to upload.pl
Bug-25475-add-Copy-link-button-to-uploadpl.patch (text/plain), 3.82 KB, created by
PTFS Europe Sandboxes
on 2020-10-06 11:46:30 UTC
(
hide
)
Description:
Bug 25475: add "Copy link" button to upload.pl
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2020-10-06 11:46:30 UTC
Size:
3.82 KB
patch
obsolete
>From 1b62ca90893d0e883672a1f182988e426afd6a1b Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 14 May 2020 01:58:49 +0000 >Subject: [PATCH] Bug 25475: add "Copy link" button to upload.pl > >This patch adds a "Copy link" button to /cgi-bin/koha/tools/upload.pl. > >It will create a modal that displays a URL like the following: >http://kohadev.myDNSname.org:8080/cgi-bin/koha/opac-retrieve-file.pl? >id=beb928969032f980056ea8269bc816fe >Users can then copy the URL from that modal. > >If the browser supports the Clipboard API, the URL is also written to >the browser's clipboard, making manually copying from the modal redundant. > >Test plan: >0) Apply patch >1) Go to http://localhost:8081/cgi-bin/koha/tools/upload.pl >2) Upload a file with the "Allow public downloads" box checked >3) Note the "Copy link" button in the "Actions" column >4) Click "Copy link" >5) Note that a modal is created with contents like the following: >http://kohadev.myDNSname.org:8080/cgi-bin/koha/opac-retrieve-file.pl? >id=beb928969032f980056ea8269bc816fe >5b) If you're using a modern browser, try Ctrl+V somewhere and note >that the URL has already been copied to your clipboard >6) Manually highlight the text in the modal and Ctrl+C >7) Click outside the modal >8) Paste the URL somewhere useful like a system preference or News item >9) Profit > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> >--- > .../intranet-tmpl/prog/en/modules/tools/upload.tt | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > >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 3ed10dcae3..6c7c4356f4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >@@ -178,6 +178,7 @@ > <button class="btn btn-default btn-xs choose_entry" data-record-hashvalue="[% record.hashvalue | html %]"><i class="fa fa-plus"></i> Choose</button> > [% END %] > <button class="btn btn-default btn-xs download_entry" data-record-id="[% record.id | html %]"><i class="fa fa-download"></i> Download</button> >+ <button class="btn btn-default btn-xs copy_entry" data-record-hashvalue="[% record.hashvalue | html %]"><i class="fa fa-copy"></i> Copy link</button> > [% IF record.owner == owner || CAN_user_tools_upload_manage %] > <button class="btn btn-default btn-xs delete_entry" data-record-id="[% record.id | html %]"><i class="fa fa-trash"></i> Delete</button> > [% END %] >@@ -416,6 +417,23 @@ > var record_id = $(this).data("record-id"); > SubmitMe( 'download', record_id ); > }); >+ $(".copy_entry").on("click",function(e){ >+ e.preventDefault(); >+ var record_hashvalue = $(this).data("record-hashvalue"); >+ var res = '[% Koha.Preference('OPACBaseURL') | html %]'; >+ res = res + '/cgi-bin/koha/opac-retrieve-file.pl?id=' + record_hashvalue; >+ if (res){ >+ //If Clipboard API available, use it to write secretly and directly to browser clipboard >+ if (navigator.clipboard){ >+ var promise = navigator.clipboard.writeText(res); >+ } >+ //The Clipboard API isn't available to all browsers, so show a modal for people to copy from manually >+ var popup = '<div class="modal fade"><div class="modal-dialog"><div class="modal-content"><div class="modal-body">'+res+'</div></div></div></div>' >+ $(popup).modal(); >+ } >+ >+ console.log(res); >+ }); > $(".delete_entry").on("click",function(e){ > e.preventDefault(); > var record_id = $(this).data("record-id"); >-- >2.11.0
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 25475
:
104858
| 111296