Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt
Owen Leonard 2c67096c07
Bug 34407: Inconsistencies in Z39.50 servers page titles, breadcrumbs, and header
This patch makes changes to the Z39.50 servers administration and
related templates in order to make them more consistent with other pages
in Koha.

One case has been added to page title and breadcrumb navigation: An
indication that a search has been performed. The subheading is modified
to make it clear that the search is a "starts with" search.

To test, apply the patch and go to Administration -> Z39.50/SRU
servers. View each variation of the page to confirm that breadcrumb
navigation, page title, and page headings are consistent with each
other.

- Z39.50/SRU servers list.
  - New Z39.50 server
  - New SRU server
  - Edit Z39.50 server
  - Edit SRU server
    - Modify SRU search field mapping for a bibliographic record
      server
    - Modify SRU search field mapping for an authority record server
  - Use the header search form to search for a server by name

Signed-off-by: Émily-Rose Francoeur <emily-rose.francoeur@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-18 12:06:13 -03:00

337 lines
16 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE HtmlTags %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
[% IF (server.servertype||type) == 'sru' %]
[% SET servertype = "SRU" %]
[% ELSIF (server.servertype||type) == 'zed' %]
[% SET servertype = "Z39.50" %]
[% END %]
<title>[% FILTER collapse %]
[% IF op == 'edit' %]
[% tx("Modify {servertype} server '{servername}'", { servertype = servertype, servername = server.servername }) | html %] &rsaquo;
[% ELSIF op == 'add' %]
[% tx("New {servertype} server", { servertype = servertype }) | html %] &rsaquo;
[% ELSIF searchfield %]
[% tx("Search results for '{search_keyword}'", { search_keyword = searchfield }) | html %] &rsaquo;
[% END %]
[% t("Z39.50/SRU servers") | html %] &rsaquo;
[% t("Administration") | html %] &rsaquo;
[% t("Koha") | html %]
[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_z3950servers" class="admin">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'z3950-admin-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.inc' %]
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
[% END %]
[% IF op == 'edit' || op == 'add' || searchfield %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a>
[% END %]
[% END %]
[% IF op == 'edit' %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
[% tx("Modify {servertype} server '{servername}'", { servertype = servertype, servername = server.servername }) | html %]
[% END %]
[% ELSIF op == 'add' %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
[% tx("New {servertype} server", { servertype = servertype }) | html %]
[% END %]
[% ELSIF searchfield %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
[% tx("Search results for '{search_keyword}'", { search_keyword = searchfield }) | html %]
[% END %]
[% ELSE %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Z39.50/SRU servers</span>
[% END %]
[% END %]
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% IF msg_deleted %]
<div class="dialog alert">Z39.50/SRU server deleted ([% msg_add | html %])</div>
[% ELSIF msg_updated %]
<div class="dialog message">Z39.50/SRU server updated ([% msg_add | html %])</div>
[% ELSIF msg_added %]
<div class="dialog message">Z39.50/SRU server added ([% msg_add | html %])</div>
[% ELSIF msg_notfound %]
<div class="dialog alert">Error: Server with ID [% msg_add | html %] not found</div>
[% END %]
[% IF ( add_form ) %]
<form action="[% script_name | html %]" name="Aform" method="post" id="serverentry">
[% IF op == 'edit' %]
<h1>[% tx("Modify {servertype} server '{servername}'", { servertype = servertype, servername = server.servername }) | html %]</h1>
<input type="hidden" name="id" value="[% server.id | html %]" />
[% ELSE %]
<h1>[% tx("New {servertype} server", { servertype = servertype }) | html %]</h1>
[% END %]
<input type="hidden" name="op" value="add_validated" />
<input type="hidden" name="servertype" value="[% server.servertype||type||'zed' | html %]"/>
<fieldset class="rows">
<ol>
<li><label for="name" class="required">Server name: </label>
[% IF server.servername %]
<input type="text" name="servername" id="servername" size="65" maxlength="100" value="[% server.servername | html %]" required="required" />
[% ELSE %]
<input type="text" name="servername" id="servername" class="focus" size="65" maxlength="100" value="[% server.servername | html %]" required="required" />
[% END %]
<span class="required">Required</span>
</li>
<li><label for="host" class="required">Hostname: </label> <input type="text" name="host" id="host" size="30" value="[% server.host | html %]" required="required" /> <span class="required">Required</span>
[% IF (server.servertype||type) == 'sru' %]
<div class="hint">Includes the domain part, but the path part of the URL should go into Database.</div>
[% END %]
</li>
<li><label for="port" class="required">Port: </label> <input type="text" name="port" id="port" size="5" value="[% server.port | html %]" required="required" /> <span class="required">Required</span>
</li>
<li><label for="db" class="required">Database: </label> <input type="text" name="db" id="db" value="[% server.db | html %]" required="required" /> <span class="required">Required</span>
</li>
<li><label for="userid">Userid: </label> <input type="text" name="userid" id="userid" value="[% server.userid | html %]" />
</li>
<li><label for="password">Password: </label> <input type="text" name="password" id="password" value="[% server.password | html %]" />
</li>
<li>
<label for="checked">Preselected: </label>
[% IF ( server.checked ) %]
<input type="checkbox" name="checked" id="checked" value="1" checked="checked" />
[% ELSE %]
<input type="checkbox" name="checked" id="checked" value="1" />
[% END %]
<span class="hint">Searched by default.</span>
</li>
<li>
<label for="rank">Rank: </label>
<input type="text" name="rank" id="rank" size="4" value="[% server.rank | html %]" />
<div class="hint">Display order.</div>
</li>
[% IF (server.servertype||type) == 'zed' %]
<li>
<label for="attributes">Attributes: </label>
<input type="text" name="attributes" id="attributes" size="30" value="[% server.attributes | html %]" />
<div class="hint">Additional PQF attributes added to each query.</div>
</li>
[% END %]
<li>
<label for="syntax">Syntax: </label>
<select name="syntax" id="syntax">
<option value="UNIMARC">UNIMARC</option>
<option value="INTERMARC">INTERMARC</option>
<option value="CCF">CCF</option>
<option value="USMARC">MARC21/USMARC</option>
<option value="UKMARC">UKMARC</option>
<option value="NORMARC">NORMARC</option>
<option value="LIBRISMARC">LIBRISMARC</option>
<option value="DANMARC">DANMARC</option>
<option value="FINMARC">FINMARC</option>
<option value="CANMARC">CANMARC</option>
<option value="SBN">SBN</option>
<option value="PICAMARC">PICAMARC</option>
<option value="AUSMARC">AUSMARC</option>
<option value="IBERMARC">IBERMARC</option>
<option value="CATMARC">CATMARC</option>
<option value="MALMARC">MALMARC</option>
</select>
<div class="hint">Z39.50 can send records in various formats. Choose one.</div>
</li>
<li>
<label for="encoding">Encoding: </label>
<select name="encoding" id="encoding">
[% FOREACH enc IN [ 'utf8' 'EUC-KR' 'ISO_5426' 'ISO_6937' 'ISO_8859-1' 'MARC-8' ] %]
<option value="[% enc | html %]">[% enc | html %]</option>
[% END %]
</select>
<div class="hint">Z39.50 can send records in various encodings. Choose one.</div>
</li>
<li>
<label for="timeout">Timeout: </label>
<input type="text" name="timeout" id="timeout" size="4" value="[% server.timeout | html %]" /> seconds
<div class="hint">Enter 0 to disable.</div>
</li>
<li><label for="recordtype">Record type: </label>
<select name="recordtype" id="recordtype">
<option value="biblio">Bibliographic</option>
<option value="authority">Authority</option>
</select>
</li>
[% IF (server.servertype||type) == 'sru' %]
<li>
<label for="sru_options">Additional SRU options: </label>
<input type="text" name="sru_options" id="sru_options" size="50" value="[% server.sru_options | html %]"/>
<div class="hint">Separate options by commas. Example: sru=get,sru_version=1.1. See also http://www.indexdata.com/yaz/doc/zoom.html.</div>
</li>
<li>
<label for="sru_fields">SRU Search fields mapping: </label>
<input type="hidden" name="sru_fields" id="sru_fields" value="[% server.sru_fields | html %]" />
<input type="text" name="show_sru_fields" id="show_sru_fields" size="100" value="[% server.sru_fields | html %]" disabled="disabled" /> <input type="button" id="modify_sru_fields" value="Modify" />
</li>
[% END %]
<li>
<label for="add_xslt">XSLT File(s) for transforming results: </label>
<input type="text" name="add_xslt" id="add_xslt" size="100" value="[% server.add_xslt | html %]"/>
<div class="hint">Separate multiple filenames by commas.</div>
</li>
</ol>
</fieldset>
<fieldset class="action"><input type="submit" class="btn btn-primary" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/z3950servers.pl">Cancel</a></fieldset>
</form>
[% END %]
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
<a id="newserver" class="btn btn-default" href="/cgi-bin/koha/admin/z3950servers.pl?op=add&type=zed"><i class="fa fa-plus"></i> New Z39.50 server</a>
<a id="newserver" class="btn btn-default" href="/cgi-bin/koha/admin/z3950servers.pl?op=add&type=sru"><i class="fa fa-plus"></i> New SRU server</a>
</div>
<h1>Z39.50/SRU servers</h1>
[% IF searchfield %]
<h2>
[% tx("Searching by target starting with '{search_keyword}'", { search_keyword = searchfield }) | html %]
</h2>
[% END %]
<div class="page-section">
<table id="serverst">
<thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Preselected</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>Attributes</th><th class="noExport">Actions</th>
</tr></thead>
<tbody>
[% FOREACH loo IN loop %]
<tr>
<td><a href="/cgi-bin/koha/admin/z3950servers.pl?op=edit&amp;id=[% loo.id | uri %]">[% loo.servername | html %]</a></td><td>[% loo.host | html %]:[% loo.port | html %]</td><td>[% loo.db | html %]</td><td>[% loo.userid | html %]</td><td>[% IF loo.password %]########[% END %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank | html %]</td>
<td>[% loo.syntax | html %]</td><td>[% loo.encoding | html %]</td><td>[% loo.timeout | html %]</td>
<td>[% IF ( loo.recordtype == 'biblio' ) %]
<span>Bibliographic</span>
[% ELSIF ( loo.recordtype == 'authority' ) %]
<span>Authority</span>
[% END %]
</td>
<td>[% loo.attributes | html %]</td>
<td>
<div class="btn-group dropup">
<a class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown" href="#">
Actions <b class="caret"></b>
</a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
<li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=edit&amp;id=[% loo.id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a></li>
<li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=add&amp;id=[% loo.id | uri %]"><i class="fa fa-copy"></i> Copy</a></li>
<li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=delete_confirmed&amp;id=[% loo.id | uri %]" class="delete" data-servername="[% loo.servername | html %]"><i class="fa fa-trash-can"></i> Delete</a></li>
</ul>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
</div> <!-- /.page-section -->
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% IF op == 'list' %]
[% INCLUDE 'datatables.inc' %]
[% END %]
<script>
[% IF ( add_form ) %]
$(document).ready(function(){
// Update selects for syntax, encoding and recordtype
[% IF server %]
$("#syntax").val('[% server.syntax | html %]');
$("#encoding").val('[% server.encoding | html %]');
$("#recordtype").val('[% server.recordtype | html %]');
[% END %]
$( "#serverentry" ).validate({
rules: {
servername: { required: true },
host: { required: true },
port: {
required: true,
number: true
},
db: { required: true },
rank: { number: true },
timeout: { number: true }
}
});
$("#serverentry").submit(function( event ) {
// first test if show_sru_fields exists
if( $('#show_sru_fields').length && $('#show_sru_fields').val()=='' && !confirm( _("No SRU search field mappings have been defined. This means that all field searches will go through the whole record. Continue?"))) {
return false;
}
// copy show_sru_fields to hidden counterpart
$('#sru_fields').val( $('#show_sru_fields').val() );
// enable recordtype to include field in post
$('#recordtype').prop('disabled',false);
});
$("#servername").on("blur",function(){
toUC(this);
});
$("#modify_sru_fields").on("click",function(){
ModMapping();
});
});
function ModMapping () {
var map= $('#show_sru_fields').val();
var type= $('#recordtype').val();
window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map + '&type=' + type,'popup','width=800,height=400,resizable=yes,toolbar=false,scrollbars=yes,top');
}
[% ELSE %]
$(document).ready(function() {
$("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [-1], "bSortable": false, "bSearchable": false },
],
"sPaginationType": "full"
}));
$(".delete").on("click",function(e){
var servername = $(this).data("servername");
if( confirm( _("Are you sure you want to delete server %s?").format(servername) ) ) {
return true;
} else {
e.preventDefault();
}
});
});
[% END %]
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]