Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt
Owen Leonard 5fe1ad8ac6
Bug 35402: Update the OPAC and staff interface to Bootstrap 5
This patch updates the OPAC and staff interface to use Bootstrap 5.
Bootstrap CSS assets are now pulled from node_modules and compiled into
staff-global.css and opac.css at build time. This update lays the
foundations of some other chnages, especially the addition of a dark
mode in the future.

Hundreds of templates have been updated, mostly with updates to the grid
markup. Most of the responsive behavior is still the same with the
exception of improved flexibility of headers and footers in both the
OPAC and staff interface.

The other most common change is to add a new "namespace" to data
attributes used by Bootstrap, e.g. "data-bs-target" or "data-bs-toggle".
Modal markup has also been updated everywhere. Other common changes:
dropdown button markup, alert markup (we now use Bootstrap's "alert
alert-warning" and "alert alert-info" instead of our old "dialog alert"
and "dialog info").

Bootstrap 5 now uses CSS variables which we can override in our own
'_variables.scss' (in both the OPAC and staff) to accomplish a lot of
the style overrides which we previously put in staff-global.scss.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-08-23 15:58:41 +02:00

348 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-md-10 order-md-2 order-sm-1">
<main>
[% INCLUDE 'messages.inc' %]
[% IF msg_deleted %]
<div class="alert alert-warning">Z39.50/SRU server deleted ([% msg_add | html %])</div>
[% ELSIF msg_updated %]
<div class="alert alert-info">Z39.50/SRU server updated ([% msg_add | html %])</div>
[% ELSIF msg_added %]
<div class="alert alert-info">Z39.50/SRU server added ([% msg_add | html %])</div>
[% ELSIF msg_notfound %]
<div class="alert alert-warning">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">
[% INCLUDE 'csrf-token.inc' %]
[% 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="cud-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-bs-toggle="dropdown" href="#">
Actions
</a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
<li><a class="dropdown-item" 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 class="dropdown-item" 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="#" class="dropdown-item delete" data-formid="server_row_[% loo.id | uri %]" data-servername="[% loo.servername | html %]"><i class="fa fa-trash-can"></i> Delete</a>
<form id="server_row_[% loo.id | uri %]" action="/cgi-bin/koha/admin/z3950servers.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-delete_confirmed">
<input type="hidden" name="id" value="[% loo.id | uri %]">
</form>
</li>
</ul>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
</div> <!-- /.page-section -->
[% END %]
</main>
</div> <!-- /.col-md-10.order-md-2 -->
<div class="col-md-2 order-sm-2 order-md-1">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-md-2.order-md-1 -->
</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, {
"columnDefs": [
{ "targets": [-1], "orderable": false, "searchable": false },
],
"pagingType": "full"
}));
$(".delete").on("click",function(e){
var servername = $(this).data("servername");
let formid = $(this).data("formid");
if( confirm( _("Are you sure you want to delete server %s?").format(servername) ) ) {
$('#'+formid).submit();
return false;
} else {
e.preventDefault();
}
});
});
[% END %]
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]