Bug 5786 - Move AllowOnShelfHolds and OPACItemHolds system prefs to the Circulation...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / z3950servers.tt
index 9657a0e..0ff1b09 100644 (file)
@@ -1,7 +1,16 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Administration &rsaquo; Z39.50 servers
-[% IF op == 'edit' %] &rsaquo; Modify Z39.50 server [% server.name %][% END %]
-[% IF op ==  'add' %] &rsaquo; New Z39.50 server[% END %]
+
+[% BLOCK ServerType %]
+    [% IF (server.servertype||type) == 'sru' %]
+        SRU
+    [% ELSIF (server.servertype||type) == 'zed' %]
+        Z39.50
+    [% END %]
+[% END %]
+
+<title>Koha &rsaquo; Administration &rsaquo; Z39.50/SRU servers
+[% IF op == 'edit' %] &rsaquo; Modify [% PROCESS ServerType %] server [% server.servername %][% END %]
+[% IF op ==  'add' %] &rsaquo; New [% PROCESS ServerType %] server[% END %]
 </title>
 [% INCLUDE 'doc-head-close.inc' %]
 
             $("#encoding").val('[% server.encoding %]');
             $("#recordtype").val('[% server.recordtype %]');
         [% END %]
+        // Disable recordtype (and default to bib) for non-Z3950 servers until auth is supported
+        [% UNLESS (server.servertype||type) == 'zed' %]
+            $("#recordtype").prop('disabled',true);
+        [% END %]
         $( "#serverentry" ).validate({
             rules: {
                 servername: { required: 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);
+        });
     });
+    function ModMapping () {
+        var map= $('#show_sru_fields').val();
+        window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map,'popup','width=800,height=400,resizable=no,toolbar=false,scrollbars=no,top');
+    }
 [% ELSE %]
     $(document).ready(function() {
         $("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
@@ -60,9 +87,9 @@
 [% INCLUDE 'z3950-admin-search.inc' %]
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
-<a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a>
-[% IF op == 'edit' %]&rsaquo; Modify Z39.50 server [% server.name %][% END %]
-[% IF op ==  'add' %]&rsaquo; New Z39.50 server[% END %]
+<a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a>
+[% IF op == 'edit' %]&rsaquo; Modify [% PROCESS ServerType %] server [% server.servername %][% END %]
+[% IF op ==  'add' %]&rsaquo; New [% PROCESS ServerType %] server[% END %]
 </div>
 
 <div id="doc3" class="yui-t2">
 <div class="yui-b">
 
 [% IF msg_deleted %]
-    <div class="dialog alert">Z39.50 server deleted ([% msg_add %])</div>
+    <div class="dialog alert">Z39.50/SRU server deleted ([% msg_add %])</div>
 [% ELSIF msg_updated %]
-    <div class="dialog message">Z39.50 server updated ([% msg_add %])</div>
+    <div class="dialog message">Z39.50/SRU server updated ([% msg_add %])</div>
 [% ELSIF msg_added %]
-    <div class="dialog message">Z39.50 server added ([% msg_add %])</div>
+    <div class="dialog message">Z39.50/SRU server added ([% msg_add %])</div>
 [% ELSIF msg_notfound %]
     <div class="dialog alert">Error: Server with id [% msg_add %] not found</div>
 [% END %]
 [% IF ( add_form ) %]
     <form action="[% script_name %]" name="Aform" method="post" id="serverentry">
         <input type="hidden" name="op" value="add_validated" />
+        <input type="hidden" name="servertype" value="[% server.servertype||type||'zed' %]"/>
         [% IF op == 'edit' %]
-            <h1>Modify Z39.50 server</h1>
+            <h1>Modify [% PROCESS ServerType %] server</h1>
             <input type="hidden" name="id" value="[% server.id %]" />
         [% ELSE %]
-            <h1>New Z39.50 server</h1>
+            <h1>New [% PROCESS ServerType %] 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="name">Server name: </label><input type="text" name="servername" id="servername" size="65" maxlength="100" onblur="toUC(this)" value="[% server.servername | html %]"/></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>
+            [% 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 %]" required="required" /> <span class="required">Required</span>
         </li>
         </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>
+        <li><label for="checked">Preselected (searched by default): </label>
         [% IF ( server.checked ) %]
             <input type="checkbox" name="checked" id="checked" value="1" checked="checked" />
         [% ELSE %]
             <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 %]"/>
+        <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 %]" />
+        <input type="text" name="show_sru_fields" id="show_sru_fields" size="100" value="[% server.sru_fields %]" disabled/> <input type="button" value="Modify" onclick="ModMapping()" />
+        </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 %]"/>
+        <div class="hint">Separate multiple filenames by commas.</span>
+        </li>
+
         </ol>
         </fieldset>
 
 
 [% 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>
+        <a id="newserver" class="btn btn-small" href="/cgi-bin/koha/admin/z3950servers.pl?op=add&type=zed"><i class="icon-plus"></i> New Z39.50 server</a>
+        <a id="newserver" class="btn btn-small" href="/cgi-bin/koha/admin/z3950servers.pl?op=add&type=sru"><i class="icon-plus"></i> New SRU server</a>
     </div>
-    <h3>Z39.50 servers administration</h3>
+    <h3>Z39.50/SRU 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>
+        <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>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&amp;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>
+            <tr>
+            <td><a href="[% loo.script_name %]?op=edit&amp;id=[% loo.id %]">[% loo.servername %]</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>[% IF ( loo.recordtype == 'biblio' )  %]
                 <span>Bibliographic</span>
                 [% ELSIF ( loo.recordtype == 'authority' ) %]
                 <span>Authority</span>
                 [% END %]
             </td>
-            <td><a href="[% loo.script_name %]?op=edit&amp;id=[% loo.id %]">Edit</a> <a href="[% loo.script_name %]?op=add&amp;id=[% loo.id %]">Copy</a> <a href="javascript:void(0);" onclick="ConfirmDelete('[% loo.name | replace("['\"]","") %]','[% loo.id %]');">Delete</a></td>
+            <td><a href="[% loo.script_name %]?op=edit&amp;id=[% loo.id %]">Edit</a> <a href="[% loo.script_name %]?op=add&amp;id=[% loo.id %]">Copy</a> <a href="javascript:void(0);" onclick="ConfirmDelete('[% loo.servername | replace("['\"]","") %]','[% loo.id %]');">Delete</a></td>
             </tr>
         [% END %]
         </tbody>