[Koha] How to hide Subfield in OPAC

Ketut Gunawan kettgun at yahoo.com
Tue Apr 20 06:03:23 NZST 2021


Dear Eric,

Thank you for your explanation. Hope it could be possible in the future.
I tried to copy your script (hide-pdf-urls.js) in OPACUserJS, and searched collection with PDF file in 856$u. But it doesn't change the link of "Online access: Click here to access online" both in the search result and detail.pl page (the link still goes to my PDF file). Do I miss something in the setting?

Regards,
Ketut Gunawan  






On Monday, April 19, 2021, 11:45:52 PM GMT+8, Eric Phetteplace <ephetteplace at cca.edu> wrote: 





Hi Ketut,

I'm sure someone will correct me if I'm wrong, but I don't think it's possible to modify the display of records based on whether or not someone is signed in. You can modify their display by editing Koha's XSLT templates. See Koha > koha-tmpl > opac-tmpl > bootstrap > en > xslt, here's an example one. But there is no way to change these conditionally based on whether a user is authenticated or not.

You could simulate this with some jQuery: https://gist.github.com/phette23/f4595ae6b8bddcf8d55cd12cc378253a

You would add this to your OPACUserJS setting. But it's not truly safe; users could disable JavaScript and they would see the PDF URLs, or they could view or export the underlying bibliographic record to find the URL. The only truly safe way to do this is to put the PDFs behind authentication somewhere e.g. in an institutional repository.

Best,
ERIC PHETTEPLACE Systems Librarian, Libraries (he/him)
ephetteplace at cca.edu | o 510.594.3660 (cca)

5212 Broadway | Oakland, CA | 94618
CCA is situated on the traditional unceded lands of the Ohlone peoples.
Black-owned bookstores in Oakland: Ashay by the Bay, Marcus Books
:(){ :|: & };:


On Mon, Apr 19, 2021 at 2:16 AM Ketut Gunawan <kettgun at yahoo.com> wrote:
> Dear all,
> I am new to Koha so I need helps. I have a subfield 856$u containing PDF files in hundred of records. I want to hide it in OPAC so that public visitors cannot see "Online resources: Click here to access online", but for those who log in (students)  can see and click such a link.
> 
> I have tried to read the manual and search the forum, but I can find it. Any help would be much appreciated.
> 
> Best Regards,
> K. Gunawan
> SocPolSci Faculty, Mulawarman University
> Indonesia
> 
> _______________________________________________
> 
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
> 
> 



More information about the Koha mailing list