Koha/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc
Nick Clemens 0492b19938 Bug 29965: (follow-up) Use a new class for the preview
With previous patches everythign worked, however, clicking the heading in
authority search results now launched the preview instead of taking you to the
authority details

This patch uses a new class to launch the modal and conditionally applies it to
authority results as we expect different behaviours when searching from the popup
vs authority module

To test:
1 - Repeate previous tests, confirm they pass
2 - Search for authorities in the authority module
3 - COnfirm clicking on heading takes you to detail page for authority

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-02-23 22:05:33 -10:00

146 lines
5.7 KiB
HTML

[% USE raw %]
[% BLOCK showreference %]
[%# Parameters: %]
[%# heading: the heading itself %]
[%# linkType: currently 'seefrom' or 'seealso', controls the label for the entry type: %]
[%# authid: if it is a linked authority, its authid %]
[% SET authidurl = '/cgi-bin/koha/authorities/detail.pl?authid=' %]
[% SET searchurl = '/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&marclist=any&operator=contains&orderby=HeadingAsc&value=' %]
[% IF marcflavour == 'UNIMARC' %]
[% IF authid %]
[% link = BLOCK %]<a href="[% authidurl _ authid | url %]">[% heading | html %]</a>[% END %]
[% ELSE %]
[% link = BLOCK %][% heading | html %][% END %]
[% END %]
[% SWITCH type %]
[% CASE 'broader' %]
<span class="BT"><abbr title="Broader Term">BT</abbr>: [% link | $raw %]</span>
[% CASE 'narrower' %]
<span class="NT"><abbr title="Narrower Term">NT</abbr>: [% link | $raw %]</span>
[% CASE 'seefrom' %]
<span class="UF"><abbr title="Used For">UF</abbr>: [% link | $raw %]</span>
[% CASE 'seealso' %]
<span class="RT"><abbr title="Related Term">RT</abbr>: [% link | $raw %]</span>
[% END %]
[% ELSE %]
<span class="heading">
[% IF ( linkType=='seealso' ) %]
[% IF ( authid ) %]
<a href="[% authidurl | url %][% authid | uri %]">[% heading | html %]</a>
[% ELSE %]
<a href="[% searchurl | url %][% heading | uri %]">[% heading | html %]</a>
[% END %]
[% ELSE %]
[% heading | html %]
[% END %]
</span>
[% UNLESS ( type=='seefrom' || type=='seealso' ) %]
<span class="type">
[% SWITCH type %]
[% CASE 'earlier' %](Earlier heading)
[% CASE 'later' %](Later heading)
[% CASE 'acronym' %](Acronym)
[% CASE 'musical' %](Musical composition)
[% CASE 'broader' %](Broader heading)
[% CASE 'narrower' %](Narrower heading)
[% CASE 'parent' %](Immediate parent body)
[% CASE %][% IF type %]([% type | html %])
[% END %]
[% END %]
</span>
[% END %]
[% END %]
[% END %]
[% BLOCK authresult %]
[% IF ( summary.label ) %][% summary.label | html %]:[% END %]
[% IF summary.summary %]
<div class="authority-summary">
[% summary.summary | html %]
</div>
[% END %]
[% UNLESS ( summary.summaryonly ) %]
<div class="authorizedheading">
[% FOREACH authorize IN summary.authorized %]
<span class="authorizedheading [% IF auth_preview %]authority_preview[% END %]">
<a data-authid="[% authid | html %]" href="/cgi-bin/koha/authorities/detail.pl?authid=[% authid | uri %]">[% authorize.heading | html %]</a>
</span>
[% UNLESS loop.last %] | [% END %]
[% END %]
</div>
[% IF ( marcflavour == 'UNIMARC' ) %]
[% IF summary.notes %]
<div class="authres_notes">
[% FOREACH note IN summary.notes %]
<span>[% note.note | html %]</span>
[% END %]
</div>
[% END %]
[% IF summary.seefrom %]
<div class="authres_seefrom">
[% FOREACH see IN summary.seefrom %]
[% PROCESS showreference heading=see.heading linkType="" type=see.type authid=see.authid %]
[% IF ! loop.last %] ; [% END %]
[% END %]
</div>
[% END %]
[% IF summary.seealso %]
<div class="authres_seealso">
[% FOREACH see IN summary.seealso %]
[% PROCESS showreference heading=see.heading linkType="" type=see.type authid=see.authid %]
[% IF ! loop.last %] ; [% END %]
[% END %]
</div>
[% END %]
[% IF summary.otherscript %]
<div class="authres_otherscript">
[% FOREACH other IN summary.otherscript %]
[% PROCESS language lang=other.lang | trim %]:
[% other.term | html %]
[% IF ! loop.last %] ; [% END %]
[% END %]
</div>
[% END %]
[% ELSE %]
[% IF ( summary.seefrom.size >= 1 ) %]
<div class="seefrom">
<span class="seefrom">used for/see from:</span>
[% FOREACH seefro IN summary.seefrom %]
<div class="authref">
[%# Following on one line for translatability %]
[% PROCESS showreference heading=seefro.heading linkType='seefrom' type=seefro.type authid=seefro.authid %]
</div>
[% END %]
</div>
[% END %]
[% IF ( summary.seealso.size >= 1 ) %]
<div class="seealso">
<span class="seealso">see also:</span>
[% FOREACH seeals IN summary.seealso %]
<div class="authref">
[%# Following on one line for translatability %]
[% PROCESS showreference heading=seeals.heading linkType='seealso' type=seeals.type authid=seeals.authid %]
</div>
[% END %]
</div>
[% END %]
[% END %]
[% END %]
[% END %]
[% BLOCK language %]
[% SWITCH lang %]
[% CASE ['en', 'eng'] %]English
[% CASE ['fr', 'fre'] %]French
[% CASE ['it', 'ita'] %]Italian
[% CASE ['de', 'ger', 'deu'] %]German
[% CASE ['es', 'spa'] %]Spanish
[% CASE ['heb'] %]Hebrew
[% CASE ['ara'] %]Arabic
[% CASE ['gre'] %]Greek (modern)
[% CASE ['grc'] %]Greek (to 1453)
[% CASE %][% lang | html %]
[% END %]
[% END %]