[Koha] How to hide Subfield in OPAC

Alvaro Cornejo cornejo.alvaro at gmail.com
Wed Apr 21 09:07:34 NZST 2021


Hi Eric

That works fine for the biblio detail. However the holdings/item still
shows the url.

See
https://biblioteca.celacp.org/cgi-bin/koha/opac-detail.pl?biblionumber=249615

How can we extend this restriction to items url?

Regards

Alvaro

|----------------------------------------------------------------------------------------|
 Stay safe / Cuídate/  Reste sécurisé
*7* Switch off as you go / Apaga lo que no usas /  Débranchez au fur et à
mesure.
 *q *Recycle always / Recicla siempre / Recyclez toujours
 P Print only if absolutely necessary / Imprime solo si es necesario /
Imprimez seulement si nécessaire


Le lun. 19 avr. 2021 à 15:40, Eric Phetteplace <ephetteplace at cca.edu> a
écrit :

> So I assumed ".pdf" would appear somewhere in the link. You can use this
> updated code to hide *any* "online resources" links even once that look
> like the "opac-retrieve-file" links:
> https://gist.github.com/phette23/f4595ae6b8bddcf8d55cd12cc378253a
>
> And pasted here:
>
> // run 1) on opac-detail pages & 2) if no user is signed in
> if (!!location.pathname.match('/cgi-bin/koha/opac-detail.pl') &&
> !$('.loggedinusername').length) {
>     // replace 856$u links with a link to login instead
>     // this would need to be tweaked if there are multiple URLs per record
>     $('.results_summary.online_resources a')
>         .replaceWith('<a href="/cgi-bin/koha/opac-user.pl">login to
> view PDF</a>')
> }
>
>
> Again, though, this is somewhat illusory; people can still access
> these PDFs without logging in if they really want to and have some
> minimal technical skills. So if the PDFs are quite sensitive you would
> need another approach.
>
>
> 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 12:35 PM Ketut Gunawan <kettgun at yahoo.com> wrote:
>
> >
> >
> >
> >
> >
> >
> >
> > On Tuesday, April 20, 2021, 3:24:48 AM GMT+8, Ketut Gunawan <
> > kettgun at yahoo.com> wrote:
> >
> >
> >
> >
> >
> > Dear Eric,
> > This is the link to pdf:
> >
> https://xp.fisip-unmul.ac.id/cgi-bin/koha/opac-retrieve-file.pl?id=4ff69d8b703b134d83e7f065f2a34f45
> >
> > You can search in the title with keyword: military. (result no 1)
> >
> > For Andy,
> > Thanks for mentioning another option. I have to learn about Shibboleth
> > first :-} but I will try.
> >
> > Best regards,
> > Ketut
> >
> >
> >
> >
> >
> > On Tuesday, April 20, 2021, 2:38:33 AM GMT+8, Andy Boze <boze.1 at nd.edu>
> > wrote:
> >
> >
> >
> >
> >
> > 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
> >
> > _______________________________________________
> >
> > 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
> >
> _______________________________________________
>
> 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