Koha/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc
Owen Leonard 66289610fa Bug 12533: Improve authority search result display
This patch implements a few changes in the way authority records are
displayed in search results.

- In most cases heading type is now displayed as a separate column in
  the table of search results.
- The heading itself is now linked rather than a separate "details"
  link.

In the authority search results for MARC editor plugins the heading link
triggers a modal with the authority details instead of linking to a
separate page.

To test, apply the patch and go to Authorities.

- Perform an authority search which will return results.
- In the search results headings should be linked to the
  corresponding detail page.
- There should be a separate column for heading type.
- Go to Cataloging and create a new record using a framework which has
  a field linked to an authority type (e.g. 100a -> PERSO_NAME ).
- Perform a search which will return results.
- In the search results, clicking a heading link should trigger a
  modal window with the authority details.
- Test multiple entries in the results and confirm that each
  time the correct data is loaded into the modal window.
- Test the same process for a field which is linked to the
  unimarc_field_210c.pl plugin.
- Go to Tools -> Batch record modification and submit multiple
  authority record numbers.
- In the results list the heading should be linked correctly to the
  corresponding detail page. Heading type is not present in this
  view.
- Perform the same test with batch record deletion.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

Signed-off-by: Marjorie Barry-Vila <marjorie.barry-vila@collecto.ca>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-04 12:59:33 +01: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">
<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 %]