[Koha] How to hide Subfield in OPAC
Andy Boze
Boze.1 at nd.edu
Tue Apr 20 06:37:50 NZST 2021
It might be possible to hide the link by using CSS. It may depend on the
method your patrons use to authenticate. We use Shibboleth. When a
patron is not logged in, the CSS class for <BODY> is "branch-default".
When the patron is logged in, the class is "branch-LUP". We only have
one branch, but presumably that would change depending on the branch the
patron is logged in to.
You could probably use some CSS like
.branch-default .online_resources {
display: none;
}
This might depend upon which XSLT you're using for the display.
Andy
On 4/19/2021 2:07 PM, Eric Phetteplace wrote:
> Could you send a link to an example record? It's possible your URL is in an
> unexpected format. I assumed that the text ".pdf" would appear somewhere in
> the URL but if it does not, then the code will not work.
>
> 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
> <https://ashaybythebay.com/>, Marcus Books
> <https://www.facebook.com/marcus.books/>
>
> :(){ :|: & };:
>
>
> On Mon, Apr 19, 2021 at 11:03 AM Ketut Gunawan <kettgun at yahoo.com> wrote:
>
>> 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
>>>
>>>
>>
>>
> _______________________________________________
>
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>
--
Andy Boze, Associate Librarian
University of Notre Dame
271H Hesburgh Library
(574) 631-8708
More information about the Koha
mailing list