Marcel de Rooy
afb6d14f25
This patch makes a few tiny improvements on the form, does some housekeeping/tidying up, and replaces SQL code by DBIC statements. In detail: - Adds an id parameter (more precise than searchfield). - With the move from searchfield to id, you can rename a server now. - A Copy button is added to clone a server. - Confirming a delete is moved to javascript. No additional form anymore. - A message about an insert, update or delete is shown in a div dialog alert above the table instead of a separate form. - Remove offset parameter, Next/Prev button and associated logic. - All SQL statements are replaced by DBIC. - Function StringSearch is renamed to DBICified ServerSearch. - Remove tabs from script and template. Adjust some indentation. Test plan: - Test adding, editing and deleting Z3950 servers. - Test searching for a server with the top search box (not table). - Add a server with quotes in the name. Search for it. Edit or delete. Followed tet plan. Patch behaves as expected. Signed-off-by: Marc Veron <veron@veron.ch> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
194 lines
8.4 KiB
Text
194 lines
8.4 KiB
Text
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Administration › Z39.50 servers
|
|
[% IF op == 'edit' %] › Modify Z39.50 server [% server.name %][% END %]
|
|
[% IF op == 'add' %] › New Z39.50 server[% END %]
|
|
</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
|
|
[% IF op == 'list' %]
|
|
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% END %]
|
|
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
[% IF ( add_form ) %]
|
|
$(document).ready(function(){
|
|
// Update selects for syntax, encoding and recordtype
|
|
[% IF server %]
|
|
$("#syntax").val('[% server.syntax %]');
|
|
$("#encoding").val('[% server.encoding %]');
|
|
$("#recordtype").val('[% server.recordtype %]');
|
|
[% END %]
|
|
$( "#serverentry" ).validate({
|
|
rules: {
|
|
servername: { required: true },
|
|
host: { required: true },
|
|
port: {
|
|
required: true,
|
|
number: true
|
|
},
|
|
db: { required: true },
|
|
rank: { number: true },
|
|
timeout: { number: true }
|
|
}
|
|
});
|
|
});
|
|
[% ELSE %]
|
|
$(document).ready(function() {
|
|
$("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [2,3,4,7,8,9,10,11], "bSortable": false, "bSearchable": false },
|
|
],
|
|
"sPaginationType": "four_button"
|
|
}));
|
|
});
|
|
function ConfirmDelete(name,id) {
|
|
if( confirm( _("Choose OK if you really want to delete server ")+
|
|
name+'.')) {
|
|
window.location="[% script_name %]?op=delete_confirmed&id="+id;
|
|
}
|
|
return false;
|
|
}
|
|
[% END %]
|
|
//]]>
|
|
</script>
|
|
|
|
</head>
|
|
<body id="admin_z3950servers" class="admin">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'z3950-admin-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> ›
|
|
<a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a>
|
|
[% IF op == 'edit' %]› Modify Z39.50 server [% server.name %][% END %]
|
|
[% IF op == 'add' %]› New Z39.50 server[% END %]
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
|
|
[% IF msg_deleted %]
|
|
<div class="dialog alert">Z39.50 server deleted ([% msg_add %])</div>
|
|
[% ELSIF msg_updated %]
|
|
<div class="dialog alert">Z39.50 server updated ([% msg_add %])</div>
|
|
[% ELSIF msg_added %]
|
|
<div class="dialog alert">Z39.50 server added ([% msg_add %])</div>
|
|
[% END %]
|
|
|
|
[% IF ( add_form ) %]
|
|
<form action="[% script_name %]" name="Aform" method="post" id="serverentry">
|
|
<input type="hidden" name="op" value="add_validated" />
|
|
[% IF op == 'edit' %]
|
|
<h1>Modify Z39.50 server</h1>
|
|
<input type="hidden" name="id" value="[% server.id %]" />
|
|
[% ELSE %]
|
|
<h1>New Z39.50 server</h1>
|
|
[% END %]
|
|
<fieldset class="rows">
|
|
<ol>
|
|
<li><label for="name" class="required">Z39.50 server: </label><input type="text" name="servername" id="servername" size="65" maxlength="100" onblur="toUC(this)" value="[% server.name | html %]" required="required"/> <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 %]" required="required" /> <span class="required">Required</span>
|
|
</li>
|
|
<li><label for="port" class="required">Port: </label> <input type="text" name="port" id="port" size="5" value="[% server.port %]" 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 %]" required="required" /> <span class="required">Required</span>
|
|
</li>
|
|
<li><label for="userid">Userid: </label> <input type="text" name="userid" id="userid" value="[% server.userid %]" />
|
|
</li>
|
|
<li><label for="password">Password: </label> <input type="text" name="password" id="password" value="[% server.password %]" />
|
|
</li>
|
|
<li><label for="checked">Checked (searched by default): </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 %]
|
|
</li>
|
|
<li><label for="rank">Rank (display order): </label> <input type="text" name="rank" id="rank" size="4" value="[% server.rank %]" />
|
|
</li>
|
|
|
|
<li><label for="syntax">Syntax (z3950 can send<br /> records in various format. Choose one): </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>
|
|
</li>
|
|
|
|
<li><label for="encoding">Encoding (z3950 can send<br /> records in various encodings. Choose one): </label>
|
|
<select name="encoding" id="encoding">
|
|
[% FOREACH enc IN [ 'utf8' 'EUC-KR' 'ISO_5426' 'ISO_6937' 'ISO_8859-1' 'MARC-8' ] %]
|
|
<option value="[% enc %]">[% enc %]</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
|
|
<li><label for="timeout">Timeout (0 its like not set): </label>
|
|
<input type="text" name="timeout" id="timeout" size="4" value="[% server.timeout %]" /> seconds
|
|
</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>
|
|
</ol>
|
|
</fieldset>
|
|
|
|
<fieldset class="action"><input type="submit" 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-small" href="/cgi-bin/koha/admin/z3950servers.pl?op=add"><i class="icon-plus"></i> New Z39.50 server</a>
|
|
</div>
|
|
<h3>Z39.50 servers administration</h3>
|
|
[% IF id %]
|
|
You searched for record [% id %]
|
|
[% ELSIF searchfield %]
|
|
You searched for [% searchfield %]
|
|
[% END %]
|
|
<table id="serverst">
|
|
<thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Checked</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>Options</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
[% FOREACH loo IN loop %]
|
|
[% UNLESS ( loop.odd ) %]
|
|
<tr class="highlight">
|
|
[% ELSE %]
|
|
<tr>
|
|
[% END %]
|
|
<td><a href="[% loo.script_name %]?op=edit&id=[% loo.id %]">[% loo.name %]</a></td><td>[% loo.host %]:[% loo.port %]</td><td>[% loo.db %]</td><td>[% loo.userid %]</td><td>[% IF loo.password %]########[% END %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank %]</td>
|
|
<td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td><td>[% loo.recordtype %]</td>
|
|
<td><a href="[% loo.script_name %]?op=edit&id=[% loo.id %]">Edit</a> <a href="[% loo.script_name %]?op=add&id=[% loo.id %]">Copy</a> <a href="javascript:void(0);" onclick="ConfirmDelete('[% loo.name | replace("['\"]","") %]','[% loo.id %]');">Delete</a></td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'admin-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|