Koha/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt
Owen Leonard 1bcc45be62
Bug 25428: Correctly encode link if authority subfield is a URL
This patch modifies the script and template for showing the details of
an authority record so that if the authority subfield is configured to
be a link the link is correctly output in the template.

To test you must have an authority type configured with at least one
subfield designated as a URL:

 - Go to Administration -> Authority types
 - Select "MARC structure" from the actions menu for the authority type
   you want to modify.
 - Select "Subfields" from the actions menu for the tag containing
   the subfield you want to modify (for instance 856).
 - Edit the subfield you want to display as a link (e.g. subfield u).
 - In the subfield configuration form under "Advanced constraints" check
   the "Is a URL" checkbox and save your changes.

 - Apply the patch and go to Authorities in the staff interface.
 - Search for or create an authority record which contains URL
   information in the right subfield (for instance 856$u).
 - View the details for the record. Using the 856 example, the "8" tab
   should contain an active link pointing to the correct URL.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-05-22 09:33:16 +01:00

130 lines
4.8 KiB
Text

[% USE raw %]
[% USE Asset %]
[% SET footerjs = 1 %]
[% PROCESS 'authorities.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Authorities &rsaquo;
[% IF ( unknownauthid ) %]
Unknown authority record
[% ELSE %]
Details for authority #[% authid | html %] ([% authtypetext | html %])
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="auth_detail" class="auth">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'authorities-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> &rsaquo;
[% IF ( unknownauthid ) %]
Unknown authority record
[% ELSE %]
Details for authority #[% authid | html %] ([% authtypetext | html %])
[% END %]
</div>
<div class="main container-fluid">
<div class="row">
<div class="col-md-8 col-md-offset-2">
[% INCLUDE 'authorities-toolbar.inc' %]
[% IF ( displayhierarchy ) %]
<div id="hierarchies">
[% PROCESS showhierarchy trees = loophierarchies %]
</div>
[% END %]
[% IF ( unknownauthid ) %]
<div class="dialog message">The authority record you requested does not exist ([% errauthid | html %]).</div>
[% ELSE %]
<h1>Authority #[% authid | html %] ([% authtypetext | html %])</h1>
<div id="action">
[% IF count %]
Used in <a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&amp;op=do_search&amp;q=an=[% authid | uri %]">[% count | html %] record(s)</a>
[% ELSE %]
This authority is not used in any records.
[% END %]
</div>
<div id="authoritiestabs" class="toptabs numbered">
<ul>
[% FOREACH BIG_LOO IN BIG_LOOP %]
<li>
<a href="#tab[% BIG_LOO.number | uri %]XX">[% BIG_LOO.number | html %]</a>
</li>
[% END %]
</ul>
[% FOREACH BIG_LOO IN BIG_LOOP %]
<div id="tab[% BIG_LOO.number | html %]XX">
[% FOREACH innerloo IN BIG_LOO.innerloop %]
[% IF ( innerloo.tag_number ) %]
<div class="tag">
<div class="tag_title">
<span class="tag_num">[% innerloo.tag_number | html %]</span>
[% IF (innerloo.defined("ind1") ) %]
<span class="tag_ind1">[% innerloo.ind1 | html %]</span><span class="tag_ind2">[% innerloo.ind2 | html %]</span>
[% END %]
[% IF (innerloo.tag_desc) %]<span class="dashwrapper"> -</span> <span class="tag_desc">[% innerloo.tag_desc | html %]</span>[% END %]
</div>
[% ELSE %]
<div class="tag">
[% END %]
[% FOREACH subfiel IN innerloo.subfield %]
<p>
<label class="labelsubfield">&nbsp;
[% UNLESS ( subfiel.hide_marc ) %]<b>[% subfiel.marc_subfield | html %]</b>[% END %]
<span title="[% subfiel.long_desc | html %]" class="desc">[% subfiel.short_desc | html %]</span></label>
[% IF ( subfiel.is_url ) %]
<a href="[% subfiel.marc_value | url %]">[% subfiel.marc_value | html %]</a>
[% ELSE %]
[% subfiel.marc_value | html %]
[% END %]
[% IF ( subfiel.link ) %]
<a href="/cgi-bin/koha/catalogue/search.pl?op=do_search&amp;marclist=[% subfiel.link | uri %]&amp;operator==&amp;type=intranet&amp;value=[% subfiel.marc_value |url %]">
<img src="[% interface | html %]/[% theme | html %]/images/filefind.png" height="15" title="Search on [% subfiel.marc_value | html %]">
</a>
[% END %]
[% IF ( subfiel.authority ) %]
<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% subfiel.authority | uri %]" class="button">Auth</a>
[% END %]
</p>
[% END %]
</div>
[% END %]
</div>
[% END %]
</div>
</div>
</div>
[% END %]
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'authorities_js.inc' %]
[% IF ( displayhierarchy ) %]
[% Asset.js("lib/jquery/plugins/jquery.jstree.js") | $raw %]
[% END %]
<script>
$(document).ready(function() {
$('#authoritiestabs').tabs();
[% IF ( displayhierarchy ) %]
var current_nodes = [];
$('.currentauth').each(function() {
current_nodes.push('#' + $(this).parent().parents('li:first').attr('id'));
});
$('#hierarchies').jstree({
"plugins": [ "themes", "html_data"],
"themes": { "theme": "classic",
"icons": false },
"core": { "initially_open": current_nodes }
});
[% END %]
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]